I'm making a Text Adventure game using batch-script, and I would like to know if there is a way to program it to automatically save at a certain point.
I'm asking this as I recently read that a youtuber once coded one of his RPGs to autosave, though he never revealed it publicly.
So is there a way to make a batch RPG/text adventure publish autosaves? If so, how do you do it?
This is actually quite simple, although it consumes a large amount of space, depending on how many variables you wish to save. You want to have another batch file in the same directory as the batch file you are running. This batch file can be titled save.bat, variables.bat, or whatever. For every action completed, you want it to save the variables to that batch file. For instance:
You notice how it saves the variables to save.bat, which is then called at the beginning of the game. The >> indicate that it's adding a new line to the file. If you just use a single > it will delete everything from before, and add the variable to the file. Although you will have to save the variables after every action, it's worth it. If you would like to conserve space, you could do this:
And inside of autosave.bat:
So yeah, that's how you can autosave the game.