Save/Load a global variable in a file

This forum is currently in read-only mode.
From the Asset Store
Globals 2.0
$3.99 USD
Globals 2.0 stores and group variables. You can also load and save data (variables) from/to JSON files.
  • Hello,

    I'm Spanish, I'm using the google translator. My English is bad.

    I have a question:

    How I can save a global variable in a file and then load it?

  • You can use INI files to do this quickly:

    INI level loading

  • Yep, .ini is the best way to go. But I wonder what ever happened to the development of the save/load action? Or Quicksave/Quickload?

  • The save/load actions work, they should save the entire state of the game. The shortcoming of it is not all the plugins save/load all of their state.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sorry to necro this thread, but I'm looking for a similar solution.

    The save/load to disk command does not save the state of global variables, and one of the global variables I'm using saves the player's high score (so that he can always compare his latest score to his highest).

    Now I could simply save the high score data to an ini file and have the game read from that, but then the player can always just open that ini file and type "9999999999999999999999999999999999" into the high score section.

    Is there another way around this, or is it just one of Construct Classic's (few and far between) flaws that I'll have to live with?

  • -Silver- Try using binary storage plugin (works pretty similar to INI) for things you don't want the player to edit, and also save your file with a custom extension (eg: .gsv) so it doesn't stand out as INI or txt

  • Do you mean the Binary object that comes with the engine? Found under "Data and Files"? Because a quick search around the forums suggests it's broken - you can write to it once, but that's it. Further writing just adds to the existing text, instead of replacing it, and deleting/clearing existing text doesn't work.

    So if the player gets a high score of 1234, I can write that, and then read it just fine. But if they then beat it with a high score of 5678 and I try writing that, the high score will now read as 12345678 instead of 5678.

  • Hey,

    I also have the same problem. I have a globale varibale called "globale_score". After every time the player die, the value of the "score" variable will be writen into the "globale_score" variable. But allways the game will be closed, the "globale_score" lose his value. How can i save this value in the easiest way?

    Thanks a lot!

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