How do I save system time to a file, NW.js

0 favourites
  • 3 posts
From the Asset Store
Convert multiple Excel files into JSON files and import them into construct3.
  • Okay so I have a save function on my game, it saves the game and then writes the SaveStateJSON to file; you can then load the save from the Main Menu or In-Game. I want to get it so that when you hover over the Load Last Save button from within the Main Menu a piece of text will become visible, of which it displays the system Time and Date of the save.

    I can get the hover function working myself, I'm just at a stand still with how to save the system Time and Date to a file that the game could read from the Main Menu without loading the full save file.

    Any help would be greatly appreciated, thanks!

  • On NW.js, you could write/read this information to another file yourself, using the NodeWebkit's functionalities:

    [quote:26w722xb]

    Action:

    Write file

    Write a text file to the user's local system. If the file does not exist, it is created. If the file already exists, its content is overwritten.

    Expression:

    ReadFile(path)

    Open the given file and return its text content as a string. Note that each time this expression is used the file is opened and read from disk. Therefore if the expression is used twice, the file is opened and read twice, which can impact performance. If necessary first read the file to a variable, then reference the variable multiple times.

    Alternatively, I believe you could also write/read such data using LocalStorage: https://www.scirra.com/manual/188/local-storage

    For the system time, you may need to use this: plugin-system-date-and-time_t63492

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks, this is by far the most helpful answer I've been given.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)