How do I save a dictionary so I can load it for next session? (solved)

  • I'm putting the final touches on my game and I have a highscore function. At first I built it with the LocalStorage object and it worked perfectly. Except, when I exported it as an nw.js project it stopped working.

    I read somewhere here that perhaps it'd be better to use the Dictonary. Coding the dictionary is slightly more straightforward than the LocalStorage on but the only save option I can find for the dictionary is downloading a .json file but this prompts the user to download the file. I need this to happen silently.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I don't think localstorage and dictionary are interchangeable, what you've done is swapped out variables for dictionary? You didn't mention how you did it originally but dictionary would be saved as json format in localstorage as well.

  • I just tried creating a blank project with just a text field and LocalStorage, then export it as nw.js - it works, so it's something in my code I'm overlooking. I'll post screenshots, hold on.

  • Out of frustration I rewrote the whole thing and now it works. I'm sure I'd overlooked something basic, trying to fix a fix etc.

    In case others come across this thread in the future I'm posting my solution here. It's tested and works after exporting the project as an nw.js project.

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