Associative Array
With the Associative array you can save and load character positions, directions, current stats, or just about any value you need. It can, when made global, also share these values over frames and sub-applications, which is really handy for inventories, maps and other things. The beauty of this array is the use of plain english "Keywords", which can be followed by a number or string such as:
NivramsOxygen=480
or
NivramsLevel=duffus
You can also retrieve data of counters, alterable values, global values, characters, enemies, Associative Array, or just about anything.
This makes it simple, along with good comments, to keep track of what is happening within your game or application. Use the Modify/Add a Value or Modify/Add a String to set the value at a Key.
Nivram overlaps Garlic
+Only one action when event loops
Associative Array: Set Value at Key "GARLIC" to 1
Garlic: Destroy
To retrieve the data (Key) from the Associative Array, Compare Two General Values:
"GARLIC"=1
+Only one action when event loops<BR>
Garlic:destroy
When you save your game using the Associative Array, the Key is saved. When you load the game, the Key GARLIC will be equal to 1. The garlic will be destroyed and Nivram will still have the garlic. If you desire, when the Key GARLIC=1 you can place a garlic icon in an inventory slot somewhere.
So, how do we save our game?
Let's say we have a Save Button and want to save the array in the game directory:
Player clicks on Save Button
Associative Array: Save Associative Array file apppath$+"nivram.dat" (you can use any name and file ext you want like: duffus.sav)
So, how do we load our game?
Let's say we have a Load Button and want to load the array from our game directory:
Player clicks on Load Button
Associative Array: Load Associative Array file apppath$+"nivram.dat"
I also want to let you know that for some value loadings, such as position of the character, you must put in a second event for clicking on the Load Button. The loading of the array needs to be first, before calling up values. If the values, such as character postion, is called before loading the actual array, the character position will not be loaded.
The Associative Array can find an instance of a word or string. So you can load in a vocabulary and see if the word exists without looping. Instead of having numerous List Objects for Shops in an RPG, you could use just one Associative Array. With it you can list the item and price and call it up for any Shop your player enters. Very good if your player changes levels. You load up the Associative Array, then all you have to do is take a couple of items and their prices, and put them into the Shop.
A couple of notes for you:
You can disable the pop up for this extension by unchecking "Remind me later"
My thanks goes out to Click Team, the developer of this extension, and forum members for their help and understanding.