Y
Ysela_Creyo
Guest
Hi, I'm using ini_file, to save and load my current game, i'm having troubles trying to save the score.
The main problem is the game save and load the default game score, let's say it's "2000", (this value is set in my object code score = 2000) everytime game load the save.sav, it loads that score, but I want the game load/save the last actual score, let's say "1250" for example (the one showing in the drawing during the gameplay in the room). i have this script to make the game save (when game end) and load (when game start)
These script's are executed by load and save objects in my game.
The main problem is the game save and load the default game score, let's say it's "2000", (this value is set in my object code score = 2000) everytime game load the save.sav, it loads that score, but I want the game load/save the last actual score, let's say "1250" for example (the one showing in the drawing during the gameplay in the room). i have this script to make the game save (when game end) and load (when game start)
if (file_exists("save.sav")) file_delete("save.sav");
ini_open("save.sav");
var SavedRoom = room;
ini_write_real("save1", "room", SavedRoom);
ini_write_real("save1","score",score);
ini_close();
ini_open("save.sav");
var SavedRoom = room;
ini_write_real("save1", "room", SavedRoom);
ini_write_real("save1","score",score);
ini_close();
if (file_exists("save.sav"))
{
ini_open("save.sav");
var LoadedRoom = ini_read_real("save1","room","ingame");
score = ini_read_real("save1","score",0)
ini_close();
room_goto(LoadedRoom)
}
else
{
// do nothing
}
{
ini_open("save.sav");
var LoadedRoom = ini_read_real("save1","room","ingame");
score = ini_read_real("save1","score",0)
ini_close();
room_goto(LoadedRoom)
}
else
{
// do nothing
}
These script's are executed by load and save objects in my game.