Save and load attribute doesn't work
Gamepenciler
Artist/Game DeveloperMember, PRO Posts: 326
Hi all, I'm having a problem with my save and loading the game. Example I have a "score" attribute, then I also used the same attribute to save. Then I put load attribute at my main screen.
Then I put my game under test and played the game. When I close the game and open it again I lost all the score points and went back to 0. Is there something I did wrong with the save and loading thing?
Then I put my game under test and played the game. When I close the game and open it again I lost all the score points and went back to 0. Is there something I did wrong with the save and loading thing?
Artist/Game Developer / Animator at your service..
Comments
Artist/Game Developer / Animator at your service..
I haven't saved a table or attribute in viewer for a while (weeks, maybe even a month) so I may well be mistaken.
http://forums.gamesalad.com/discussion/59888/save-low-score-with-demo-project#latest
http://www.deepblueapps.com/levels-unlock-with-tables/
Darren.
-------
To mention, for anyone wanting to use a Table for Saving & Loading attributes, it's worth pointing out – make sure you use the Copy Table Behaviour first and use the copy for Load/Save otherwise it's a lot of work to reset the Table to start a game fresh.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Darren.
@KevinCross
Not sure why you find using Copy Table behaviours so bad, Kevin... (it sure beats having to set up a load of change attributes to put back original values in all your Tables... now that'd be pants for me!) You don't need to duplicate all values from the master tables for them to copy to, just make them with 1 row and 1 column with the + sign and that's enough (in other words, you don't even have to match the amount of rows and columns, or put in what type of attribute the column(s) will be). So that takes literally a couple of seconds for each of your table masters....
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
It needs another behavior called clear table, and then we wouldn't have to use copy table when we want to clear a table, and we wouldn't need to have to set up two versions of every table.
@KevinCross As long as the copies of each master are clearly named - TitemsCOPY, for instance – I still can't see the problem, sorry! The master tables and their simple table starts for each, ready to accept a copy, all sit nicely in the Tables section ready for use, no complication... and there's no need to delete them either... copying a table into it again will replace it totally again with that master table.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
I'm sure I can edit the xml file to sort them myself, and the DBA program that I purchased recently, which sorts attributes, may have the option to do so too (I've not looked yet).
I agree it'd be a nice feature to have sorting for the columns tho'... (as well as in the attributes lists)... by name or value... let's hope we get that at some stage. :-)
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
I'll live with it though
As I wrote, Kevin, for the copy table, all you need is the bare minimum, a table with 1 row and 1 column and no attribute types selected even, i.e just as it appears after pressing the + sign. That's it, done! No "physically setting up" anything except pressing the plus button and naming it. Providing you name it clearly so you know that'll be a particular copy from a master table, it's all done and dusted. :-)
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
I'll see if re-ordering them in logical order so that the masters and copies are together (i.e. alphabetically) makes things a lot more easier to work with if I have to introduce any more tables, especially when it comes to finding a particular table to manually edit.
I've hijacked this post long enough I think
@KevinCross
Glad I helped out. :-) Yes, ditto! Sorry, @ecanhoj
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Artist/Game Developer / Animator at your service..
I only have score attribute for now I don't think I need to use tables yet..
But in any case can somebody link me tutorials how to save and load using tables? thanks
Artist/Game Developer / Animator at your service..
Artist/Game Developer / Animator at your service..
If I recall, if you use the "e" you will have issues with the save/load attributes and gameCenter stuff. You should just type in saveScore without pressing the "e"...
www.appdore.com || appdore twitter || appdore facebook
Artist/Game Developer / Animator at your service..
I looked at Doodle Kicks and I have a timer of 0.1 around Game Centre login because otherwise it doesn't register when the game is first loaded, but the load attributes on the same actor do not have a timer around them. You could reduce the timer on the load to 0.1, although the timers aren't the reason for it not working. I can't actually see anything wrong in that screenshot.
How often are you updating game.StarScore and then saving it. Are you saving it at the end of a level/game?
One last question, when you install it through Xcode Organiser are you deleting the app before re-installing it each time? Or just installing it and overwriting the existing version?
EDIT: Another one last question Are you certain you haven't got anything in your code that resets game.StarScore?
This only happens when the game exits or if the game is closed and i reopen the app. I'd probably make a short test app and see what's going on.. Thanks @KevinCross
Artist/Game Developer / Animator at your service..
Hi @ecanhoj So it sounds like your Save Attribute behaviour is working OK but not the Load Attribute behaviour.
Which leads me to wonder if you've put the Load behaviour in a proper place for it to be recognised...
The following is a typical way that the Load Attribute behaviours are used... (in the "traditional" way, i.e without using Tables):
In your menu scene, two buttons, one with Start Game or New Game, whatever you want, and pressing this will take you to the start of a fresh game.
Then another button marked Continue or Continue Game, and before the Change scene behaviour, you put your load behaviours (including which level, if there's more than one level in the game; and it's here your Load Attributes go.
--Example of Rules in the continue game button:
When touch is pressed
Load Attribute key: saveScore attribute StarScore
--- then carry on with any more load attributes there might be--
---and if there's more than one level---
Rules: -- all nested in the above Rule--
When game.SceneWhich is 1
Change Scene Scene1
When game.SceneWhich is 2
Change Scene Scene2
etc.,
Hope that helps out.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps