1.

Solve : Batch Saving?

Answer»

I have started creating a batch GAME but I do not know how to save, I am relatively new so can you show me the code then how it works? Thanks a lot!You can append an output to a file such as...

@echo. Hello World >>SaveFile.txt

This with the >> will append to the save file if you want a game that has MANY saved states in a single game save file.

If you want a single save state you could use...

@echo. Hello World >SaveFile.txt

And this would overwrite the contents of the PRIOR save game state whenever used to echo information out to file such as echoing to file the last game state values.

Reading in the values you would simply be parsing the text file and importing the values back into variables such as parsing and setting READ in values to variables..

Do you have any batch content to share with us, so we can best assist you with this request? Knowing the EXACT content that you want to save we can show examples of how to save and read in the info.

For a game that you need to save 5 values you could simply echo out the values at the last played state and have a text file that has this inside of it

Quote

2500,1000,50,100,3

Which equals

2500 hp
1000 armor
50 weapon damage min
100 weapon damage max
3 health bottles

Or just

Set>save.txt

And then load:
For %%A in (save.txt) set %%A
Quote from: shiverbob on November 05, 2014, 09:24:49 AM
Or just

Set>save.txt

And then load:
For %%A in (save.txt) set %%A
But then you would probably want to have a specific prefix for the variables used in the game. You wouldn't want to take the risk of accidentally changing a system variable that had already been changed after you played the game last and before you play it again.


Discussion

No Comment Found