N
NeveZz
Guest
So I have a variable (global.coins) and I want it to be the same value as before i restarted the game. I have a initialization room that sets the global.coins value to 0. How to fix this?
How do I do that? Is there any tutorial online?A quick and easy method would be to use an INI file to save value at game end and load at game start.
I've never been more confused in my life...Take a look at the manual pages about File Handling.
///When I initialize the game
ini_open( 'savedata.ini' );
global.coins = ini_read_real( 'save1', Coins, 0 );
ini_close();
///When bullet hits enemy i save game...
ini_open( 'savedata.ini' );
global.coins = ini_read_real( 'save1', Coins, 0 );
ini_close();
///Receive Coins
global.coins += 10;
ini_open("savedata.ini");
ini_write_real("save1", "Coins", global.coins);
ini_close();
///When Game is Opened
globalvar coins;
ini_open('savedata.ini');
global.coins = ini_read_real('save1','Coins',0);
ini_close();
Are you sure the save code is running? Is global.coins being overwritten AFTER it loads from the .ini?ok managed to get the game running, but the coins are not saving.
Code:///Receive Coins global.coins += 10; ini_open("savedata.ini"); ini_write_real("save1", "Coins", global.coins); ini_close();
Code:///When Game is Opened globalvar coins; ini_open('savedata.ini'); global.coins = ini_read_real('save1','Coins',0); ini_close();