• 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!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Legacy GM [SOLVED] Save file is broken

E

EvansBlack

Guest
For some reason my game have 1 out 100 chance to broke my save file. I am using ini file to store information.
And normal section in my ini file looks like this:
Code:
[PLAYER]
global.maxEnergy="40.000000"
global.energy="40.000000"
global.catalyst="0.000000"
global.maxFuel="30.000000"
global.shield="0.050000"
global.maxModule="1.000000"
global.maxHP="40.000000"
global.currentHP="40.000000"
global.fuel="30.000000"
global.credits="2000.000000"
global.playerShipName="ASDASD"
But sometimes GameMaker write info to the ini file wrong. Like this:
Code:
[PLAYER]
global.maxEnergy="40.000000"
global.energy="40.000000"
global.catalyst="0.000000"
global.maxFuel="30.000000"
global.shield="0.050000"
global.maxModule="1.000000"
global.maxHP="40.000000"
global.currentHP="40.000000"
global.fuel="30.000000"
global.credits="2000.000000"
global.playerShipName="ASDASD
"
See those quotes in the last line? That is the problem. But i dont know why it is hapenning.
 
It's hard to tell without knowing your code and the fact that it only happens rarely.

Are you using more than one ini file in your game?

If you are, I would start by checking that you are not trying to access more than one ini file at a time, and that you always have closed the ini file after using it by calling "ini_close()"

EDIT: Also, it looks like the ini file is saving the ENTER/RETURN key (a newline)

When your player inputs the ship name, are you perhaps capturing them pressing the ENTER key when they do that?

Is there a button they are supposed to click to confirm the ships name - but perhaps they are typing the ships name, pressing ENTER, then pressing the confirm button.
 
E

EvansBlack

Guest
It's hard to tell without knowing your code and the fact that it only happens rarely.

EDIT: Also, it looks like the ini file is saving the ENTER/RETURN key (a newline)

When your player inputs the ship name, are you perhaps capturing them pressing the ENTER key when they do that?

Is there a button they are supposed to click to confirm the ships name - but perhaps they are typing the ships name, pressing ENTER, then pressing the confirm button.
THIS! Thank you so much! That was a problem!
 
Top