The Daily Click ::. Forums ::. Klik Coding Help ::. INI Save & Load
 

Post Reply  Post Oekaki 
 

Posted By Message

Deaval

It's my lap

Registered
  06/02/2008
Points
  146

360 Owner
17th January, 2013 at 17/01/2013 17:09:28 -

Hey,

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.

I'd appericate it!


 
Image

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49667

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
18th January, 2013 at 18/01/2013 17:45:59 -

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")


Badda Bing Badda Boom!

 
n/a

Avantar1975



Registered
  01/12/2011
Points
  39
22nd January, 2013 at 22/01/2013 04:14:25 -

This pdf helped me once:

http://speedy.sh/mB9wk/ini-tutorial.pdf - just click on the name "ini-tutorial

 
n/a

Deaval

It's my lap

Registered
  06/02/2008
Points
  146

360 Owner
2nd February, 2013 at 02/02/2013 10:51:29 -

Thanks guys!

I found both Popcorns tutorial and UrbanMonks wisdom a big help.

I got saving and loading values down now but I'm not sure how I can use it to save positions.

In other words I'm not sure how I can save and load positions of objects into the .ini.

Any help would be appreciated!

 
Image

s-m-r

Slow-Motion Riot

Registered
  04/06/2006
Points
  1078

Candle
2nd February, 2013 at 02/02/2013 14:09:36 -

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...

 
n/a

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49667

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
2nd February, 2013 at 02/02/2013 19:19:43 -


Here is an example:
http://soapcow.com/uploads/SaveLoadObjectPositionsExample.zip


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.

Edited by UrbanMonk

 
n/a
   

Post Reply



 



Advertisement

Worth A Click