Store a global variable

Welcome
I am currently making a program that is a book containing more than 50 pages. If the reader stops at a specific page, he needs to return to it later. Here is the problem, because I want to save a general value in a store, and all the training videos I have watched teach us to store the scene value. …So what should I do?

If it is a book then you are lucky cause you would perform save whenever each new page is displayed
This way you will have kinda autosave
And rest is making global variable and simply setting number of page to some variable
For example make global variable structure call it Save
Add child variable and call it Page then make it number and so you will have GlobalVariable(Save.Page)
And saving/loading itself i described here

please i wish you give me a sample code for saving it, I don’t understand how to create kinda autosave.

Do you have anything made for your game?
Like switching pages?

The link that @ZeroX4 gave (to the Save/Load problem) has sample code in it.

No, I haven’t, And don’t know what is switching pages.

Yes, But I didn’t understand it.

Ok, then does this post about saving to storage make more sense?

Ok, I will try it, Thank you.

So you have no working game and you already need save system?

Look you said you are making book
So if it is a book then it have pages
And HOWEVER you switch page in your game this would be event which i would use to make save

But when you have no working logic for it we can only explain how saving works

1 Like