I'm making a Choose Your Own Adventure game in batch, and I want to have stats in it to keep track of how your doing in the game. I want to display the stats, but I have to do it each time I have a cls
command, and because I will have that command often, I made a block called :Stats
so I can call it every time I need it. It works fine, but the narrative after the Stats displaying don't seem to be working anymore. I want to keep the :colorEcho
block, so the player can differentiate between dialogue, narrative and commands to input a choice. Any ideas on how to fix this?
:Start
::Game goes here.
cls
Echo Please enter your player name.
set /p PlayerName="Player name: "
cls
call :Stats
call :colorEcho 7 "You lay on the cold, hard ground, sleeping away. It's been 1 month since the Virus spread..."
Echo.
call :colorEcho 7 "The sun rises over the horizon, warming up your dirt-caked body."
Echo .
pause
exit
:Stats
call :colorEcho A "Current Health = "
call :colorEcho C " %Health%"
Echo.
call :colorEcho A "Hunger = "
call :colorEcho C " %Food%"
Echo.
call :colorEcho A "Thirst = "
call :colorEcho C " %Water%"
Echo.
call :colorEcho A "Infection = "
call :colorEcho C " %Infection%"
Echo.
call :colorEcho A "Stamina = "
call :colorEcho C " %Stamina%"
Echo.
Echo.
pause
:colorEcho
echo off
<nul set /p ".=%DEL%" > "%~2"
findstr /v /a:%1 /R "^$" "%~2" nul
del "%~2" > nul 2>&1i
Side note: I've defined all the variables. That I made sure of.
Whats supposed to happen:
What actually happens: