Save game data

  • #20, by afrlmeFriday, 16. January 2015, 19:43 9 years ago
    Not sure but save game data depends on what is in your game... so if you add, remove or edit the project file then the autosave/savegame may no longer work correctly. Other than that I can't really say.

    Imperator

    7278 Posts


  • #21, by minibigsFriday, 16. January 2015, 21:59 9 years ago
    Barney ... I just set up the scenario you described ...

    Do you do the autosave from the "at beginning of scene" action of scene2?

    I tried this & for some reason the autosave does not work on my system if performed from the above action of any scene. There is nothing recorded on the system log.

    If I execute autosave from any other action I tried (e.g. the "use" action of a scene object) it works fine.

    I wonder if you have the same issue? Maybe when you load from the last scene you are not loading the autosave you though as the save in scene 2 did not work?

    If I set your scenery up & autosave in scene 2 from an action other than the scene "at beginning of scene" action it all works fine & I cannot reproduce your error.

    Newbie

    79 Posts

  • #22, by minibigsFriday, 16. January 2015, 22:01 9 years ago
    "If I set your scenery" should of course read scenario smile

    Newbie

    79 Posts

  • #23, by afrlmeFriday, 16. January 2015, 22:28 9 years ago
    You may need to add a short pause before executing it, if you plan on using it as soon as scene starts. Say a 10ms pause or the same amount of time specified for the scene fade transition. Sometimes actions triggered as soon as the scene is opened may not get executed.

    Imperator

    7278 Posts

  • #24, by minibigsFriday, 16. January 2015, 22:40 9 years ago
    Spot on, that worked & will be something worth remembering in general .. you are rapidly becoming my hero here!

    One thing I am struggling with is in the data structure WIKI page it gives table names such as "character" which I cannot get to work, having to use "char" instead. e.g. char:getLinks(VCharacterItems).

    Is the Wiki out of date? Is there an up to date list? Am I barking up the wrong tree?
    Is there a way to pull all table names out of the structure so I don't have to keep bothering your good self?

    Newbie

    79 Posts

  • #25, by BarneyFriday, 16. January 2015, 22:57 9 years ago
    Yeah, I use "at the beginning".
    I've made a little breakthrough, though. I figured maybe the engine didn't have enough time to save the game, so I put a 500 ms pause before the save command. Didn't do anything. Then I changed it to 1000 ms, and lo and behold, the save finally works!

    Newbie

    42 Posts

  • #26, by BarneyFriday, 16. January 2015, 23:00 9 years ago
    Heh, I left this window for half an hour, and in the meantime you've come up with the same solution. =)
    But, as I said, in my case the pause had to be unusually huge - even 500 ms didn't cut it.

    Newbie

    42 Posts

  • #27, by afrlmeFriday, 16. January 2015, 23:09 9 years ago
    Could you give me an example of what you are trying to do please?

    The data structure in the wiki is correct, although it doesn't contain all of the available fields. I have filled in ones I know about as best I could, but there are still quite a few missing from it.

    Certain table names may be reserved such as Characters because it is used for accessing the characters table with the new shorthand Lua script code, like so...
    for i  = 1, total.maxn( Characters["Tom"].Items) do
     print( i, Characters["Tom"].Items[i]:getName() )
    end
    

    ...code is unverified, I wrote it off the top of my head. If it is correct it should print out all the items currently in the characters possession into the log file.

    With tables containing multiple data you need to iterate via table index values. The example I provided above (if correct) loops from 1 to the total value of data inside of the table & the i is incremented by 1 on each loop.

    -- longhand code this time....
    local itm = getObject("Characters[Tom]"):getLinks(VCharacterItems) -- store items in a variable
    
    for i = 1, #itm -- for 1 to total of items found in itm do
     print( itm[i]:getName() ) -- print the name of the items
    end
    
    --itm[1] for instance would access the first table index value.
    


    It's a bit hard to explain all of this in a few words, but I'm sure you'll get the hang of what needs to be done for each type of table before long.

    P.S: I am the person who provides English support for Visionaire Studio, in regards to the editor & scripting, although the devs & other members do occasionally save me from having to answer threads at times. wink

    Imperator

    7278 Posts

  • #28, by afrlmeFriday, 16. January 2015, 23:13 9 years ago
    Heh, I left this window for half an hour, and in the meantime you've come up with the same solution. =)
    But, as I said, in my case the pause had to be unusually huge - even 500 ms didn't cut it.


    Could be due to the amount of data needing to be loaded or the time defined in game options for the scene fade transition. I couldn't really say, but usually a small value should suffice. Technically I could have added 1ms pause even though the system doesn't loop that fast. It's approx every 16ms or so if I remember correctly what Simon mentioned in another forum thread.

    Imperator

    7278 Posts

  • #29, by minibigsFriday, 16. January 2015, 23:30 9 years ago
    500ms did it for me... I haven't experimented, just took the default.

    Ignore the example I gave above with "char" & "character" .. me being daft ....

    But the table names in the WIKI are not correct ... an example is "Interfaces", which isn't in the WIKI, but I have just found the wonders of the Explorer tab in editor tools & all becomes clear!

    Newbie

    79 Posts

  • #30, by BarneyFriday, 16. January 2015, 23:32 9 years ago
    You know what, yeah, I guess fade transition is to blame. I left it at default value, and it's something like 600 ms, if my memory doesn't fail me. I should've figured it out sooner.

    Newbie

    42 Posts