Load and Save Attribute Question

nemnem Member Posts: 9
edited December 2011 in Working with GS (Mac)
Hi!
I apologize if this topic has been already discussed, but I tried to search for "save load attribute" and the likes and the results are not as expected (maybe there are problems with the new forum system?...)
In any case, here is the question.
Is it possible to use the load and save attribute behavior to save different scores and recall these scores within different actor instances? I explain better with an example. As I finish level 1, I save level 1 score using the save behavior and scorelevel1 as key. In a "summary screen" I have different instances of one actor which represent the icons of each level and attached to them a DisplayText behavior, which displays the score of that level. The score is retrieved with a load attribute behavior putting as key the following "equation": "scorelevel"..self.LevelNumber, where self.LevelNumber is a self attribute which has a different value for every instance. If, for example, self.LevelNumber is set to 1, I should be able to retrieve the score of the level n.1.
Alas, I tried that, but it doesn't seem to work. What can be the problem?
Thanks a lot in advance for your help!
Nem

Comments

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    All your load attributes should be right when the game starts. And what are you using to test save and load because you cant test that in the creator. Youll need to use the viewer then reselect the game from the recent games tab, or build a adhoc to test save and load
  • nemnem Member Posts: 9
    Yes, I'm using the iPad to test the game, but still doesn't work as expected.
    With "all your load attributes should be right when the game starts" do you mean that it is not possible to have a load attribute later in the game?
  • nemnem Member Posts: 9
    I found an error and solved the problem. The error was that I was saving an attribute at the same time when it was interpolating: I put the save attribute inside a timer with "after" set to the duration of the interpolation and now everything works well.
    With this I also confirmed myself the following two things:

    - It is possible to put a varying suffix or prefix to the "key" using an equation
    - In this way it is possible to use the save and load attribute to store several variables and recall them, without the need of creating several different attributes (in my case the variables are the total scores for each level. This spares me creating 48 different attributes).

    Maybe you all already know that, but I just wanted to share this technique in case some were interested.

    Ciao,
    Nem
  • games4hakangames4hakan Member Posts: 10
    Hi Nem.
    I'm working on a similar problem but has not been able to solve it - ref below...
    I will continue working with this during the day - and - my brother (who is a programmer (lucky him) pointed me into the direction that I would only need one 'day-scene' as opposed to my more than twenty scenes I have now.

    /Håkan

    For me I have a day - let's call it 'Day 1'.
    For this day I want to be able to store a number of choices you made i.e
    a) How I felt in the morning (Good/Indifferent/Bad)
    b) How I felt in the afternoon (Determined/Indifferent/etc)
    c) What I actually did (Followed my plan/Took a rest/Abandoned my plan)
    d) The player then clicks 'Save' all this shall be stored and then...

    ...these choices shall be stored depending on the buttons you click and then a 'Day Icon' shall be updated on another scene.

    Also - those buttons on the 'Day 1' shall only be possible to select once and the 'Save' action is only allowed to do once so that you don't tamper and update the 'GameDayIndex'

    lol...been playing around with this for hours without full success. I somehow get confused by GameAttributes, SceneAttributes and SelfAttributes...


Sign In or Register to comment.