Reputation: 6654
SEE THE FULL CODE HERE: http://pastebin.com/nu7u5XTC
I am using the 'choice' command to read the user's key so that the program knows what to do.
@ECHO OFF
setlocal EnableExtensions EnableDelayedExpansion
goto initialise
:initialise
cls
set /a x=6
set /a y=10
set /a oldx=%x%
set /a oldy=%y%
REM Place all of the grass blocks...
rem PaintScreen 2
:choicelistener
set /a oldx=%x%
set /a oldy=%y%
choice /c wasdWASDpqezxm /CS >NUL
if %ERRORLEVEL%==1 goto moveNorth
if %ERRORLEVEL%==2 (
REM Go west.
if %facing.x%.%facing.y%.occupied==true (
REM There is a block there.
goto choicelistener
) ELSE (
REM There was no block there.
set /a x=%x%-1
set prevmove=a
rem ChangeColor 2 0
goto checker
)
if %ERRORLEVEL% 3 (
REM Go south.
if %facing.x%.%facing.y%.occupied==true (
REM There is a block there.
goto choicelistener
) ELSE (
REM There was no block there.
set /a y=%y%+1
set prevmove=s
rem ChangeColor 2 0
goto checker
)
That is the part of code that breaks. I get the error "The syntax of the command is incorrect."
I have researched this for two hours, other people have has this problem, but none of their solutions have helped me. Any suggestions? Thanks.
Upvotes: 0
Views: 1046
Reputation: 3112
Don't forget to close the parentheses..
...
goto checker
)
)
On your two verifications.
Upvotes: 1