Load and Save data in Squiffy

LA-Laker
17 Jul 2021, 17:37

I have a question. Can anyone provide a code to save and load data? For example:

I have the variable set to:
@set goal = 5
Save to the computer

goal = 0
Load from the computer
@goal = 5
Variable loaded


mrangel
17 Jul 2021, 22:31

What do you mean by "save to the computer"?

Do you mean so the player can save their progress in a game? Attributes are saved to LocalStorage as soon as they are set, and loaded from LocalStorage every time you use them.


LA-Laker
19 Jul 2021, 07:15

Just in case if a user accidentally restarts the program.


Mclark
01 Aug 2021, 00:10

I think the question as I read it is, can you save the data to a common store.... So you have game 1 and game 2. presumably it would be cool to have a storage place, Lets say.. a "File" we will call "Game Progress." that you could store thngs in, that both game 1 and then laer game 2,3,4,5 can all access the vars so as you write the "modules" your have the same character in the series. Something like that.

Now if you can declare a "global" so like @set g_charstr (using the naming convention) or @setGlobal "