Rpg batch level system error? -
Rpg batch level system error? -
so seem find hard set 'if' statement within 'if' statement. have labels gotos set correctly error occurs when code goes levelstats
the code meant, 1 time player has met max exp, go next level. lvlguage checks see if exp requirements met. works fine. goes levelstats , prompt closes.
:lvlguage if %charexp% geq %charmaxexp% ( goto levelstats ) goto menu :levelstats ::the error starts here if %charlevel%==1 ( goto level2 ) goto menu if %charlevel%==2 ( goto level3 ) goto menu :: goes on till level 10 :level2 if %charexp% geq 100 ( set /a charexp=%charexp% -100 set charmaxexp=280 set charlevel=2 set /a charattack=(%charattack% * 1.5) + 1 goto levelup ) goto menu :level3 if %charexp% geq 280 ( set /a charexp=%charexp% -280 set charmaxexp=784 set charlevel=3 set /a charattack=(%charattack% * 1.5) + 1 goto levelup ) goto menu :levelup cls echo have leveled up. timeout 2 >nul goto menu
your variables calculated 1 time when script starts. take ath this: http://www.ss64.com/nt/delayedexpansion.html
you need add together setlocal enabledelayedexpansion
@ origin @ script , adress vars !varname!
instead of %varname%
when want changed values. give lastly set value of variable instead of first assigned value.
batch-file level
Comments
Post a Comment