I would like to know how I could create "savepoints" in my text adventure game.
In my case there is a written story that goes from line to line until it reaches the end. So it's hard scripted.
My question would be, if the player types the command save for example instead of yes or no, when the game gives you that option, how could I create a save-point where the player can load this exact moment where he stopped and then it gets loaded and jumps instantly to this line of code.
For example:
#gamestart
print("Hi welcome to the game...")
...
...
input1 = input("You want to go?(Y/N)")
while input1 != "Y":
# do something
# and here, what if I want to save? In my case I want to return to this exact question or line
print("blalab")
As far as I am aware, there is no built-in way to save (or "go-to") a specific line of code during execution. This means you will have to play around a bit with the actual structure of your program.
The way I see it, you need to:
An outline of the idea is:
And when you start a game: