Legacy GM [SOLVED]Somebody please please help me!! My head is being done in!

Y

Yacob

Guest
Hello all

So I am STILL trying to get around saving game! :(

It seems everything is only suited for Final Fantasy or zelda-inspired games and hence no tutorials work for me.
I'm losing hair, sleep and hygeine over this!
Basically, my game runs more like phoneix wright:

All I want is to reliably save my variables but there are no examples on how to do this and it is all confusing as hell! :(
Nobody wants to explain anything. The person who used to help me over screen-share won't help me anymore and now I am completely stuck.
Here's the save script:


HEre's the load script:




I just want to release my game already! Been working on it for a year now, on a single chapter!!

Please somebody help!!! :'(
 

rIKmAN

Member
I just want somebody to point out the flaws in my code and how to correct them!
I don't think my previous thread will get any replies anyways :(
You are using an asset that most people won't have, so there is no way to know how it is supposed to work, whether you are using it correctly etc.

Stop using the asset and watch those videos I linked to save/load using standard built in GML functions, and if you can't get that working more people will be able to help.

Just because your last thread didn't get many replies doesn't mean you should create another one, wait a couple of days and then bump it.
 
S

SyntaxError

Guest
As others have said, I'm not familiar with the asset your using. Looking over the code above thought, there does seem to be an issue in the load script. You are loading the map, then writing global variables to the map when it looks like you should be assigning data from the map into the global variables instead.
 
Y

Yacob

Guest
Hmmm, I am trying the second video, but there's something I need to know:
He does the part in the load ini script where:
global.<variable> = ini_read_real("save1", "<key name>", "<default value>")
Is it really necessary to set the default value of the variable being read? I set them all to 0, even the ones that are strings and I have a feeling that that is why it is not working too well for me...
 

NightFrost

Member
The default value only matters if what you were looking for was not found in the ini file. In other words, you can check if your read was successful by comparing the result to the default value. For example
Code:
var Result = ini_read_real("player", "score", -1);
if(Result == -1){
    // Code to handle the read failure
} else {
    global.Score = Result;
}
 
Y

Yacob

Guest
I finally figured these things out!
What happened that I found weird is that I thought it was not loading/saving cause when I'd save strings <"">, whatever object that is created after the string is loaded won't work if it needs the variable with the string stored in it.
I changed the string value to 0 out of curiosity and suddenly the object works.
Any idea why this could be so?
Thank you!
 

Bingdom

Googledom
What you are saving/loading isn't ini files.
Your loading code is the wrong way around. Should be global.face_set = data[?"face 1"];

obj_player is NOT a string, it's an asset index on your resource tree. So if you type obj_player, it will return either 0, 1, 2...
"obj_player'" is just a string, will not work for instance_create(x,y,"obj_player");
 
Y

Yacob

Guest
SO- IT WORKS!!!!
Not only due to those videos but also cause I made a big, jumbled mess while coding while sleepy :p

NOW- rIKmAN, I owe you a commission :)
Whenever you want it, just message me, okay?
 
Last edited by a moderator:

rIKmAN

Member
SO- IT WORKS!!!!
Not only due to those videos but also cause I made a big, jumbled mess while coding while sleepy :p

NOW- rIKmAN, I owe you a commission :)
Whenever you want it, just message me, okay?
Sure, I'll send over my bank details - are you a Nigerian Prince looking to deposit his multi-million dollar inheritance in a bank account by any chance? :p

Glad you got it working, congrats - onwards and upwards! :)
 
Y

Yacob

Guest
haha, ah awesome - I won't say no but you really don't have to.

If you insist, what sort of style do you do?
You can find a lot of my art on the art topic, but I am capable of many styles.
examples:
 
Top