I'm working on a game that has many values. Like 200 or so.. Sounds weird but it's true. I want to make a save option in the game, How can I save easily 1000 values in for example an Ini-file? Or are there better sollutions/extensions??
If your using the 1000 GLOBAL values object, DESTROY IT! Program it no longer! It doesnt work. I forget when it doesnt work but it doesnt work at the worst time.. lol, its like when you save a value then skip a frame and try to get it out.
We are the music makers, we are the dreamers of dreams...
i am using the 1000 global value object since a while. around 400 GV in use. and no problems here ... but i am using MMF 1.5 . maybe you all talking about the 1000GV object for tgf ... tgf always crashed at my pc. so i never used it
if you still want to use the 1000GV object and want to save it all to an array, use this:
you need two counters( .one for loading ,one for saving. i always use counters to have a control at which stage i made a mistake ), an normal array( setup: numerical, X=1000, Y=1, Z=1,and two buttons. and then there is fastloop ...
the stuff between the "-" means a symbol in the code. i wish that mmf 2 will have a way to copy code from the events list editor to normal rtf ...
here is the loading code:
Button -load button- clicked
+ -load counter- is 0
... -array- Load array from file Appdrive$+Appdir$+"savegame1.arr"
... set -load counter- to 1
-load counter- is 1
+only one action when event loops
... start loop "load" 1000 times
On Loop "load"
... Set Global Value LoopIndex("load") to ValueAtX("array",LoopIndex("load") )
-load counter- is 1
+every 1 second
... set -load counter- to 0
this was the loading code.now the savecode:
Button -save button- clicked
+ -save counter- is 0
... set -save counter- to 1
-save counter- is 1
+only one action when event loops
... start loop "save" 1000 times
On loop "save"
... -array-: Write Value getgloval("-1000GV-",LoopIndex("save"))to(LoopIndex("save"))
-save counter- is 1
+every 1 second
... set -save counter- to 2
-save counter- is 2
... -array- Save array to file Appdrive$+Appdir$+"savegame1.arr"
... set -save counter- to 0