Saving boolean .ini

Pfap

Member
I need to save a variable as being set to true, would I use the ini_write_real or ini_write_string function? My gut is telling me to just save it as the real 0, but can anyone confirm?

Edit: I just checked the manual Boolean section

"A boolean is simply a value that can either be true or false. Note that currently GameMaker Studio 2 does not support "true" boolean values, and actually accepts any real number below 0.5 as a false value, and any real number equal to (or greater than) 0.5 as being true. This does not mean however that you should be checking 1 and 0 (or any other real number) for true and false, as you are also provided with the constants true andfalse which should always be used in your code to prevent any issues should real boolean data types be added in a future update."

So, basically I'm having the player do a bunch of stuff only during the first time they play and then saving their info and upon subsequent restarts running this:

if player_loaded = true{ // go to the next room
}

The first time they open the game it will be false.
Maybe I should just use a string?? Like "true" and "false".

ini_write_string("Startup", "Player", player_loaded);
Or will the above work? With the 3rd argument storing the constant true?



TL;DR

Is there a proper way to save Booleans?
 
Last edited:
  • Wow
Reactions: Mut
Top