Saving To Table Problem

I have a rule where on an timer saying:
If game.score > game.highscore
Change game.higscore -> game.score
This is then displayed on the main menu.
I want to be able to save this so it remains the same when the app is restarted. I've read the best way to do this is by tables but after setting up some rules I was sure would work my table values didn't change when the game reset. Could anyone give some help?

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    If you're saving a single attribute, you really don't need a table. Just do a Save Attribute and give it a key such as highscore. Then, on an actor on your first scene do a Load Attribute with that same key to load the value into game.highscore.

    If you have many attributes you want to save and load this way, that's where tables come in handy. You use a Save Table behavior and there is no need to load the values... they automatically load when the first scene starts.

    If you're still having trouble, post your rules.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • tahakitantahakitan Member Posts: 102

    This video goes over how to save attributes using the save/load attribute behavior. I used it and it works but I have had a few issues with it so I switched to tables which were easier in every way.


    Here is one for using tables. you can use both videos and combine techniques and such. also the cookbook and gshelper should have a bunch of tutorials on it. just follow the steps. remember to use save table after you changed it. just because you change the table doesnt mean it automatically saves it. the awesome thing is that you don't need a load attribute so you never have to worry about the loading issues.

    I hope this helps.
Sign In or Register to comment.