• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Errors for no reason?? (Solved)

N

NizarPlayz

Guest
So i was watching a video about ini files how they work etc.. So i was writing a script
scr_savegame
Code:
if (file_exists("Save.sav")) file_delete("Save.sav");
ini_open("Save.sav");
var SavedRoom = room;
ini_write_real("Save1","room",SavedRoom);
ini_close();
so i was geting this error
ERROR in line 3 pos 16 unexpected symbol in expression
i wrote all the code same as the video
now i started to wrote other script
scr_loadgame
Code:
if (file_exists("Save.sav"))
{
    ini_open("Save.sav");
    var LoadedRoom = ini_read_real("Save1","room",room0);
    ini_close();
    room_goto(LoadedRoom); 
}
else
{
    //do nothing
}
and i was getting the same error
ERROR in line 4 pos 21 unexpected symbol in expression
why is this happening?
I checked my all code and there is nothing wrong? I am getting errors for no reason... Really funny.
And i am using Game Maker 8.0 Pro.
Any help would be really appreciated!
This is the video i was watching

 
Last edited by a moderator:
P

PandaPenguin

Guest
well it would really help us helping you if you would post "line 3 pos 16" and "line 4 pos 21" of your code
everything else would be guessing what might be the problem
 
N

NizarPlayz

Guest
well it would really help us helping you if you would post "line 3 pos 16" and "line 4 pos 21" of your code
everything else would be guessing what might be the problem
var SavedRoom = room;
this is the line 3 pos 16
var LoadedRoom = ini_read_real("Save1","room",room0);
and this is the line 4 pos 21
 
Change your var lines.

Code:
var LoadedRoom; LoadedRoom = ini_read_real("Save1","room",room0);
Versions below Studio don't support the style in the video. Also, there's no point in having an else case that does nothing. If you want nothing to happen, don't code anything.
 
N

NizarPlayz

Guest
Change your var lines.

Code:
var LoadedRoom; LoadedRoom = ini_read_real("Save1","room",room0);
Versions below Studio don't support the style in the video. Also, there's no point in having an else case that does nothing. If you want nothing to happen, don't code anything.
Thanks a lot! This worked
 
Top