save and load attributes -- how do you use them?
Maybe I'm not finding the instructions on this site. But the ones that I do find are very vague.
I'm trying to keep track if the player unlocked a feature. So I simply placed a save attribute on a button to unlock it. (which toggles an attribute "unlock" to 1)
Save attribute asks for an attribute and a key -- What is the "KEY" mean? This is the mystery to me.
Then Load attribute asks for the KEY and the ATTRIBUTE - I get why it's asking for an attribute, but what is the key? IS the key the amount of the attribute?
On top of that I'm trying to figure out how to test if my assumptions of the process even worked. Do I have to publish to my phone to see if save works?
Please help, I'm so close to submitting and I don't want to rip this feature out because of simple confusion of the process.
I'm trying to keep track if the player unlocked a feature. So I simply placed a save attribute on a button to unlock it. (which toggles an attribute "unlock" to 1)
Save attribute asks for an attribute and a key -- What is the "KEY" mean? This is the mystery to me.
Then Load attribute asks for the KEY and the ATTRIBUTE - I get why it's asking for an attribute, but what is the key? IS the key the amount of the attribute?
On top of that I'm trying to figure out how to test if my assumptions of the process even worked. Do I have to publish to my phone to see if save works?
Please help, I'm so close to submitting and I don't want to rip this feature out because of simple confusion of the process.
Comments
It is always best to publish to your device to test that these work.
When you want to SAVE the value, in the ATTRIBUTE field you select your game.unlock attribute and in the KEY field you can type in what ever you want. But to make it easy to remember I suggest you type in the same as the attribute: "unlock" (without ").
Now your game.unlock attribute is saved in the key "unlock".
To load the value from the "unlock" key, you just type in "unlock" in key field and select your game.unlock attribute.
Now you have loaded the value back into the attribute.
Save '1' to UnlockKey
Load 'UnlockKey' to 'self.Unlock'
Save and Load are used to save/load data between sessions, not to change values of attributes. So if you want to make sure that the unlock will stay unlocked when you restart the games you should:
Change unlock to 1 (using Change Attribute)
Save the unlock attribute (using Save Attribute)
When the game starts up you should have:
Load the unlock attribute (using Load Attribute)
I thought save attribute places some file/data to the phone, so if I turn off/reset my phone the data will be available when I open the game again.
After the game ends...
I'm doing the following:
change attribute: game.unlock To: game.unlock+1
save attribute
Attribute: game.unlock Key:unlock
When the game starts/main Menu
I'm doing the following:
Load Attribute
Key: unlock Attribute: game.unlock
---- This way if you play the game a certain amount of times (7) it unlocks a feature.
Also added a stop gap in case the value of unlock is more than 7...
Rule: Attribute: game.unlock (equal or greater than) 7
Change Attribute game.unlock To 7
---------
Thanks for the help