Page 1 of 1

Save and load in batch RPG

Posted: 05 Jan 2018 13:42
by ragster66
Hi, I'm a newbie. I need to add a save and load section to my batch RPG. At certain
points in the game the player will get the option to save his progress before quitting.
Then at a later date Load the save back up and continue where he left off.

I have looked at a few "Lets make a batch RPG tutorials on you tube" but when I copy them into my game they don't work.

Any help greatly appreciated

Re: Save and load in batch RPG

Posted: 05 Jan 2018 13:57
by Squashman
Sure would like to know where you got that code from.

Regardless of that, what do you want the SAVE file to look like.

Re: Save and load in batch RPG

Posted: 05 Jan 2018 16:41
by ragster66
The way it is shown in the post is not as i set it, I found it on You tube and the person doing the tutorial showed that it worked for him. It should be like this:

Code: Select all

@echo off
set HP=45
set DEX=20
set money=50
:home
echo Your HP is %HP% - Your Dexterity is %DEX% and you have %money% gold coins
pause
(
echo %HP%
echo %DEX%
echo %money%
)>save.sav
Then to show it worked he done this, first change the opening variables by any number then add the load program:

Code: Select all

@echo off
set HP=30
set DEX=10
set money=500
:home
echo Your HP is %HP% - Your Dexterity is %DEX% and you have %money% gold coins
(
set /p HP=
set /p DEX=
set /p money=
)<save.sav
goto home
he ran the first prog, then to demonstrate the save bit then altered the variable, added the load part and ran it, on screen it looked like


Your HP is 30- your Dexterity is 10 and you have 500 gold coins
press any key to continue
Then after the changes it reads
Your HP is 45- your dexterity is 20 and you have 50 gold coins
pause

It worked for him but not me. All I want is that the player at certain times gets the option to save his progress, exit and return another day Load and continue where he left off
cheers Raggy

Re: Save and load in batch RPG

Posted: 06 Jan 2018 05:53
by aGerman
2nd code

Code: Select all

@echo off &setlocal

(
  set /p HP=
  set /p DEX=
  set /p money=
)<save.sav

echo Your HP is %HP% - Your Dexterity is %DEX% and you have %money% gold coins
pause
Steffen

Re: Save and load in batch RPG

Posted: 23 Jan 2018 00:53
by Osmium Programming
Here's how I would load in your circumstance:

< filename.ext (
set /p var1 <--- Puts line 1 into a variable
set /p var2 <--- Puts line 2 into a variable, etc.
etc..
)

Re: Save and load in batch RPG

Posted: 24 Jan 2018 16:41
by ShadowThief
Osmium Programming wrote:
23 Jan 2018 00:53
Here's how I would load in your circumstance:

< filename.ext (
set /p var1 <--- Puts line 1 into a variable
set /p var2 <--- Puts line 2 into a variable, etc.
etc..
)
You're going to want to put = signs after both of the variable names

Re: Save and load in batch RPG

Posted: 24 Jan 2018 16:45
by Osmium Programming
Wow, I completely blanked over that... I must have been way too tired to think

Re: Save and load in batch RPG

Posted: 24 Jan 2018 17:03
by Squashman
Your answer is no different then Steffen's answer.

Re: Save and load in batch RPG

Posted: 29 Jan 2018 18:55
by Osmium Programming
Oh I just realized that the > thingy was the other way around.... :P