I was making a batch game, but suddenly an error that I can't debug showed up: 'if was unexpected at this time'. Batch file is saved in ANSI coding. This is the code:
@echo off
title Zbieracz kasy
mode con cols=57 lines=34
color 2a
Mod CUR OFF
setlocal enabledelayedexpansion
set x=0
set y=0
set s=0
:load
set /a bx=%x%-24
set /a ex=%x%+24
set /a by=%y%-13
set /a ey=%y%+13
set x%x%y%y%=☺
set b=0
for /l %%y in (%by%,1,%ey%) do (
set /a b+=1
set l=
for /l %%x in (%bx%,1,%ex%) do (
if "!x%%xy%%y!"=="" (
set /a r=!random!*32/32768
if !r! geq 0 set x%%xy%%y=
if !r! geq 10 set x%%xy%%y=±
if !r! geq 20 set x%%xy%%y=Û
if !r! geq 22 set x%%xy%%y=$
if !r! geq 27 set x%%xy%%y=&
if !r! geq 30 set x%%xy%%y=#
if !r! geq 31 set x%%xy%%y=@
)
set l=!l!!x%%xy%%y!
)
if !b!==1 set l1= ÛÛ!l!ÛÛ
if !b!==2 set l2= ÛÛ!l!ÛÛ
if !b!==3 set l3= ÛÛ!l!ÛÛ
if !b!==4 set l4= ÛÛ!l!ÛÛ
if !b!==5 set l5= ÛÛ!l!ÛÛ
if !b!==6 set l6= ÛÛ!l!ÛÛ
if !b!==7 set l7= ÛÛ!l!ÛÛ
if !b!==8 set l8= ÛÛ!l!ÛÛ
if !b!==9 set l9= ÛÛ!l!ÛÛ
if !b!==10 set l10= ÛÛ!l!ÛÛ
if !b!==11 set l11= ÛÛ!l!ÛÛ
if !b!==12 set l12= ÛÛ!l!ÛÛ
if !b!==13 set l13= ÛÛ!l!ÛÛ
if !b!==14 set l14= ÛÛ!l!ÛÛ
if !b!==15 set l15= ÛÛ!l!ÛÛ
if !b!==16 set l16= ÛÛ!l!ÛÛ
if !b!==17 set l17= ÛÛ!l!ÛÛ
if !b!==18 set l18= ÛÛ!l!ÛÛ
if !b!==19 set l19= ÛÛ!l!ÛÛ
if !b!==20 set l20= ÛÛ!l!ÛÛ
if !b!==21 set l21= ÛÛ!l!ÛÛ
if !b!==22 set l22= ÛÛ!l!ÛÛ
if !b!==23 set l23= ÛÛ!l!ÛÛ
if !b!==24 set l24= ÛÛ!l!ÛÛ
if !b!==25 set l25= ÛÛ!l!ÛÛ
if !b!==26 set l26= ÛÛ!l!ÛÛ
if !b!==27 set l27= ÛÛ!l!ÛÛ
)
set x%x%y%y%=
cls
echo ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
if %s% leq 9 (echo ÛÛÛÛÛÛÛÛÛÛÛÛZbieracz kasyÛÛÛÛÛÛÛÛÛÛÛÛKasa: $%s%ÛÛÛÛÛÛÛÛÛÛÛÛ&goto next)
if %s% leq 99 (echo ÛÛÛÛÛÛÛÛÛÛÛÛZbieracz kasyÛÛÛÛÛÛÛÛÛÛÛÛKasa: $%s%ÛÛÛÛÛÛÛÛÛÛÛ&goto next)
if %s% leq 999 (echo ÛÛÛÛÛÛÛÛÛÛÛÛZbieracz kasyÛÛÛÛÛÛÛÛÛÛÛKasa: $%s%ÛÛÛÛÛÛÛÛÛÛÛ&goto next)
if %s% leq 9999 (echo ÛÛÛÛÛÛÛÛÛÛÛZbieracz kasyÛÛÛÛÛÛÛÛÛÛÛKasa: $%s%ÛÛÛÛÛÛÛÛÛÛÛ&goto next)
if %s% leq 99999 (echo ÛÛÛÛÛÛÛÛÛÛÛZbieracz kasyÛÛÛÛÛÛÛÛÛÛÛKasa: $%s%ÛÛÛÛÛÛÛÛÛÛ&goto next)
if %s% leq 999999 (echo ÛÛÛÛÛÛÛÛÛÛÛZbieracz kasyÛÛÛÛÛÛÛÛÛÛKasa: $%s%ÛÛÛÛÛÛÛÛÛÛ&goto next)
if %s% leq 9999999 (echo ÛÛÛÛÛÛÛÛÛÛZbieracz kasyÛÛÛÛÛÛÛÛÛÛKasa: $%s%ÛÛÛÛÛÛÛÛÛÛ&goto next)
if %s% leq 99999999 (echo ÛÛÛÛÛÛÛÛÛÛZbieracz kasyÛÛÛÛÛÛÛÛÛÛKasa: $%s%ÛÛÛÛÛÛÛÛÛ&goto next)
if %s% leq 999999999 (echo ÛÛÛÛÛÛÛÛÛÛZbieracz kasyÛÛÛÛÛÛÛÛÛKasa: $%s%ÛÛÛÛÛÛÛÛÛ&goto next)
if %s% leq 9999999999 (echo ÛÛÛÛÛÛÛÛÛZbieracz kasyÛÛÛÛÛÛÛÛÛKasa: $%s%ÛÛÛÛÛÛÛÛÛ&goto next)
:next
echo ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
echo.
echo ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
for /l %%a in (1,1,27) do echo !l%%a!
echo ÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛÛ
Mod KEY
if %errorlevel%==72 (set vx=%x%&set /a vy=%y%-1&goto key)
if %errorlevel%==80 (set vx=%x%&set /a vy=%y%+1&goto key)
if %errorlevel%==75 (set /a vx=%x%-1&set vy=%y%&goto key)
if %errorlevel%==77 (set /a vx=%x%+1&set vy=%y%&goto key)
if %errorlevel%==27 exit
goto load
:key
if "!x%vx%y%vy%!"=="$" (if not %s%==9999999999 set /a s+=1&set x%vx%y%vy%= )
if "!x%vx%y%vy%!"=="&" (if not %s% gtr 9999999989 set /a s+=10&set x%vx%y%vy%= )
if "!x%vx%y%vy%!"=="#" (if not %s% gtr 9999999899 set /a s+=100&set x%vx%y%vy%= )
if "!x%vx%y%vy%!"=="@" (if not %s% gtr 9999998999 set /a s+=1000&set x%vx%y%vy%= )
if "!x%vx%y%vy%!"=="±" (set x=%vx%&set y=%vy%)
if "!x%vx%y%vy%!"==" " (set x=%vx%&set y=%vy%)
goto load
To not confuse, "Mod" is external executable module with some functions. The error shows up probably between lines 19-62 or 65-75, but I don't know. I checked every if in the code, and everything seems fine.
Thanks for any help.
Aucun commentaire:
Enregistrer un commentaire