我一直在进行批量RPG游戏,但我似乎无法让健康吧工作。这是我的整个代码:
@echo off
goto menu
:Varibales
set HealthBar1=/--------------------\
set HealthBar2=\--------------------/
set HP=100
set Weapon=Fists
set Mana=50
set Money=0
set Armor=10
set Strength=0
set Dexterity=0
set Intelegence=0
set Luck=0
set Perception=0
set hpmax=100
set hpStr=30
goto game
:menu
echo :-------------------------------:
echo :1) New Game--------------------:
echo : ------------------------------:
echo :2) Load Game-------------------:
echo : ------------------------------:
set /p game=
if '%game%' == '1' goto Varibales
if '%game%' == '2' goto callsave
pause>nul
:callsave
(
set /p hp=
set /p Weapon=
set /p Mana=
set /p Money=
set /p Armor=
set /p Strength=
set /p Dexterity=
set /p Intelegence=
set /p Luck=
set /p Perception=
set /p AC=
set /p Atk=
set /p Range=
set /p Speed=
set /p Area=
set /p HealthBar1=
set /p HealthBar2=
set /p hpmax=
set /p hpStr=
)<Savegame.txt
goto charstats
:Save
echo
(
echo %hp%
echo %Weapon%
echo %Mana%
echo %Money%
echo %Armor%
echo %Strength%
echo %Dexterity%
echo %Intelegence%
echo %Luck%
echo %Perception%
echo %ac%
echo %Atk%
echo %Range%
echo %Speed%
echo %Area%
echo %HealthBar1%
echo %HealthBar2%
echo %hpmax%
echo %hpStr%
)>Savegame.txt
goto Start1
:game
set Area=Toturial
cls
echo Enter Name
set /p name=
set pick=5
goto start
:start
set Area=Toturial
cls
set /a pick=%pick% -1
set lvl=1
set armor=0
set /a ac=(10 +((%lvl% /2) +%armor%))
set setscore=%pick% +10
echo What will your %pick%th highest stat be?
echo 1 Strength
echo 2 Dexterity
echo 3 Intelligence
echo 4 Wisdom
echo 5 Charisma
set /p chsc=choice1~5
if %chsc%==1 set /a Strength=(%setscore% +(%lvl% /2))
if %chsc%==2 set /a Dexterity=(%setscore% +(%lvl% /2))
if %chsc%==3 set /a Intelegence=(%setscore% +(%lvl% /2))
if %chsc%==4 set /a Wisdom=(%setscore% +(%lvl% /2))
if %chsc%==5 set /a Charisma=(%setscore% +(%lvl% /2))
if %pick%==0 goto charstats
if %pick%==0 cls
else
goto start
:charstats
cls
echo %name%
echo Strength %Strength%
echo Dexterity %Dexterity%
echo Intelligence %Intelegence%
echo Wisdom %Wisdom%
echo Charisma %Charisma%
echo AC %ac%
echo Weapon-%Weapon%
pause>nul
goto %Area%
:WeapStats
cls
echo Atk=%Atk%
echo Speed=%Speed%
echo Range=%Range%
pause>nul
goto %Area%
:Gamemenu
cls
echo :-------------------------------:
echo :1) Stats-----------------------:
echo : ------------------------------:
echo :2) Save Game-------------------:
echo : ------------------------------:
set /p shia=
if '%shia%' == '1' goto charstats
if '%shia%' == '2' goto Saveave
:Toturial
set Area=Toturial
cls
echo
(
set /p Atk=
set /p Range=
set /p Speed=
)<%Weapon%.txt
echo ----------------------------------------
echo Welcome to the Toturial
echo ----------------------------------------
echo 1)countiue
echo 2)Skip
set /p Lol=
if %Lol% == '1' goto Toturial1
if %Lol% == '2' goto Start1
:Toturial1
cls
set Area=Toturial1
echo Welcome to the toturial what would you like to learn about first?
echo 1)GUI
echo 2)
set /p Toturial=
if %Toturial% == '1' goto GUI_HELP
:GUI_HELP
cls
echo This Is Your GUI
echo ////////////////////////////////////////////////////////////////////////////
echo %HealthBar1%
echo %HealthBar2%
echo This is your health bar
echo /--------------------\
echo \--------------------/
echo echo This is Your Stamina bar
echo.
echo.
echo.
echo ////////////////////////////////////////////////////////////////////////////
pause
goto test
:HealthBar
if %hp% = 150 set HealthBar1=/------------------------------\
if %hp% = 150 set HealthBar2=\------------------------------/
if %hp% = 145 set HealthBar1=/----------------------------- \
if %hp% = 145 set HealthBar2=\----------------------------- /
if %hp% = 140 set HealthBar1=/---------------------------- \
if %hp% = 140 set HealthBar2=\---------------------------- /
if %hp% = 135 set HealthBar1=/--------------------------- \
if %hp% = 135 set HealthBar2=\--------------------------- /
if %hp% = 130 set HealthBar1=/-------------------------- \
if %hp% = 130 set HealthBar2=\-------------------------- /
if %hp% = 125 set HealthBar1=/------------------------- \
if %hp% = 125 set HealthBar2=\------------------------- /
if %hp% = 120 set HealthBar1=/------------------------ \
if %hp% = 120 set HealthBar2=\------------------------ /
if %hp% = 115 set HealthBar1=/----------------------- \
if %hp% = 115 set HealthBar2=\----------------------- /
if %hp% = 110 set HealthBar1=/---------------------- \
if %hp% = 110 set HealthBar2=\---------------------- /
if %hp% = 105 set HealthBar1=/--------------------- \
if %hp% = 105 set HealthBar2=\--------------------- /
if %hp% = 100 set HealthBar1=/--------------------\
if %hp% = 100 set HealthBar2=\--------------------/
if %hp% = 95 set HealthBar1=/------------------- \
if %hp% = 95 set HealthBar2=\------------------- /
if %hp% = 90 set HealthBar1=/------------------ \
if %hp% = 90 set HealthBar2=\------------------ /
if %hp% = 85 set HealthBar1=/----------------- \
if %hp% = 85 set HealthBar2=\----------------- /
if %hp% = 85 set HealthBar1=/----------------- \
if %hp% = 85 set HealthBar2=\----------------- /
if %hp% = 80 set HealthBar1=/---------------- \
if %hp% = 80 set HealthBar2=\---------------- /
if %hp% = 75 set HealthBar1=/--------------- \
if %hp% = 75 set HealthBar2=\--------------- /
if %hp% = 70 set HealthBar1=/-------------- \
if %hp% = 70 set HealthBar2=\-------------- /
if %hp% = 65 set HealthBar1=/------------- \
if %hp% = 65 set HealthBar2=\------------- /
if %hp% = 60 set HealthBar1=/------------ \
if %hp% = 60 set HealthBar2=\------------ /
if %hp% = 55 set HealthBar1=/----------- \
if %hp% = 55 set HealthBar2=\----------- /
if %hp% = 50 set HealthBar1=/--------- \
if %hp% = 50 set HealthBar2=\--------- /
if %hp% = 45 set HealthBar1=/-------- \
if %hp% = 45 set HealthBar2=\-------- /
if %hp% = 40 set HealthBar1=/------- \
if %hp% = 40 set HealthBar2=\------- /
if %hp% = 35 set HealthBar1=/------ \
if %hp% = 35 set HealthBar2=\------ /
if %hp% = 30 set HealthBar1=/----- \
if %hp% = 30 set HealthBar2=\----- /
if %hp% = 25 set HealthBar1=/---- \
if %hp% = 25 set HealthBar2=\---- /
if %hp% = 20 set HealthBar1=/--- \
if %hp% = 20 set HealthBar2=\--- /
if %hp% = 15 set HealthBar1=/-- \
if %hp% = 15 set HealthBar2=\-- /
if %hp% = 10 set HealthBar1=/- \
if %hp% = 10 set HealthBar2=\- /
if %hp% = 5 set HealthBar1=/ \
if %hp% = 5 set HealthBar2=\ /
if %hp% > %hpmax% set %hp% = %hpmax%
goto %area%
:HealthPotion
if %hp% = %hpmax% goto FullHealth
set hp=%hp%+%hpStr%
goto HealthBar
:FullHealth
echo You have full health
pause
goto %area%
:Start1
set Area=Start1
:test
set area=test
set hp=%hp%-25
cls
echo This Is Your GUI
echo ////////////////////////////////////////////////////////////////////////////
echo %HealthBar1%
echo %HealthBar2%
echo
echo /--------------------\
echo \--------------------/
echo
echo.
echo.
echo.
echo ////////////////////////////////////////////////////////////////////////////
pause
我欢迎您提出任何其他意见。
答案 0 :(得分:0)
批处理中,=
专门用于设置变量。要查看两个整数是否相等,请使用equ
。
if %hp% equ 150 set HealthBar1=/------------------------------\
if %hp% equ 150 set HealthBar2=\------------------------------/
要查看一个变量是否大于另一个变量,请使用gtr
。
if %hp% gtr %hpmax% set %hp% = %hpmax%
要查看一个变量是否小于另一个变量,请使用lss
。