SaveState..
Monkey Forums/Monkey Programming/SaveState..| 
 | ||
| Can someone please explain how this works? What I need is my app to remember some simple settings, like sound on, music on, player lives and the current level. Do I create a string like "sound=on,music=on,lives=3,level=6" and use that with the save state command or is there a different approach? I haven't used this command yet and the help only shows an integer state. Also how does this work with the iPhone? At the moment when I press home button and then enter my app it automatically resumes from where it left off. Does this behaviour change when I use states? Can I make it so that it begins from the main menu? Thanks for any help on this :) | 
| 
 | ||
| Add this to load the state every time you run the app Method OnCreate:Int()
 String state=LoadState()
 If state                       'false if nothing was loaded (wiped or first run
  Local stat:=state.Split(",")  'convert string to an array of strings
  sound=Bool(stat[0].Trim())    'Trim() is required for android or it will break the app
  music=Bool(stat[1].Trim())
  lives=Int(stat[2].Trim())
  level=Int(stat[3].Trim())
 End
EndWhenever you want to save your state: SaveState(Int(sound)+","+Int(music)+","+lives+","+","+level) Bool variables cannot be saved as strings without casting them to something else | 
| 
 | ||
| Thank you Aman, that has made it a lot clearer. |