2

I'm making a text-based batch Role Playing Game (RPG). (Just recently starting learning...) My RPG doesn't have health and stuff like that, its more of a story type of RPG.

Basically you choose which options you want to do and you proceed with the story and each option can change the ending.

So, I was wondering if there was a way to save your (for lack of a better word) 'page' in the RPG. (example: I've been labeling each 'page' as :01, :02, and so on...)

So, if someone exited the game they could have the option to start a new game or continue.

genpfault
  • 51,148
  • 11
  • 85
  • 139
icecat8
  • 21
  • 1
  • 3
  • May I strongly suggest that an RPG is not the best project for a "first time" making a game project. Even something as limited as a choose your own adventure game will be hard for you to finish. Something much more limited in scope that you will definitely finish would teach you a lot more about the game making process... – Michael Dorgan Jun 13 '13 at 18:08
  • Please read the tag-wiki for a tags you have not used on this site before. You would have seen that the RPG tag refers to a programming language (used primarily on large IBM systems) and is entirely unrelated to gaming. – WarrenT Jun 14 '13 at 00:07

2 Answers2

2

Even if you are a begginer at Batch files, I encourage you to read the description about arrays in Batch files at this post: Arrays, linked lists and other data structures in cmd.exe (batch) script

This way, you may define the different pages via different array elements of the same variables and "walk through the pages" by incrementing a general index variable. You may store in a file the whole contents of the last page (all the array elements associated with that page). If the array elements don't change in the game (just the general index), you may store just the index in the way suggested by foxidrive.

Community
  • 1
  • 1
Aacini
  • 65,180
  • 12
  • 72
  • 108
1

You can save 02 to a text file called save.dat and then read the file and use that to jump to the page.

set page=02
>save.dat echo %page%

and to load it in:

set /p "page="<save.dat
echo %page%
goto :%page%

You may need to save the name and more information too - it depends on how you have structured your game.

foxidrive
  • 40,353
  • 10
  • 53
  • 68