Display datetime of a autosave file in the game save load menu

  • #30, by andy-rinaldiFriday, 20. February 2015, 19:11 9 years ago
    Hi guys, thanks a lot for the posts but maybe is better if someone tell me as if I were a child. It's really difficult for me understand.

    Forum Fan

    160 Posts


  • #31, by afrlmeFriday, 20. February 2015, 19:14 9 years ago
    Yeah... I'm not learning c++ though. I found a list of date string returns when I searched on google but it turns out they were for c++, although most of them should be valid for Lua too; based on the link you posted.

    Imperator

    7278 Posts

  • #32, by ke4Friday, 20. February 2015, 19:24 9 years ago
    Well, you need 2 action parts.

    Fisrt for writing that date into the file. Execute the autosave #1 and execute this Write script

    local file = io.open( localAppDir .. "Savegames/autosave1.txt", "w+")
    file:write(os.date("%X, %d/%m/%y"))
    file:close()
    


    Then the second should be in your menu scene as an "at beginning of scene"
    And there you need to first execute the read Script and then let display your object text through the autosave1 value

    local file = io.open( localAppDir .. "Savegames/autosave1.txt", "r")
    Values["autosave1"].String = file:read()
    file:close()
    


    <vs=autosave1>
    

    Key Killer

    810 Posts

  • #33, by afrlmeFriday, 20. February 2015, 19:42 9 years ago
    Hmm slight problem with using display object text... seems it's only valid for playable scenes, no? I managed to get it to display narration text but it didn't position it correctly.

    Imperator

    7278 Posts

  • #34, by ke4Friday, 20. February 2015, 19:47 9 years ago
    I actually didn't try it in menu scene, hmmm that's problem, how to display the narration text for unlimitled time?

    Key Killer

    810 Posts

  • #35, by afrlmeFriday, 20. February 2015, 20:33 9 years ago
    Possible, but it won't position. It just ended up at bottom-center of screen regardless of what position I set. To make it display infinitely I set it as background text & added to the end of the text, which means it needs a left click to progress, but because it was set as background text it ignores the left click cancellation.

    Hmm I reckon that you could use animations to display the text simple enough. Create an object per character & then inside of that you need to create multiple animations - 1 per character/number. You then use a for loop to iterate over each character to decide which animation should play, or you could force animation frames I suppose. Either method is a bit of a pain in the ass though.

    In theory, I suppose if a person was not planning on using the regular save system, then they could create the save menu as a menu scene or even as an interface.

    Imperator

    7278 Posts

  • #36, by ke4Friday, 20. February 2015, 21:00 9 years ago
    There are a lot of possibilities how to achievs this i guess, but still a bit too complicated for just a showing a simple date. I wonder if there is some reason why the object text doesn't work in menus, or the narrative text inst possition correctly. Maybe that interface is a good idea.

    Key Killer

    810 Posts

  • #37, by andy-rinaldiFriday, 20. February 2015, 21:53 9 years ago
    I use a display narration text, however with your script, it's not working.

    Definition script:

    function WriteAutosave()
        local file = io.open( localAppDir .. "Savegames/bookmark80.dat", "w+")
        file:write(os.date("%X, %d/%m/%y"))
        file:close()
    end
    
    function ReadAutosave()
        local file = io.open( localAppDir .. "Savegames/bookmark80.dat", "r")
        Values["timeAutosave"].String =  file:read()
        file:close()
    end
    
    


    In my menu scene, I have the display text object:

    
    


    At the begin -> exec script ReadAutosave()
    call display text

    At the end -> quit display text

    and finally when I exec the autosave:
    exec autosave80
    exec script WriteAutosave()

    In the menu scene I see nothing... roll

    Yesterday I could see the display text object in the menu scene. (it works fine in a scene, interface or menu scene)

    Forum Fan

    160 Posts

  • #38, by ke4Friday, 20. February 2015, 22:14 9 years ago
    Hmm, you are right, the object text actually works in menu scenes. I'm confused now grin

    Check if you already have Savegames folder created in your Appdata/local/gamename

    Why are you calling the script through functions? I guess it would be easier just execute the script rightaway instead of calling it.

    Also you don't have to quit the display object text on leaving no?

    Can you make some screenshots please?

    Key Killer

    810 Posts

  • #39, by andy-rinaldiFriday, 20. February 2015, 22:27 9 years ago
    I have already the Savegames folder.
    I quit the display text object when leave the scene and then call the object again at the begin of the scene.
    Screenshots in attachment.
    Thanks.

    Forum Fan

    160 Posts

  • #40, by afrlmeFriday, 20. February 2015, 22:58 9 years ago
    Oh by the way... what I said earlier about narration text, not positioning correctly. I forgot that I was running a text handler which repositions all text to the bottom of the screen.

    Quick note: the save game folder needs to exist for it to be able to write the file to it, as the file must also exist to read from it. You could add an additional query to check if the file exists or not before trying to read it.

    By the way, why are you writing to a bookmark.dat file? The bookmarkxx.dat filenames should not be written to as that is what the quicksave/autosave system creates the files as. Use .txt or .x or .cfg or leave the file extension blank even. Call it something like timestampX.txt where x should be the index value of the quicksave file.

    I see you have employed the looping method for background narration text that I used for the key input demo template I provided a while back. @ ke4: it's a good method as it constantly updates the text on each loop. You can also cancel out the action in an at end of scene action part.

    Imperator

    7278 Posts