im trying to make a batch video game for a school project, I was wonder
I'm trying to figure out if it is possible to rename two variables on the same line individually at separate times when called from a goto command from two different spinners. each health ("-------") Is an individual variable that is renamed.
I have a 2 health bars that appear as this.
╔══════╗ | ╔══════╗
health ║ ------- ║ | health ║ ------- ║
╚══════╝ | ╚══════╝
the middle will slowly decrease each time its set through a spinner.
for example...
"-------" will become "------", then "-----", then "----", "---", and so on...
the problem that i am having is that each health bat has its own spinner and i cant figure out how to decrease the health bar by one "-" at a time
when each health status ("-------") has its own variable and is set on the same line attached to that spinner.
another example...
I can make
╔══════╗ | ╔══════╗
health ║ ------- ║ | health ║ ------- ║
╚══════╝ | ╚══════╝
do this
╔══════╗ | ╔══════╗
health ║ ------- ║ | health ║ ---- ║
╚══════╝ | ╚══════╝
but when each spinner is set off and i want to do this.
1 2
╔══════╗ | ╔══════╗
health ║ --- ║ | health ║ --- ║
╚══════╝ | ╚══════╝
the health bar 1 cant save the health when i want the other to decrease by another "-".
I set the whole box on one line using this trick
set nl=^& echo.
echo line1%nl%line2%nl%line3%nl% so on~
the code below line vvvvvvvvvvvvvvvvv
(THE LONG LINE OF CODE WAS TO MUCH TO FIT ON THE BOX BUT THOSE ARE THE HEALTH BARS, IT BUMBED IT SELF ON A NEW LINE BECAUSE IT
NEEDS MORE ROOM TO FIT IN THIS BOX, PASTE IT INTO NOTEPAD AND HIT BACKSPACE TO PUT IT BACK ON THE SAME LINE)... the line looks something like this (" echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»%nl%º ")
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@echo on
:start
title Julius Caesar project [JacobgGilbert]
color 17
set nl=^& echo.
set resultA=-------
set resultH=-------
if exist C:\JS\ goto packageskip
start extractmedia.exe
echo Prepairing files
timeout /t 35
:packageskip
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
echo º Julius Caesar by Jacob Gilbertº
echo ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
echo/
echo Picking player at random to go on the first turn.
SET /A ht=%random% %% 6
pause
if %ht%==1 goto player1
if %ht%==2 goto player1
if %ht%==3 goto player1
if %ht%==4 goto player2
if %ht%==5 goto player2
if %ht%==6 goto player2
pause
:player1
cls
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»%nl%º º%nl%º Player (Caesar) ^| Player (Brutus) º%nl%º ^| º%nl%º ÉÍÍÍÍÍÍÍ» ^| ÉÍÍÍÍÍÍÍ» º%nl%º Health º%resultA%º ^| Health º%resultH%º º%nl%º ÈÍÍÍÍÍÍͼ ^| ÈÍÍÍÍÍÍͼ º%nl%º º%nl%ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ%nl%
echo (Caesar) plays first...
echo.
:commandsp1
echo Commands:%nl%1 - attack %nl%2 - block%nl%3 - sharpen sword
set /p command1= "~Command:"
pause
if %command1%==1 goto attackp1
if %command1%==2 goto blockp2
if %command1%==3 goto sharpen_swordp3
:attackp1
SET /A missrange=%random% %% 10
if %missrange%==1 goto miss1
if %missrange%==2 goto worked1
if %missrange%==3 goto miss1
if %missrange%==4 goto worked1
if %missrange%==5 goto miss1
if %missrange%==6 goto worked1
if %missrange%==7 goto miss1
if %missrange%==8 goto worked1
if %missrange%==9 goto miss1
if %missrange%==10 goto worked1
:miss1
echo Sorry your attack missed.
pause
cls
goto jumpp2
:worked1
echo Recieved Damage!
pause
cls
::================================================================
:spinner1
SETLOCAL ENABLEDELAYEDEXPANSION
SET COUNTP1=1
:BEGINCOUNTP1
CLS
SET /A COUNTP1+=1
IF !COUNTP1! EQU 1 goto count1p1
IF !COUNTP1! EQU 2 goto count2p1
IF !COUNTP1! EQU 3 goto count3p1
IF !COUNTP1! EQU 4 goto count4p1
IF !COUNTP1! EQU 5 goto count5p1
IF !COUNTP1! EQU 6 goto count6p1
IF !COUNTP1! EQU 7 goto count7p1
IF !COUNTP1! EQU 7 (
SET COUNTP1=1
) ELSE (
)
GOTO BEGINCOUNTP1
:count1p1
set resultA=-------
set resultI=------
set modified=%resultI:resultH=------
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»%nl%º º%nl%º Player (Caesar) ^| Player (Brutus) º%nl%º ^| º%nl%º ÉÍÍÍÍÍÍÍ» ^| ÉÍÍÍÍÍÍÍ» º%nl%º Health º%resultA%º ^| Health º%resultH%º º%nl%º ÈÍÍÍÍÍÍͼ ^| ÈÍÍÍÍÍÍͼ º%nl%º º%nl%ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ%nl%
goto commandsp1
:count2p1
set result1=------
set modified=%result1:resultH=------
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»%nl%º º%nl%º Player (Caesar) ^| Player (Brutus) º%nl%º ^| º%nl%º ÉÍÍÍÍÍÍÍ» ^| ÉÍÍÍÍÍÍÍ» º%nl%º Health º%resultB%º ^| Health º%resultI%º º%nl%º ÈÍÍÍÍÍÍͼ ^| ÈÍÍÍÍÍÍͼ º%nl%º º%nl%ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ%nl%
goto commandsp1
pause
:count3p1
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»%nl%º º%nl%º Player (Caesar) ^| Player (Brutus) º%nl%º ^| º%nl%º ÉÍÍÍÍÍÍÍ» ^| ÉÍÍÍÍÍÍÍ» º%nl%º Health º%resultC%º ^| Health º%resultJ%º º%nl%º ÈÍÍÍÍÍÍͼ ^| ÈÍÍÍÍÍÍͼ º%nl%º º%nl%ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ%nl%
goto commandsp1
pause
:count4p1
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»%nl%º º%nl%º Player (Caesar) ^| Player (Brutus) º%nl%º ^| º%nl%º ÉÍÍÍÍÍÍÍ» ^| ÉÍÍÍÍÍÍÍ» º%nl%º Health º%resultD%º ^| Health º%resultK%º º%nl%º ÈÍÍÍÍÍÍͼ ^| ÈÍÍÍÍÍÍͼ º%nl%º º%nl%ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ%nl%
goto commandsp1
pause
:count5p1
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»%nl%º º%nl%º Player (Caesar) ^| Player (Brutus) º%nl%º ^| º%nl%º ÉÍÍÍÍÍÍÍ» ^| ÉÍÍÍÍÍÍÍ» º%nl%º Health º%resultE%º ^| Health º%resultL%º º%nl%º ÈÍÍÍÍÍÍͼ ^| ÈÍÍÍÍÍÍͼ º%nl%º º%nl%ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ%nl%
goto commandsp1
pause
:count6p1
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»%nl%º º%nl%º Player (Caesar) ^| Player (Brutus) º%nl%º ^| º%nl%º ÉÍÍÍÍÍÍÍ» ^| ÉÍÍÍÍÍÍÍ» º%nl%º Health º%resultF%º ^| Health º%resultM%º º%nl%º ÈÍÍÍÍÍÍͼ ^| ÈÍÍÍÍÍÍͼ º%nl%º º%nl%ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ%nl%
goto commandsp1
pause
:count7p1
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»%nl%º º%nl%º Player (Caesar) ^| Player (Brutus) º%nl%º ^| º%nl%º ÉÍÍÍÍÍÍÍ» ^| ÉÍÍÍÍÍÍÍ» º%nl%º Health º WIN! º ^| Health º LOSE! º º%nl%º ÈÍÍÍÍÍÍͼ ^| ÈÍÍÍÍÍÍͼ º%nl%º º%nl%ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ%nl%
echo CAESAR IS THE WINNER!!!!
pause
goto start
::================================================================
:player2
cls
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»%nl%º º%nl%º Player (Caesar) ^| Player (Brutus) º%nl%º ^| º%nl%º ÉÍÍÍÍÍÍÍ» ^| ÉÍÍÍÍÍÍÍ» º%nl%º Health º-------º ^| Health º-------º º%nl%º ÈÍÍÍÍÍÍͼ ^| ÈÍÍÍÍÍÍͼ º%nl%º º%nl%ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ%nl%
echo (Brutus) plays first...
echo.
:commandsp2
echo Commands:%nl%1 - attack %nl%2 - block%nl%3 - sharpen sword
set /p command= "~Command:"
pause
if %command%==1 goto attackp4
if %command%==2 goto blockp5
if %command%==3 goto sharpen_swordp6
:attackp4
SET /A missrange=%random% %% 10
if %missrange%==1 goto miss2
if %missrange%==2 goto worked2
if %missrange%==3 goto miss2
if %missrange%==4 goto worked2
if %missrange%==5 goto miss2
if %missrange%==6 goto worked2
if %missrange%==7 goto miss2
if %missrange%==8 goto worked2
if %missrange%==9 goto miss2
if %missrange%==10 goto worked2
:miss2
echo Sorry your attack missed.
pause
cls
goto returnp2
:worked2
echo Recieved Damage!
pause
cls
::================================================================
:spinner1
SETLOCAL ENABLEDELAYEDEXPANSION
SET COUNTP2=1
:BEGINCOUNTP2
CLS
IF !COUNTP2! EQU 1 goto count1p2
IF !COUNTP2! EQU 2 goto count2p2
IF !COUNTP2! EQU 3 goto count3p2
IF !COUNTP2! EQU 4 goto count4p2
IF !COUNTP2! EQU 5 goto count5p2
IF !COUNTP2! EQU 6 goto count6p2
IF !COUNTP2! EQU 7 goto count7p2
IF !COUNTP2! EQU 7 (
SET COUN2=1
) ELSE (
SET /A COUNT2+=1
)
GOTO BEGINCOUNTP2
:count1p2
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»%nl%º º%nl%º Player (Caesar) ^| Player (Brutus) º%nl%º ^| º%nl%º ÉÍÍÍÍÍÍÍ» ^| ÉÍÍÍÍÍÍÍ» º%nl%º Health ºresultAº ^| Health ºresultDº º%nl%º ÈÍÍÍÍÍÍͼ ^| ÈÍÍÍÍÍÍͼ º%nl%º º%nl%ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ%nl%
pause
:count2p2
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»%nl%º º%nl%º Player (Caesar) ^| Player (Brutus) º%nl%º ^| º%nl%º ÉÍÍÍÍÍÍÍ» ^| ÉÍÍÍÍÍÍÍ» º%nl%º Health º-------º ^| Health º----- º º%nl%º ÈÍÍÍÍÍÍͼ ^| ÈÍÍÍÍÍÍͼ º%nl%º º%nl%ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ%nl%
echo 2
pause
:count3p2
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»%nl%º º%nl%º Player (Caesar) ^| Player (Brutus) º%nl%º ^| º%nl%º ÉÍÍÍÍÍÍÍ» ^| ÉÍÍÍÍÍÍÍ» º%nl%º Health º-------º ^| Health º---- º º%nl%º ÈÍÍÍÍÍÍͼ ^| ÈÍÍÍÍÍÍͼ º%nl%º º%nl%ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ%nl%
pause
:count4p2
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»%nl%º º%nl%º Player (Caesar) ^| Player (Brutus) º%nl%º ^| º%nl%º ÉÍÍÍÍÍÍÍ» ^| ÉÍÍÍÍÍÍÍ» º%nl%º Health º-------º ^| Health º--- º º%nl%º ÈÍÍÍÍÍÍͼ ^| ÈÍÍÍÍÍÍͼ º%nl%º º%nl%ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ%nl%
pause
:count5p2
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»%nl%º º%nl%º Player (Caesar) ^| Player (Brutus) º%nl%º ^| º%nl%º ÉÍÍÍÍÍÍÍ» ^| ÉÍÍÍÍÍÍÍ» º%nl%º Health º-------º ^| Health º-- º º%nl%º ÈÍÍÍÍÍÍͼ ^| ÈÍÍÍÍÍÍͼ º%nl%º º%nl%ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ%nl%
pause
:count6p2
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»%nl%º º%nl%º Player (Caesar) ^| Player (Brutus) º%nl%º ^| º%nl%º ÉÍÍÍÍÍÍÍ» ^| ÉÍÍÍÍÍÍÍ» º%nl%º Health º-------º ^| Health º- º º%nl%º ÈÍÍÍÍÍÍͼ ^| ÈÍÍÍÍÍÍͼ º%nl%º º%nl%ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ%nl%
pause
:count7p2
echo ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»%nl%º º%nl%º Player (Caesar) ^| Player (Brutus) º%nl%º ^| º%nl%º ÉÍÍÍÍÍÍÍ» ^| ÉÍÍÍÍÍÍÍ» º%nl%º Health º WIN! º ^| Health º LOSE! º º%nl%º ÈÍÍÍÍÍÍͼ ^| ÈÍÍÍÍÍÍͼ º%nl%º º%nl%ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ%nl%
pause
::================================================================
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Thank you guys for the help