First time saving

P

P4yin

Guest
Hello, I am new to gamemaker and community here. While trying to create an ini file for saving, i'm having issues with saving what room im in. Using a variable, and making it equal to room, it is saying that the equals sign is unexpected. What should i do?
 

chamaeleon

Member
Hello, I am new to gamemaker and community here. While trying to create an ini file for saving, i'm having issues with saving what room im in. Using a variable, and making it equal to room, it is saying that the equals sign is unexpected. What should i do?
What you should do is post the code and error message so there is something concrete to analyze.
 
P

P4yin

Guest
What you should do is post the code and error message so there is something concrete to analyze.
sorry about that!
Here it is:
var SavedRoom = room;
i was following the saving and loading ini files tutorial
EDIT: the equals sign used here is the once referenced above
 

chamaeleon

Member
sorry about that!
Here it is:
var SavedRoom = room;
i was following the saving and loading ini files tutorial
EDIT: the equals sign used here is the once referenced above
That line in isolation will not yield an error. Something else is tripping you up.
 
P

P4yin

Guest
That line in isolation will not yield an error. Something else is tripping you up.
This is all i have

if (file_exists("Raj.sav")) file_delete("Raj.sav");
ini_open ("Raj.sav");
var SavedRoom = room;
ini_write_real ("Save1","room",SavedRoom);
ini_close();
Edit: The error says "ERROR at line 3 pos 16: Unexpected symbol in expression."
 

chamaeleon

Member
This is all i have

if (file_exists("Raj.sav")) file_delete("Raj.sav");
ini_open ("Raj.sav");
var SavedRoom = room;
ini_write_real ("Save1","room",SavedRoom);
ini_close();
Edit: The error says "ERROR at line 3 pos 16: Unexpected symbol in expression."
Copy-pasting that ran fine, and reading in the room number using ini_read_real() returned the written number.
 

FrostyCat

Redemption Seeker
If your GM won't accept that syntax, split it into 2 lines. This is the required procedure for legacy versions of GM (8.1 and below).
Code:
var SavedRoom;
SavedRoom = room;
Though in your situation, there's no point for that line. You can just do this:
Code:
ini_write_real("Save1", "room", room);
Please, if you're just starting out with GM, don't use ancient versions. Modern tutorials won't work on them, and you can't get help properly with them.
 
What version of Game Maker are you using, I think some older versions didn't support assigning a value on the same line that you declared them.

But yes, you could skip using SavedRoom and just use room directly in your ini_write_real() function.
 

chamaeleon

Member
And needless to say, saving the room number would not be reliable between versions of games if you change the order, or add or remove rooms.
 
P

P4yin

Guest
If your GM won't accept that syntax, split it into 2 lines. This is the required procedure for legacy versions of GM (8.1 and below).
Code:
var SavedRoom;
SavedRoom = room;
Though in your situation, there's no point for that line. You can just do this:
Code:
ini_write_real("Save1", "room", room);
Please, if you're just starting out with GM, don't use ancient versions. Modern tutorials won't work on them, and you can't get help properly with them.
Thanks for the help! Im still on GM 8.0 pro but am thinking of upgrading
 
Top