Load Attribute and Save Attribute not working

GamePizzaGamePizza Member, PRO Posts: 227
edited August 2012 in Working with GS (Mac)
I'm trying to store values in persistent storage with Save Attribute.

I'm testing it on GS Viewer on iPad but using Load Attribute I am not getting back the values I saved when I start the game again on GS Viewer in the Recent Games button.

What am I doing wrong. I am sure I am using the same keys.

The values I load are always 0.

Comments

  • patapplepatapple Member Posts: 873
    edited August 2012
    Do you use any reset game behaviors or something like that?
  • GamePizzaGamePizza Member, PRO Posts: 227
    edited August 2012
    no, I'm not using reset behavior anywhere in the game
  • GamePizzaGamePizza Member, PRO Posts: 227
    edited August 2012
    Created a test project that has only load and save attribute behavior and it works as expected.
    Saved a text attribute, boolean, integer and real and those values loaded and displayed when start game again in gs viewer. But don't understand why it doesn't work in my game project.
  • GamePizzaGamePizza Member, PRO Posts: 227
    my game is 61.7 MB. it has 490 actors and 48 scenes. it's for iPad landscape. I wonder if any of these factors could account for the problem.
  • GamePizzaGamePizza Member, PRO Posts: 227
    I'm using shorter keys 3 or 4 characters long and thats helping. Some attributes are coming back. But not all. Perhaps I have too many. I have about 50 keys now.
  • KiwiLeeKiwiLee Member Posts: 181
    Make sure that you are NOT using the expression editor to enter the keys. Only type in the field directly :-) if you gave anything in the expression editor for the key field click remove expression!
  • GamePizzaGamePizza Member, PRO Posts: 227
    WOW! THANK YOU SO MUCH!!! That looks to have fixed the problem!! That was a tough one!
  • Hi everybody!
    I have a problem publishing my game for HTML5.
    I used to store values in Tables for the iPhone version of the game, and nothing was wrong! I tried to publish for HTML5, and after a lot of headaches, somebody from Game Salad's Facebook said that HTML5 doesn't support tables!! and it's seems to be the truth!
    So, anybody knows if HTML5 supports Save and Load attributes for persistent storage??

    Exist any other way to save values in HTML5?


  • karuzokaruzo Member Posts: 35
    @KiwiLee - thanks! Been searching for an answer for couple of hours. I doubled check and indeed had to delete the key as the expression editor was showing it.

    Doron
  • neilrcooperneilrcooper Member Posts: 1
    To KiwiLee. Thanks for the solution. I had been using the Expression Editor and it never occurred to me to type in directly. You solved my problem.
  • euwingtham@gmail.comeuwingtham@gmail.com Member Posts: 2
    First time using Load/Save Attribute. In GameSalad, when I click on Preview, my game runs and I changed the "High Score". I then press the Reload button just beneath the Preview button and my "High Score" is persistent, so that's good.

    But after clicking Home, then clicking Preview, the "High Score" is reset. Is this expected since it went off Preview? Does it mean that my "High Score" is not persistent when I try it on a real iOS device?

    Thanks!
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    saved attributes are not persistent in preview mode. when you stop previewing it clears everything out.

    you'll have to test on a device to make sure
  • actordudeactordude Member Posts: 27
    KIWI LEE , is a double genius...i have a game that suddenly my characters lost their save attires , i rewrote a whole scene because it didnt save...but now i know you have to delete the key out of expression editor ''remove reference' otherwise it doesnt work...thanks so much ,as the problem reoccured and you have sussed it...give that man a MEDAL...
  • actordudeactordude Member Posts: 27
    Make sure that you are NOT using the expression editor to enter the keys. Only type in the field directly :-) if you gave anything in the expression editor for the key field click remove expression!
  • alarm656alarm656 Member Posts: 291
    Do I need delete these 1,2,3...etc to get better save game option?
  • alarm656alarm656 Member Posts: 291
    This?
  • KevinCrossKevinCross London, UKMember Posts: 1,894
    @alarm656 did you intend to run the save attributes every second? Did you not want after 1 second?

    I would probably change your key names to something more descriptive too because if you get too many like you have there it'll be hard to know what key 1 is linked to without opening that actor everytime. If I'm saving coins for example I would do

    Save Attribute
    Attribute: game.coins
    Key: coins

    That's far more descriptive then a key numbered 2.
  • alarm656alarm656 Member Posts: 291
    Hi thank you KevinCross. Are you putting this attributes in each actors? For example:
    Rule: Press down
    Change Attribute: Game.key_own true
    Save Attribute: game.key_own. Key: keyown.
    Like that?
    I did nothing inside each actors just only true/false, 0/1

    And deleted expression in load and save actors. Game saves perfectly but it not saved you close the app completely (double press home button)
Sign In or Register to comment.