So I am making a text based game with Windows batch coding. Here is the code so far:
@echo off
title Game
color 02
echo Once upon a time a girl walked into a cave.
echo Upon entering she found a portal. Its surface was a deep purple, spirals all over its surface
pause
echo.
:enter/run
echo --------------------------------------------------------------------------------
echo [e] to enter the portal
echo [r] to run away
echo.
set /p enter/run=
cls
if %enter/run%==e (
echo Your character takes a breath, closes her eyes, and steps forward.
echo.
echo Your characters body feels as if its being ripped apart.
echo.
echo Your character has lost consciousness.
pause
cls
goto jail
)
if %enter/run%==r (
echo Your character turns around and begins to run.
echo.
echo Your character feels a demon snatching at her feet.
echo.
echo Your character trips.
echo.
echo Your character has been dragged into the portal.
pause
cls
goto jail
)
if not %enter/run%==r (
echo ERROR
echo INVALID ASNWER
echo.
echo PLEASE TRY AGAIN
pause
cls
goto enter/run
)
:jail
cls
echo Your character wakes up bleary-eyed in a cell.
echo.
echo Your character peers around, trying to see in the semi-darkness.
pause
cls
:attack/go
echo Your character hears a small voice saying,
echo "Take this, use it to escape"
echo.
echo A small dagger drops into your character's lap.
echo.
echo Your character looks around for whoever has given you this weapon
pause
cls
echo A guard flings the door open and shouts,
echo "COME WITH ME"
pause
echo --------------------------------------------------------------------------------
echo [a] to attack the guard
echo [g] to go with the guard
echo.
set /p attack/go=
cls
if %attack/go%==a (
cls
color 0C
set /a enemyHP = 25
echo YOUR CHARACTER HAS ENTERED BATTLE!!!
echo.
echo YOUR WEAPON IS A DAGGER.
echo.
echo YOUR CHARACTER HAS 100HP
echo.
echo YOUR ENEMY HAS %enemyHP%HP
pause
)
if %attack/go%==g (
)
if not %attack/go%==a (
echo ERROR
echo INVALID ASNWER
echo.
echo PLEASE TRY AGAIN
pause
cls
goto attack/go
)
As you may have noticed I have highlighted some parts. These are the parts I need help with.
It's meant to say that the enemy has (however large the variable is)HP
Instead it says the enemy has HP
So, can anyone tell me how this works.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For anyone looking to run the game this what you do:
Please point out any bugs in the game.
I will update this thread from time to time with updates on the game.
@echo off
title Game
color 02
echo Once upon a time a girl walked into a cave.
echo Upon entering she found a portal. Its surface was a deep purple, spirals all over its surface
pause
echo.
:enter/run
echo --------------------------------------------------------------------------------
echo [e] to enter the portal
echo [r] to run away
echo.
set /p enter/run=
cls
if %enter/run%==e (
echo Your character takes a breath, closes her eyes, and steps forward.
echo.
echo Your characters body feels as if its being ripped apart.
echo.
echo Your character has lost consciousness.
pause
cls
goto jail
)
if %enter/run%==r (
echo Your character turns around and begins to run.
echo.
echo Your character feels a demon snatching at her feet.
echo.
echo Your character trips.
echo.
echo Your character has been dragged into the portal.
pause
cls
goto jail
)
if not %enter/run%==r (
echo ERROR
echo INVALID ASNWER
echo.
echo PLEASE TRY AGAIN
pause
cls
goto enter/run
)
:jail
cls
echo Your character wakes up bleary-eyed in a cell.
echo.
echo Your character peers around, trying to see in the semi-darkness.
pause
cls
:attack/go
echo Your character hears a small voice saying,
echo "Take this, use it to escape"
echo.
echo A small dagger drops into your character's lap.
echo.
echo Your character looks around for whoever has given you this weapon
pause
cls
echo A guard flings the door open and shouts,
echo "COME WITH ME"
pause
echo --------------------------------------------------------------------------------
echo [a] to attack the guard
echo [g] to go with the guard
echo.
set /p attack/go=
cls
if %attack/go%==a (
cls
color 0C
set /a enemyHP = 25
echo YOUR CHARACTER HAS ENTERED BATTLE!!!
echo.
echo YOUR WEAPON IS A DAGGER.
echo.
echo YOUR CHARACTER HAS 100HP
echo.
echo YOUR ENEMY HAS %enemyHP%HP
pause
)
if %attack/go%==g (
)
if not %attack/go%==a (
echo ERROR
echo INVALID ASNWER
echo.
echo PLEASE TRY AGAIN
pause
cls
goto attack/go
)
As you may have noticed I have highlighted some parts. These are the parts I need help with.
It's meant to say that the enemy has (however large the variable is)HP
Instead it says the enemy has HP
So, can anyone tell me how this works.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For anyone looking to run the game this what you do:
- Copy and paste the code into notepad
- Save the file on your desktop.
- While saving it save it as Game.bat and have the file type set to 'all types'
- Finish saving it and double-click the file
Please point out any bugs in the game.
I will update this thread from time to time with updates on the game.