Save and load in batch RPG
Moderator: DosItHelp
Save and load in batch RPG
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
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
Last edited by ragster66 on 05 Jan 2018 18:26, edited 1 time in total.
Re: Save and load in batch RPG
Sure would like to know where you got that code from.
Regardless of that, what do you want the SAVE file to look like.
Regardless of that, what do you want the SAVE file to look like.
Re: Save and load in batch RPG
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:
Then to show it worked he done this, first change the opening variables by any number then add the load program:
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
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
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
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
Last edited by aGerman on 06 Jan 2018 05:50, edited 2 times in total.
Reason: code formatting
Reason: code formatting
Re: Save and load in batch RPG
2nd code
Steffen
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
-
- Posts: 14
- Joined: 16 Oct 2017 20:15
Re: Save and load in batch RPG
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..
)
< filename.ext (
set /p var1 <--- Puts line 1 into a variable
set /p var2 <--- Puts line 2 into a variable, etc.
etc..
)
-
- Expert
- Posts: 1166
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: Save and load in batch RPG
You're going to want to put = signs after both of the variable namesOsmium Programming wrote: ↑23 Jan 2018 00:53Here'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..
)
-
- Posts: 14
- Joined: 16 Oct 2017 20:15
Re: Save and load in batch RPG
Wow, I completely blanked over that... I must have been way too tired to think
Re: Save and load in batch RPG
Your answer is no different then Steffen's answer.
-
- Posts: 14
- Joined: 16 Oct 2017 20:15
Re: Save and load in batch RPG
Oh I just realized that the > thingy was the other way around....