I posted this help request on my iOS game projectpage as well. But think I might get more replies if I simply ask in the forums.
Anyhoo, I've never used that much of .ini before and really not that much of fastloops either. And now for my little iOS project to go further I must learn both since a level editor is needed.
The tutorials I've seen have been spoonfeeding me the information and yet I've come not to get what the conditions actually does.
Do you guys have any simple .ini tutorials preferably about the regular clickteam INI extension. And most useful would probably be a .ini tutorial on saving and loading within a .exe using loops.
A loop is just a method of checking more condition and doing more actions in a single game loop. It simply multiplies whatever condition the loop is attached to by however many loops you choose to run.
-Always
-Run loop "cool" 25 times
-On loop "cool"
-Add 1 to counter
An although this is a bad way of adding 25 to a counter each game loop that exactly what the above does.
So if you're loading a level and you know it has 100 elements to load just run a loop that many times that loads each element each loop.
As for ini loading that is also easy. An ini is kinda like a Global Value that remains after you close the app.
First create an ini object in the frame and then the objects settings window set a filename:
"MyFirst.ini"
Next to save data (either a string or a value) open the event editor and do this:
-Some condition to save data
-Set Value in group "Save" in item "Health" to 76.
And to load it do this
-Some condition to load data
-Set Alterable Value "Health" of player to GroupItemValue( "ini", "save", "heath")
Try setting values for the X and Y coordinates of the objects in the INI file as separate entries.
I'm still personally mystified by using INI files myself, but it's only because I've not set aside the time to legitimately learn them. However, it's the key to save files, persistent high score tables and longer, more detailed games, as far as I can tell. Someday...
As S-m-r said just save the X and Y positions of all the objects you want to save to the ini.
If it's a lot of values you might wanna consider using the array object instead which also supports file saving and loading.
Heck you can use a loop for this. If you have 30 or so of the same object you can ID them and save their positions all at once into an array.
Just add a new alterable value to the object "ID" then use the action "Spread Value" on that object at the start of the frame, set the spread value to 0.
What this does is iterate through all the instances of that object in your frame and give them each a unique value for ID. Then you can start a loop called "SavePos" and on each loop check to see if ID matches loopindex("SavePos"), then save the X and Y pos of that instance into the array. After the loop is complete save the file.
When you reload you run the loop again but this time call is "LoadPos" and on each iteration check the position loopindex("LoadPos") in the array and place the objects with matching ID's in those positions.