loading
Now, there are many ways to get a character in batch to move, however, in this tutorial is probably the shortest codes anyone has made.

Enjoy!

Note: Copy and paste the following code into notepad or another text-editing program and save it as movement.bat


Step 1: Code 1 (simple Movement)

@setlocal enableextensions enabledelayedexpansion
@echo off
title movement
color 0a

set length=         
set height= a

:controls
cls
echo Use WASD to move your character ([]).
echo.
for %%a in ( %height% ) do echo.
echo %length%[]
choice /c wasd /n
if %errorlevel% equ 1 call:up
if %errorlevel% equ 2 call:left
if %errorlevel% equ 3 call:down
if %errorlevel% equ 4 call:right

:left
set length=!length:~0,-1!
goto controls

:right
set length=%length%
goto controls

:up
set height=!height:~0,-2!
goto controls

:down
set height=%height% a
goto control

As you can see, the code is very small (29 lines to be exact). This, I believe, is one of the smallest anyone has made.

Feel free to use it as the basis for any games to come, also, extra points if you make pong with it.

Step 2: Code 2 (Grid Confined Movement)

In this code, your character will be confined to a "cage".

@setlocal enableextensions enabledelayedexpansion
@echo off
color 0a
title Movement 2 ~ Grid
cls
goto data

:data
set lespa=         
set rispa=         
set space=5
set err=0
set right=10
set left=10

:hud
cls
echo Move your character (X) with the WASD keys. Press R to reset
echo #######################
if %space% equ 0 if %err% neq 1 (
echo #%lespa%X%rispa%#
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     # )
if %space% equ 1 if %err% neq 1 (
echo #                     #
echo #%lespa%X%rispa%#
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     # )
if %space% equ 2 if %err% neq 1 (
echo #                     #
echo #                     #
echo #%lespa%X%rispa%#
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     # )
if %space% equ 3 if %err% neq 1 (
echo #                     #
echo #                     #
echo #                     #
echo #%lespa%X%rispa%#
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     # )
if %space% equ 4 if %err% neq 1 (
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #%lespa%X%rispa%#
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     # )
if %space% equ 5 if %err% neq 1 (
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #%lespa%X%rispa%#
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     # )
if %space% equ 6 if %err% neq 1 (
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #%lespa%X%rispa%#
echo #                     #
echo #                     #
echo #                     #
echo #                     # )
if %space% equ 7 if %err% neq 1 (
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #%lespa%X%rispa%#
echo #                     #
echo #                     #
echo #                     # )
if %space% equ 8 if %err% neq 1 (
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #%lespa%X%rispa%#
echo #                     #
echo #                     # )
if %space% equ 9 if %err% neq 1 (
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #%lespa%X%rispa%#
echo #                     # )
if %space% equ 10 if %err% neq 1 (
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #                     #
echo #%lespa%X%rispa%# )
echo #######################
echo.
echo.
choice /c wasdr /n
if %errorlevel% equ 1 goto w
if %errorlevel% equ 2 goto a
if %errorlevel% equ 3 goto s
if %errorlevel% equ 4 goto d
if %errorlevel% equ 5 goto data

:w
set /a space=%space%-1
if %space% lss 0 set space=0
goto hud

:a
set lespa=!lespa:~0,-1!
set /a left=%left%-1
if %left% lss 1 set left=1 && set lespa=%lespa%
set rispa=%rispa%
set /a right=%right%+1
if %right% gtr 19 set right=19 && set rispa=!rispa:~0,-1!
goto hud

:s
set /a space=%space%+1
if %space% gtr 10 set space=10
goto hud

:d
set rispa=!rispa:~0,-1!
set /a right=%right%-1
if %right% lss 1 set right=1 && set rispa=%rispa%
set lespa=%lespa%
set /a left=%left%+1
if %left% gtr 19 set left=19 && set lespa=!lespa:~0,-1!
goto hud
<p>Hi Prof Pickle,</p><p>I'm trying to make a simple scissors, paper, rock game. But the if %you%=1 %cpu%=1 part doesn't work. Can you help?</p><p>@ECHO off<br>:home<br>color 09<br>title Scissors, Paper, Rock!<br>echo Welcome to Scissors Paper Rock made by Alex.<br>echo.<br>echo Enter your username:<br>set /p user=<br>if %user%==LeoL3o05 goto win<br>:gamehome<br>cls<br>echo Welcome %user%!<br>:level1<br>echo Enter Your Choice:<br>echo.<br>echo 1: Scissors<br>echo 2: Paper<br>echo 3: Rock<br>set /p you=<br>if %you%==1 set you=scissors<br>if %you%==2 set you=papers<br>if %you%==3 set you+rocks<br>set /a cpu=%random% %% 3+1<br>if %cpu% EQU 1 set cpu=scissor<br>if %cpu% EQU 2 set cpu=paper<br>if %cpu% EQU 3 set cpu=rock<br>pause<br>:level1input<br>if %you%=1 %cpu%=1 goto draw<br>if %you%=1 %cpu%=2 goto win<br>if %you%=1 %cpu%=3 goto lose<br>if %you%=2 %cpu%=1 goto lose<br>if %you%=2 %cpu%=2 goto draw<br>if %you%=2 %cpu%=3 goto win<br>if %you%=3 %cpu%=1 goto win<br>if %you%=3 %cpu%=2 goto lose<br>if %you%=3 %cpu%=3 goto draw<br>pause<br>:draw<br>color 0e<br>cls<br>echo Aww... so close! <br>echo Press any key to go back home.<br>pause<br>goto gamehome<br>:lose<br>color 04<br>cls<br>echo Sorry... the computer was overpowered.<br>echo Press any key to go back home.<br>pause<br>goto gamehome<br>:win<br>color 0a<br>cls<br>echo Congrats! You have overpowered the computer!<br>echo Press any key to go back home.<br>pause<br>goto gamehome</p>
<p>I Fixed It:</p><p>@ECHO off<br>:home<br>color 09<br>title Scissors, Paper, Rock!<br>echo Welcome to Scissors Paper Rock made by Alex.<br>echo.<br>echo Enter your username:<br>set /p user=<br>if %user%==LeoL3o05 goto win<br>:gamehome<br>cls<br>echo Welcome %user%!<br>:level1<br>echo Enter Your Choice:<br>echo.<br>echo 1: Scissors<br>echo 2: Paper<br>echo 3: Rock<br>set /p you=<br>if %you%==1 set you=1<br>if %you%==2 set you=2<br>if %you%==3 set you=3<br>set /a cpu=%random% %% 3+1<br>if %cpu% EQU 1 set cpu=1<br>if %cpu% EQU 2 set cpu=2<br>if %cpu% EQU 3 set cpu=3<br>goto level1input<br>:level1input<br>if %you%==1 if %cpu%==1 goto draw<br>if %you%==1 if %cpu%==2 goto win<br>if %you%==1 if %cpu%==3 goto lose<br>if %you%==2 if %cpu%==1 goto lose<br>if %you%==2 if %cpu%==2 goto draw<br>if %you%==2 if %cpu%==3 goto win<br>if %you%==3 if %cpu%==1 goto win<br>if %you%==3 if %cpu%==2 goto lose<br>if %you%==3 if %cpu%==3 goto draw<br>pause&gt;nul<br>:draw<br>color 0e<br>cls<br>echo Aww... so close! <br>echo Press any key to go back home.<br>pause&gt;nul<br>goto gamehome<br>:lose<br>color 04<br>cls<br>echo Sorry... the computer was overpowered.<br>echo Press any key to go back home.<br>pause&gt;nul<br>goto gamehome<br>:win<br>color 0a<br>cls<br>echo Congrats! You have overpowered the computer!<br>echo Press any key to go back home.<br>pause&gt;nul<br>goto gamehome</p>
<p>if %you%==1 set you=1</p><p>if %you%==2 set you=2</p><p>if %you%==3 set you=3</p><p>and</p><p>if %cpu% EQU 1 set cpu=1<br>if %cpu% EQU 2 set cpu=2<br>if %cpu% EQU 3 set cpu=3</p><p>Don't need to be in the code because they change nothing.</p><p>If the cpu variable is equal to 1, it doesn't need to be changed to 1.</p>
<p>Oh and can you please comment you email below? Twank youu</p>
<p>what does the ! do in &quot; set length=!length:~0,-1! &quot; ? and is it any different from &quot; %*% &quot; ?</p>
<p>I have made a snake game with many different speeds. here are the codes :</p><p>@echo off<br>if &quot;%~1&quot; == &quot;startGame&quot; goto :game<br>if &quot;%~1&quot; == &quot;startController&quot; goto :controller<br><br><br>::------------------------------------------------------------<br>:: verify existence of CHOICE command<br>:: set up a macro appropriately depending on available version<br><br>set &quot;choice=&quot;<br>2&gt;nul &gt;nul choice /c:yn /t 0 /d y<br>if errorlevel 1 if not errorlevel 2 set &quot;choice=choice /cs&quot;<br>if not defined choice (<br> 2&gt;nul &gt;nul choice /c:yn /t:y,1<br> if errorlevel 1 if not errorlevel 2 set &quot;choice=choice /s&quot;<br>)<br>if not defined choice (<br> echo ERROR: This game requires the CHOICE command, but it is missing.<br> echo Game aborted. :(<br> echo(<br> echo A 16 bit port of CHOICE.EXE from FREEDOS is available at<br> echo <a href="http://winsupport.org/utilities/freedos-choice.html" rel="nofollow"> http://winsupport.org/utilities/freedos-choice.ht...</a><br> echo(<br> echo A 32 bit version from ??? suitable for 64 bit machines is available at<br> echo <a href="http://hp.vector.co.jp/authors/VA007219/dkclonesup/choice.html" rel="nofollow"> http://hp.vector.co.jp/authors/VA007219/dkclonesu...</a><br> echo(<br> exit /b<br>)<br><br><br>::---------------------------------------------------------------------<br>:: setup some global variables used by both the game and the controller<br><br>set &quot;keys=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789&quot;<br>set &quot;keyFile=key.txt&quot;<br>set &quot;cmdFile=cmd.txt&quot;<br><br><br>::------------------------------------------<br>:: launch the game and the controller<br><br>copy nul &quot;%keyFile%&quot; &gt;nul<br>start &quot;&quot; /b &quot;%~f0&quot; startController 9^&gt;^&gt;%keyFile% 2^&gt;nul ^&gt;nul<br>cmd /c &quot;%~f0&quot; startGame 9^&lt;%keyFile% ^&lt;nul<br>echo(<br><br>::--------------------------------------------------------------------------------<br>:: Upon exit, wait for the controller to close before deleting the temp input file<br><br>:close<br>2&gt;nul (&gt;&gt;&quot;%keyFile%&quot; call )||goto :close<br>del &quot;%keyFile%&quot;<br>exit /b<br><br><br>::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::<br>:game<br>setlocal disableDelayedExpansion<br>title %~nx0<br>cls<br><br>::----------------------------<br>:: user configurable options<br><br>set &quot;up=W&quot;<br>set &quot;down=S&quot;<br>set &quot;left=A&quot;<br>set &quot;right=D&quot;<br><br>set &quot;width=40&quot; max=99<br>set &quot;height=25&quot; max=99<br>:: max playing field: (width-2)*(height-2) &lt;= 1365<br><br>::----------------------------<br>:: resize the console window<br><br>set /a cols=width+1, lines=height+10, area=(width-2)*(height-2)<br>if %area% gtr 1365 (<br> echo ERROR: Playfield area too large<br> &gt;&quot;%cmdFile%&quot; (echo quit)<br> exit<br>)<br>if %lines% lss 14 set lines=14<br>if %cols% lss 46 set cols=46<br>mode con: cols=%cols% lines=%lines%<br><br>::----------------------------<br>:: define variables<br><br>set &quot;spinner1=-&quot;<br>set &quot;spinner2=\&quot;<br>set &quot;spinner3=|&quot;<br>set &quot;spinner4=/&quot;<br>set &quot;spinner= spinner1 spinner2 spinner3 spinner4 &quot;<br><br>set &quot;space= &quot;<br>set &quot;bound=#&quot;<br>set &quot;food=+&quot;<br>set &quot;head=@&quot;<br>set &quot;body=O&quot;<br>set &quot;death=X&quot;<br>set &quot;playerSpace=%space%%food%&quot;<br><br>set &quot;xDiff%up%=+0&quot;<br>set &quot;xDiff%down%=+0&quot;<br>set &quot;xDiff%left%=-1&quot;<br>set &quot;xDiff%right%=+1&quot;<br><br>set &quot;yDiff%up%=-1&quot;<br>set &quot;yDiff%down%=+1&quot;<br>set &quot;yDiff%left%=+0&quot;<br>set &quot;yDiff%right%=+0&quot;<br><br>set &quot;%up%Axis=Y&quot;<br>set &quot;%down%Axis=Y&quot;<br>set &quot;%left%Axis=X&quot;<br>set &quot;%right%Axis=X&quot;<br><br>set &quot;delay1=20&quot;<br>set &quot;delay2=15&quot;<br>set &quot;delay3=10&quot;<br>set &quot;delay4=7&quot;<br>set &quot;delay5=5&quot;<br>set &quot;delay6=3&quot;<br>set &quot;delay0=0&quot;<br><br>set &quot;desc1=Sluggard&quot;<br>set &quot;desc2=Crawl&quot;<br>set &quot;desc3=Slow&quot;<br>set &quot;desc4=Normal&quot;<br>set &quot;desc5=Fast&quot;<br>set &quot;desc6=Insane&quot;<br>set &quot;desc0=Unplayable&quot;<br><br>set &quot;spinnerDelay=3&quot;<br><br>set /a &quot;width-=1, height-=1&quot;<br><br><br>::---------------------------<br>:: define macros<br><br>::define a Line Feed (newline) string (normally only used as !LF!)<br>set LF=^<br><br><br>::Above 2 blank lines are required - do not remove<br><br>::define a newline with line continuation<br>set ^&quot;\n=^^^%LF%%LF%^%LF%%LF%^^&quot;<br><br>:: setErr<br>::: Sets the ERRORLEVEL to 1<br>set &quot;setErr=(call)&quot;<br><br>:: clrErr<br>::: Sets the ERRORLEVEL to 0<br>set &quot;clrErr=(call )&quot;<br><br><br>:: getKey ValidKeys<br>::: Check for keypress. Only accept keys listed in ValidKeys<br>::: Return result in Key variable. Key is undefined if no valid keypress.<br>set getKey=%\n%<br>for %%# in (1 2) do if %%#==2 (for /f &quot;eol= delims= &quot; %%1 in (&quot;!args!&quot;) do (%\n%<br> set &quot;validKeys=%%1&quot;%\n%<br> set &quot;key=&quot;%\n%<br> ^&lt;^&amp;9 set /p &quot;key=&quot;%\n%<br> if defined key if &quot;!key!&quot; neq &quot;:&quot; (%\n%<br> set /a key-=1%\n%<br> for %%K in (!key!) do set &quot;key=!keys:~%%K,1!&quot;%\n%<br> )%\n%<br> for %%K in (!key!) do if &quot;!validKeys:%%K=!&quot; equ &quot;!validKeys!&quot; set &quot;key=&quot;%\n%<br>)) else set args=<br><br><br>:: draw<br>::: draws the board<br>set draw=%\n%<br>cls%\n%<br>for /l %%Y in (0,1,%height%) do echo(!line%%Y!%\n%<br>echo Speed=!Difficulty!%\n%<br>echo Score=!score!<br><br><br>:: test X Y ValueListVar<br>::: tests if value at coordinates X,Y is within contents of ValueListVar<br>set test=%\n%<br>for %%# in (1 2) do if %%#==2 (for /f &quot;tokens=1-3&quot; %%1 in (&quot;!args!&quot;) do (%\n%<br> for %%A in (&quot;!line%%2:~%%1,1!&quot;) do if &quot;!%%3:%%~A=!&quot; neq &quot;!%%3!&quot; %clrErr% else %setErr%%\n%<br>)) else set args=<br><br><br>:: plot X Y ValueVar<br>::: places contents of ValueVar at coordinates X,Y<br>set plot=%\n%<br>for %%# in (1 2) do if %%#==2 (for /f &quot;tokens=1-3&quot; %%1 in (&quot;!args!&quot;) do (%\n%<br> set &quot;part2=!line%%2:~%%1!&quot;%\n%<br> set &quot;line%%2=!line%%2:~0,%%1!!%%3!!part2:~1!&quot;%\n%<br>)) else set args=<br><br><br>::--------------------------------------<br>:: start the game<br>setlocal enableDelayedExpansion<br>call :initialize<br><br><br>::--------------------------------------<br>:: main loop (infinite loop)<br>for /l %%. in (1 0 1) do (<br><br> %=== compute time since last move ===%<br> for /f &quot;tokens=1-4 delims=:.,&quot; %%a in (&quot;!time: =0!&quot;) do set /a &quot;t2=(((1%%a*60)+1%%b)*60+1%%c)*100+1%%d-36610100, tDiff=t2-t1&quot;<br> if !tDiff! lss 0 set /a tDiff+=24*60*60*100<br><br> if !tDiff! geq !delay! (<br> %=== delay has expired, so time for movement ===%<br><br> %=== establish direction ===%<br> %getKey% ASDW<br> for %%K in (!key!) do if &quot;!%%KAxis!&quot; neq &quot;!axis!&quot; (<br> set /a &quot;xDiff=xDiff%%K, yDiff=yDiff%%K&quot;<br> set &quot;axis=!%%KAxis!&quot;<br> )<br><br> %=== erase the tail ===%<br> set &quot;TX=!snakeX:~-2!&quot;<br> set &quot;TY=!snakeY:~-2!&quot;<br> set &quot;snakeX=!snakeX:~0,-2!&quot;<br> set &quot;snakeY=!snakeY:~0,-2!&quot;<br> %plot% !TX! !TY! space<br><br> %=== compute new head location and attempt to move ===%<br> set /a &quot;X=PX+xDiff, Y=PY+yDiff&quot;<br> set &quot;X= !X!&quot;<br> set &quot;Y= !Y!&quot;<br> set &quot;X=!X:~-2!&quot;<br> set &quot;Y=!Y:~-2!&quot;<br> (%test% !X! !Y! playerSpace) &amp;&amp; (<br><br> %=== move successful ===%<br><br> %=== remove the new head location from the empty list ===%<br> for %%X in (&quot;!X!&quot;) do for %%Y in (&quot;!Y!&quot;) do set &quot;empty=!empty:#%%~X %%~Y=!&quot;<br><br> (%test% !X! !Y! food) &amp;&amp; (<br> %=== moving to food - eat it ===%<br><br> %=== restore the tail ===%<br> %plot% !TX! !TY! body<br> set &quot;snakeX=!snakeX!!TX!&quot;<br> set &quot;snakeY=!snakeY!!TY!&quot;<br><br> %=== increment score and locate and draw new food ===%<br> set /a &quot;score+=1, F=(!random!%%(emptyCnt-=1))*6+1&quot;<br> for %%F in (!F!) do (%plot% !empty:~%%F,5! food)<br><br> ) || (<br> %=== moving to empty space ===%<br><br> %=== add the former tail position to the empty list ===%<br> set &quot;empty=!empty!#!TX! !TY!&quot;<br> )<br><br> %=== draw the new head ===%<br> if defined snakeX (%plot% !PX! !PY! body)<br> %plot% !X! !Y! head<br><br> %=== Add the new head position to the snake strings ===%<br> set &quot;snakeX=!X!!snakeX!&quot;<br> set &quot;snakeY=!Y!!snakeY!&quot;<br> set &quot;PX=!X!&quot;<br> set &quot;PY=!Y!&quot;<br><br> %draw%<br><br> ) || (<br><br> %=== failed move - game over ===%<br> %plot% !TX! !TY! body<br> call :spinner !PX! !PY! death<br> %draw%<br> echo(<br> call :ask &quot;Would you like to play again? (Y/N)&quot; YN<br> if /i &quot;!key!&quot; equ &quot;N&quot; (<br> &gt;&quot;%cmdFile%&quot; (echo quit)<br> exit<br> ) else (<br> call :initialize<br> )<br> )<br><br> set /a t1=t2<br> )<br>)<br><br>:ask Prompt ValidKeys<br>:: Prompt for a keypress. ValidKeys is a list of acceptable keys<br>:: Wait until a valid key is pressed and return result in Key variable<br>&gt;&quot;%cmdFile%&quot; (echo prompt)<br>&lt;nul set /p &quot;=%~1 &quot;<br>:purge<br>(%getKey% :)<br>if not defined key goto :purge<br>:getResponse<br>(%getKey% %2)<br>if not defined key (<br> &gt;&quot;%cmdFile%&quot; (echo one)<br> goto :getResponse<br>)<br>exit /b<br><br><br>:spinner X Y ValueVar<br>set /a d1=-1000000<br>for /l %%N in (1 1 5) do for %%C in (%spinner%) do (<br> call :spinnerDelay<br> %plot% %1 %2 %%C<br> %draw%<br>)<br>call :spinnerDelay<br>(%plot% %1 %2 %3)<br>exit /b<br><br>:spinnerDelay<br>for /f &quot;tokens=1-4 delims=:.,&quot; %%a in (&quot;!time: =0!&quot;) do set /a &quot;d2=(((1%%a*60)+1%%b)*60+1%%c)*100+1%%d-36610100, dDiff=d2-d1&quot;<br>if %dDiff% lss 0 set /a dDiff+=24*60*60*100<br>if %dDiff% lss %spinnerDelay% goto :spinnerDelay<br>set /a d1=d2<br>exit /b<br><br><br>::-------------------------------------<br>:initialize<br>cls<br><br>echo Speed Options:<br>echo delay<br>echo # Description (seconds)<br>echo --- ----------- ---------<br>echo 1 Sluggard 0.20<br>echo 2 Crawl 0.15<br>echo 3 Slow 0.10<br>echo 4 Normal 0.07<br>echo 5 Fast 0.05<br>echo 6 Insane 0.03<br>echo 0 Unplayable none<br>echo(<br>call :ask &quot;Pick a speed (1-6, 0):&quot; 1234560<br>set &quot;difficulty=!desc%key%!&quot;<br>set &quot;delay=!delay%key%!&quot;<br>echo %key% - %difficulty%<br>echo(<br>&lt;nul set /p &quot;=Initializing.&quot;<br>set &quot;axis=X&quot;<br>set &quot;xDiff=+1&quot;<br>set &quot;yDiff=+0&quot;<br>set &quot;empty=&quot;<br>set /a &quot;PX=1, PY=height/2, FX=width/2+1, FY=PY, score=0, emptyCnt=0, t1=-1000000&quot;<br>set &quot;snakeX= %PX%&quot;<br>set &quot;snakeY= %PY%&quot;<br>set &quot;snakeX=%snakeX:~-2%&quot;<br>set &quot;snakeY=%snakeY:~-2%&quot;<br>for /l %%Y in (0 1 %height%) do (<br> &lt;nul set /p &quot;=.&quot;<br> set &quot;line%%Y=&quot;<br> for /l %%X in (0,1,%width%) do (<br> set &quot;cell=&quot;<br> if %%Y equ 0 set &quot;cell=%bound%&quot;<br> if %%Y equ %height% set &quot;cell=%bound%&quot;<br> if %%X equ 0 set &quot;cell=%bound%&quot;<br> if %%X equ %width% set &quot;cell=%bound%&quot;<br> if %%X equ %PX% if %%Y equ %PY% set &quot;cell=%head%&quot;<br> if not defined cell (<br> set &quot;cell=%space%&quot;<br> set &quot;eX= %%X&quot;<br> set &quot;eY= %%Y&quot;<br> set &quot;empty=!empty!#!eX:~-2! !eY:~-2!&quot;<br> set /a emptyCnt+=1<br> )<br> if %%X equ %FX% if %%Y equ %FY% set &quot;cell=%food%&quot;<br> set &quot;line%%Y=!line%%Y!!cell!&quot;<br> )<br>)<br>(%draw%)<br>echo(<br>echo Movement keys: %up%=up %down%=down %left%=left %right%=right<br>echo Avoid running into yourself (%body%%body%%head%) or wall (%bound%)<br>echo Eat food (%food%) to grow.<br>echo(<br>call :ask &quot;Press any alpha-numeric key to start...&quot; %keys%<br>&gt;&quot;%cmdFile%&quot; (echo go)<br>exit /b<br><br><br>::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::<br>:controller<br><br>setlocal enableDelayedExpansion<br>set &quot;cmd=hold&quot;<br>set &quot;key=&quot;<br>for /l %%. in (1 0 1) do (<br> if &quot;!cmd!&quot; neq &quot;hold&quot; (<br> %choice% /n /c:!keys!<br> set &quot;key=!errorlevel!&quot;<br> )<br> if exist &quot;%cmdFile%&quot; (<br> &lt;&quot;%cmdFile%&quot; set /p &quot;cmd=&quot;<br> del &quot;%cmdFile%&quot;<br> )<br> if &quot;!cmd!&quot; equ &quot;quit&quot; exit<br> if defined key (<br> if &quot;!cmd!&quot; equ &quot;prompt&quot; &gt;&amp;9 (echo :)<br> &gt;&amp;9 (echo !key!)<br> if &quot;!cmd!&quot; neq &quot;go&quot; set &quot;cmd=hold&quot;<br> set &quot;key=&quot;<br> )</p><p>copy these codes and save in notepad as a .bat file.</p><p>enjoy the game<br>)</p>
<p>Um, actually Dave Benham made that snake game:</p><p><a href="http://ss64.org/viewtopic.php?id=1725" rel="nofollow">http://ss64.org/viewtopic.php?id=1725</a></p>
<p>I am working on a game called roseymon but it says there is an error there. I need help on this. Can someone tell me whats wrong? Here is the coding:</p><p>@echo off</p><p>:menu</p><p>cls</p><p>echo Welcome to Roseymon!</p><p>pause</p><p>echo Ready to play?</p><p>echo 1) Story mode</p><p>echo 2) Battle</p><p>echo 3) Exit/Cancel</p><p>set /p letter=</p><p>if %letter% == 1 goto storymode</p><p>if %letter% == 2 goto battle</p><p>if %letter% == 3 goto exit</p><p>goto menu</p><p>:storymode</p><p>cls</p><p>echo Rose: Welcome fellow person! Do you want to start your adventure?</p><p>pause</p><p>echo Rose: That is great! What is your name?</p><p>set /p name=</p><p>echo Rose: Welcome %name%!</p><p>echo Rose: Wanna choose your starter Roseymon?</p><p>pause</p><p>echo Rose: Okay! Choose one of theese Roseymons!</p><p>echo 4) 4. Rosica (Plant)</p><p>echo 5) 5. Rosidolf (Water)</p><p>echo 6) 6. Rosifire (Fire)</p><p>echo 7) Help: Say the number at the start of the Roseymon to choose it!</p><p>set /p letter=</p><p>if %letter% == 4 goto plantstarter</p><p>:plantstarter</p><p>echo Rose: Ah! Rosica! A well choice!</p><p>pause</p><p>echo Rose: Do you want to battle?</p><p>pause</p><p>echo Y to battle N to not battle</p><p>if %letter% == n goto continue</p><p>if %letter% == y goto battle</p><p>battle:</p><p>pause</p><p>echo Rose: Okay! Here we go!</p><p>Pause</p><p>echo Rose sent out Rosman</p><p>echo Roseman used water splash!</p><p>Pause</p><p>echo -1 HP</p><p>echo You have 12 hp left!</p><p>Pause</p><p>echo What move do you want to use?</p><p>echo 1) 1. Rose petals</p><p>echo 2) 2. Leaf block</p><p>echo 3) Help: Say the number at the start of the attack to choose it!</p><p>if %letter% == 1 goto atk1</p><p>if %letter% == 2 goto atk2</p><p>atk1:</p><p>pause</p><p>echo Rose petals dealt 13 dmg!</p><p>Pause</p><p>echo It is super effective!</p><p>Pause</p><p>echo The Roseman got knocked out!</p><p>Pause</p><p>echo Your Rosica leveld up!</p><p>echo It is now level 2!</p><p>pause</p><p>atk2:</p><p>pause</p><p>echo Leaf block blocked the opponents attack!</p><p>Pause</p><p>echo Roseman used swoop!</p><p>echo It failed</p><p>echo 1) 1. Rose petals</p><p>echo 2) 2. Leaf block</p><p>echo 3) Help: Say the number at the start of the attack to choose it!</p><p>if %letter% == 1 goto atk1</p><p>if %letter% == 2 goto atk2</p>
<p>Dear Lindsay</p><p>ur doing it wrong.</p><p>so instead of</p><p>set /p letter=</p><p>if %letter% == 1 goto storymode</p><p>if %letter% == 2 goto battle</p><p>if %letter% == 3 goto exit</p><p>do </p><p>set /p letter=</p><p>if %letter% equ 1 goto storymode</p><p>if %letter% equ 2 goto battle</p><p>if %letter% equ 3 gotogoto exit</p>
ohk thx
<p>One other thing: you're putting the colon on the wrong sides of the menu name if that's what you're trying to get at, if not, and you're trying to make it a choice, try: set /p (name of command):</p>
<p>You also only have one choice, that being Rosica, but I don't believe that that's under your control with the knowledge you possess now, I'm trying to figure that out myself</p><p>keep us posted!</p>
<p>I made a prank, here is the code:</p><p>@echo off </p><p>color 4</p><p>echo your computer is under virus</p><p>pause</p><p>echo virus location : C:/Windows/twunk_32.exe</p><p>pause</p><p>echo windows is cheking for solution</p><p>pause</p><p>echo solution founded!</p><p>pause</p><p>echo the solution is, delete the System32 folder from C:\Windows.</p><p>pause</p><p>echo Note: delete the folder within 32 min only!!</p><p>pause</p><p>color 2</p><p>echo dont do anything, it is fake application</p><p>pause</p>
<p>Is it possible to stop the beep caused by pressing a key outside of the designated WASD?</p>
<p>For some reaon your code doesn't allow me to move to the right? Any help.</p>
<p>put an extra space after the set length=%length% part</p>
<p>Also in Windows 7, you can use this command: choice /c [keys] /n(if you want to hide letters). Try choice /? in cmd.exe for use it.</p>
<p>Soo many scripts in comments</p>
<p>echo this code is a bit better</p><p>@echo off <br>@setlocal enbleextensions enabledelayedexpasion <br>color f0 <br>title Move</p><p>:data <br>set xR= </p><p> <br>set xL= </p><p> <br>set y= </p><p> <br>set up=5 </p><p>set null=0</p><p>:Screen <br>cls</p><p>echo click w,a,s,d to move. <br>echo click r to restart <br>echo. <br>echo.</p><p>echo ########### <br>if %up% equ 5 if %null% neq 1 ( <br>echo #%xL%@%xR%# <br>echo # # <br>echo # # <br>echo # # <br>echo # #)</p><p>if %up% equ 4 if %null% neq 1 ( <br>echo # # <br>echo #%xL%@%xR%# <br>echo # # <br>echo # # <br>echo # #)</p><p>if %up% equ 2 if %null% neq 1 ( <br>echo # # <br>echo # # <br>echo # # <br>echo #%xL%@%xR%# <br>echo # #)</p><p>if %up% equ 3 if %null% neq 1 ( <br>echo # # <br>echo # # <br>echo #%xL%@%xR%# <br>echo # # <br>echo # #)</p><p>if %up% equ 1 if %null% neq 1 ( <br>echo # # <br>echo # # <br>echo # # <br>echo # # <br>echo #%xL%@%xR%#) <br>echo ###########</p><p>echo. <br>echo.</p><p>choice /c wasdr /n</p><p>if %ERRORLEVEL% equ 1 goto up <br>if %ERRORLEVEL% equ 2 goto left <br>if %ERRORLEVEL% equ 3 goto if %null% equ 1 (wn <br>if %ERRORLEVEL% equ 4 goto right <br>if %ERRORLEVEL% equ 5 goto data</p><p>:up <br>if &quot;%y%&quot; neq &quot;&quot; set y=%y:~0,-2% <br>set /a up=%up%+1 <br>goto Screen</p><p>:left <br>set xL=%xL:~0,-1% <br>set xR= %xR% <br>goto Screen</p><p>:if %null% equ 1 (wn <br>set y=%y% s <br>set /a up=%up%-1 <br>goto Screen</p><p>:right <br>set xL= %xL% <br>set xR=%xR:~0,-1% <br>goto Screen</p>
<p>here is a game i made ps it isnt harmful click more options then run anyway!</p><p>http://www.mediafire.com/download/b97slddkmazrkvk/escape+V+2.0.bat</p>
<p>Its not on media fire anymore</p>
<p>How do you add enmies and obsticals? Please respond!</p>
<p>This Is One I Created. Made With Slide By Slide Movements</p><p>@echo off</p><p>title Knights And Heroes</p><p>color f0</p><p>mode con cols=45 lines=15</p><p>:main</p><p>cls</p><p>echo.</p><p>echo &Eacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&raquo;</p><p>echo &ordm;Knights And Heroes&ordm;</p><p>echo &Egrave;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&frac14; </p><p>echo.</p><p>echo &Eacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&raquo; </p><p>echo &ordm; 1.Play &ordm; </p><p>echo &ordm; 2.Exit &ordm;</p><p>echo &Egrave;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&frac14;</p><p>set /p log=</p><p>if %log%==1 goto log</p><p>if %log%==2 goto reg</p><p>:reg</p><p>exit /b</p><p>:log</p><p>echo Whats Your Name Young Hero?</p><p>echo.</p><p>set /p name=</p><p>cls</p><p>echo So You Are %name%!</p><p>ping local host 3 &gt;nul</p><p>echo Please Wait While We Load Everything...</p><p>ping local host 5 &gt;nul</p><p>:game</p><p>cls</p><p>echo Choose Your Character</p><p>echo Remember WASD Is Your Control Q To Attack</p><p>echo .You Cant Shoot While Jumping</p><p>echo.</p><p>echo Write Anything </p><p>echo To Be Your CHaracter</p><p>echo.</p><p>set /p C=</p><p>echo Press Any Key To Roam!</p><p>pause &gt;nul</p><p>echo Are You Sure You Want &quot;%C%&quot; To Be Your</p><p>echo Character? (Y/N)</p><p>set /p out=</p><p>if %out%==y goto A</p><p>if %out%==n goto game</p><p>pause</p><p>goto game</p><p>:A</p><p>cls </p><p>echo &Eacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&raquo; Health</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm; %name% &sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm; Raider &sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm; </p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm; </p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&deg;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&deg;%C%&deg;&deg;&sup2;&sup2;&sup2;&deg;@&sup2;&sup2;&sup2;&ordm;</p><p>echo &Egrave;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&frac14; </p><p>set /p A=</p><p>if %A%==w goto B</p><p>pause</p><p>goto A</p><p>:B</p><p>cls </p><p>echo &Eacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&raquo; Health</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm; %name% &sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm; Raider &sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm; </p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm; </p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&deg;%C%&sup2;&sup2;&sup2;&sup2;@&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&deg;&sup2;&deg;&deg;&sup2;&sup2;&sup2;&deg;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &Egrave;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&frac14; </p><p>set /p B=</p><p>if %B%==d goto D</p><p>pause</p><p>goto B</p><p>:D</p><p>cls </p><p>echo &Eacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&raquo; Health</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm; %name% &sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm; Raider &sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm; </p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm; </p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&deg;&sup2;%C%&sup2;&sup2;@&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&deg;&sup2;&deg;&deg;&sup2;&sup2;&sup2;&deg;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &Egrave;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&frac14; </p><p>set /p E=</p><p>if %E%==q goto anim</p><p>if %E%==d goto anim2</p><p>pause</p><p>goto D</p><p>:anim2</p><p>cls</p><p>echo &Eacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&raquo; Health</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm; %name% &plusmn;&plusmn;&plusmn;&plusmn;&plusmn;&plusmn;&plusmn;&plusmn;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm; Raider &sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm; </p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm; </p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&deg;&sup2;%C%((@&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&deg;&sup2;&deg;&deg;&sup2;&sup2;&sup2;&deg;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &Egrave;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&frac14;</p><p>ping local host 1 &gt;nul</p><p>goto lose </p><p>:lose</p><p>cls</p><p>echo You Died.</p><p>echo.</p><p>echo.</p><p>echo 1.main menu</p><p>echo 2.exit</p><p>set /p input=</p><p>if %input%==1 goto main</p><p>if %input%==2 goto exit</p><p>:anim</p><p>cls </p><p>echo &Eacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&raquo; Health</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm; %name% &sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm; Raider &sup2;&sup2;&sup2;&plusmn;&plusmn;&plusmn;&plusmn;&plusmn;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm; </p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm; </p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&deg;&sup2;%C%))@&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&deg;&sup2;&deg;&deg;&sup2;&sup2;&sup2;&deg;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &Egrave;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&frac14; </p><p>ping local host 1 &gt;nul</p><p>:E</p><p>cls </p><p>echo &Eacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&raquo; Health</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm; %name% &sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm; Raider &sup2;&sup2;&sup2;&plusmn;&plusmn;&plusmn;&plusmn;&plusmn;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm; </p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm; </p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&deg;&sup2;%C%&sup2;&sup2;@&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&deg;&sup2;&deg;&deg;&sup2;&sup2;&sup2;&deg;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &Egrave;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&frac14;</p><p>set /p F=</p><p>if %F%==q goto win</p><p>if %f%==d goto F</p><p>:win</p><p>cls </p><p>echo &Eacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&raquo; Health</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm; %name% &sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm; Raider &sup2;&sup2;&sup2;&plusmn;&plusmn;&plusmn;&plusmn;&plusmn;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm; </p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm; </p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&deg;&sup2;%C%))@&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&deg;&sup2;&deg;&deg;&sup2;&sup2;&sup2;&deg;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &Egrave;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&frac14;</p><p>ping local host 1 &gt;nul</p><p>cls </p><p>echo &Eacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&raquo; Health</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm; %name% &sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm; Raider &plusmn;&plusmn;&plusmn;&plusmn;&plusmn;&plusmn;&plusmn;&plusmn;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm; </p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm; </p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&deg;&sup2;%C%&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&deg;&sup2;&deg;&deg;&sup2;&sup2;&sup2;&deg;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &Egrave;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&frac14;</p><p>ping local host 2 &gt;nul</p><p>:win</p><p>cls</p><p>echo You Won!</p><p>echo 1.Next Level</p><p>echo 2.Retry</p><p>set /p last=</p><p>if %last%==2 goto game</p><p>if %last%==1 goto levelup</p><p>:levelup</p><p>echo We Would Need To Restart To Start Level 2</p><p>echo And It Will Be Done Automatically in 3 sec.</p><p>start lvl2</p><p>exit /b</p><p>:F</p><p>cls </p><p>echo &Eacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&raquo; Health</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm; %name% &sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm; Raider &sup2;&sup2;&sup2;&plusmn;&plusmn;&plusmn;&plusmn;&plusmn;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm; </p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm; </p><p>echo &ordm;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&deg;&sup2;&sup2;%C%&sup2;@&sup2;&sup2;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &ordm;&deg;&sup2;&deg;&deg;&sup2;&sup2;&sup2;&deg;&sup2;&sup2;&sup2;&sup2;&ordm;</p><p>echo &Egrave;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&Iacute;&frac14;</p><p>set /p G=</p><p>if %G%==q goto win</p><p>pause</p><p>goto F</p>
<p>Made some fixes</p><p>1. allows to move left.</p><p>2. gets rid of annoying text.</p><p>@setlocal enableextensions enabledelayedexpansion</p><p>@echo off</p><p>title movement</p><p>color 0a</p><p>set length= </p><p>set height= a</p><p>:controls</p><p>cls</p><p>echo (leghth: &quot;%length%&quot;, heigth: &quot;%height%&quot;) &gt;nul</p><p>echo.</p><p>for %%a in ( %height% ) do echo.</p><p>echo %length%[]</p><p>choice /c wasd /n</p><p>if %errorlevel% equ 4 call:right</p><p>if %errorlevel% equ 3 call:down</p><p>if %errorlevel% equ 2 call:left</p><p>if %errorlevel% equ 1 call:up</p><p>:left</p><p>set length=!length:~0,-1!</p><p>goto controls</p><p>:right</p><p>set length=^ %length%</p><p>goto controls</p><p>:up</p><p>if &quot;%height%&quot; neq &quot;&quot; set height=!height:~0,-2!</p><p>goto controls</p><p>:down</p><p>set height=%height% a</p><p>goto controls</p>
<p>Fixing some mistakes:</p><p> 1. Evaluating choice from 4 to 1</p><p> 2. Up and Left only if possible</p><p>@setlocal enableextensions enabledelayedexpansion<br>@echo off<br>title movement<br>color 0a<br><br>set length= <br>set height= a<br><br>:controls<br>cls<br>echo Use WASD to move your character ([]). (leghth: &quot;%length%&quot;, heigth: &quot;%height%&quot;)<br>echo.<br>for %%a in ( %height% ) do echo.<br>echo %length%[]<br>choice /c wasd /n<br>if %errorlevel% equ 4 call:right<br>if %errorlevel% equ 3 call:down<br>if %errorlevel% equ 2 call:left<br>if %errorlevel% equ 1 call:up<br><br>:left<br>if &quot;%length%&quot; neq &quot;&quot; set length=!length:~0,-1!<br>goto controls<br><br>:right<br>set length=^ %length%<br>goto controls<br><br>:up<br>if &quot;%height%&quot; neq &quot;&quot; set height=!height:~0,-2!<br>goto controls<br><br>:down<br>set height=%height% a<br>goto controls</p>
<p>This is much nicer for my purpose thanks.</p>
<p>Nice I'v never seen this before and I see lots of potential in making games with it.</p>
Very cool program. But I've got a question: Is there any way to make a scenario around? Like Pac-Man, for example? Cause this could become a mini-game of sorts. I have never used @setlocal stuff, so I really don't know... :P<br>
Unfortunately, this code needs complete formatting before being able to add more than one object in the game, but yes, you can make a scenario. If you want I can publish the code and how to make scenarios and such. <br> <br>Secondly, &quot;@setlocal enabledelayedexpansion&quot; enables the delayed expansion of variables in a batch file. In various commands, certain switches can only be used if delayed expansion is enabled, other witches change depending on it. One such command is the IF command. When delayed expansion is enabled, you can use the I switch for case insensitive comparison of strings. <br> <br>I'll be making the code shortly.
I'd really appreciate if you could show me how. I've just started with batch and I would like to learn more stuff :D (like that %ERRORLEVEL% thing, for example)
Ok, well I can't teach you everything through comments, so I advise you to check out some tutorials (preferably those who don't have &quot;ZOMG F4ke havk with batch 1337&quot; in the title). But, I can help you with general concepts and commands. <br> <br>Basically, you'd have to keep track of your characters coordinates within your grid. Each grid square would have to be set as something, and when your player moves, the grid square corresponding to the movement is set as your player, and the previously inhabited slot would be reverted back to a grid spot. <br> <br>The variable &quot;errorlevel&quot; is used by DOS to tell the user if a command didn't work, and to make life easier. Certain events set the errorlevel to certain values. The CHOICE command is one of those. When you pick an option, perhaps A, B or C, the errorlevel is set corresponding to that choice. <br>Example: <br>CHOICE /C ABC /N <br>IF %ERRORLEVEL% EQU 1 ECHO You pressed A <br>IF %ERRORLEVEL% EQU 2 ECHO You pressed B <br>IF %ERRORLEVEL% EQU 3 ECHO You pressed C <br> <br>The above snippet of code would pause until a key out of A,B or C was pressed, and then tell you which one you pressed. The C switch for the CHOICE command specifies the choices, the default list is YN. It is case insensitive unless made so with the /CS argument. The N switch makes the list of keys hidden, so it doesn't display the keys it wants you to press. <br> <br>If you set a variable named &quot;errorlevel&quot; or any variations, it will override the existing variable, and cease updating of the errorlevel environmental variable. <br> <br>Just ask your next topic and I'll help you with that, too. <br> <br>
Hey Prof. Pickle, i'm just wondering if you could help me out with this game i'm making.<br> It's called &quot;Batch Streets&quot;. By the name you can tell it's a car game, but i'm trying to make a building (&quot;[ &nbsp;]&quot;) do something but it won't work help...<br> <br> CODE:-<br> @setlocal enableextensions enabledelayedexpansion<br> @echo off<br> Title Movement<br> mode con cols=45 lines=15<br> color 0a<br> <br> set length=<br> set height= a<br> Set Nitro=&nbsp;&nbsp;<br> <br> :Start<br> cls<br> echo Batch Streets V 0.0.1<br> echo ---------------------<br> echo 1.New File<br> echo 2.Load File<br> echo 3.Exit<br> Set /p Start=<br> cls<br> if %Start% == 1 goto New<br> if %Start% == 2 goto Load<br> if %Start% == 3 Exit<br> goto Start<br> <br> :New<br> cls<br> echo Enter your name:<br> Set /p Name=<br> cls<br> echo Enter your Age:<br> Set /p Age=<br> cls<br> echo Set your Controls:<br> echo.<br> echo&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Up...<br> Set /p U=<br> echo.<br> echo&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Down...<br> Set /p D=<br> echo.<br> echo&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Left...<br> Set /p L=<br> echo.<br> echo&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Right...<br> Set /p R=<br> echo&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Nitro...<br> Set /p N=<br> cls<br> Set Money=50000<br> Set P_Points=50<br> echo Choose your car<br> echo.<br> echo Name: %Name%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Money: %Money%<br> echo.<br> echo 1.@ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$10000<br> echo 2.#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $20000<br> echo 3.*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $35000<br> Set /p Car=<br> if %Car% == 1 Set Car=@<br> if %Car% == 1 Set /a Money= %Money% - 10000<br> if %Car% == 2 Set Car=#<br> if %Car% == 2 Set /a Money= %Money% - 20000<br> if %Car% == 3 Set Car=*<br> if %Car% == 3 Set /a Money= %Money% - 35000<br> cls<br> echo Controls Set...<br> Pause&gt;nul<br> goto controls<br> <br> :controls<br> cls<br> echo [ ]&nbsp; %Height%<br> for %%a in ( %height% ) do echo.<br> echo %length% %Car%<br> choice /c %U%%L%%D%%R%%N% /n<br> if %errorlevel% equ 1 call :up<br> if %errorlevel% equ 2 call :left<br> if %errorlevel% equ 3 call :down<br> if %errorlevel% equ 4 call :right<br> if %errorlevel% equ 5 call :Nitro<br> if %errorlevel% equ !height:~0,0! call :Carshop<br> <br> :left<br> cls<br> set length=!length:~0,-1!<br> goto controls<br> <br> :right<br> cls<br> set length=%length%<br> goto controls<br> <br> :up<br> cls<br> set height=!height:~0,-2!<br> goto controls<br> <br> :down<br> cls<br> set height=%height% a<br> goto controls<br> <br> :Nitro<br> cls<br> set length=%length%&nbsp;<br> goto controls<br> <br> :Carshop<br> cls<br> echo Name: %Name%&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Money: %Money%<br> echo.<br> echo 1.@&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $10000<br> echo 2.#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $20000<br> echo 3.*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $35000<br> Set /p Car=<br> if %Car% == 1 Set Car=@<br> if %Car% == 1 Set /a Money= %Money% - 10000<br> if %Car% == 2 Set Car=#<br> if %Car% == 2 Set /a Money= %Money% - 20000<br> if %Car% == 3 Set Car=*<br> if %Car% == 3 Set /a Money= %Money% - 35000<br> goto controls&nbsp;
It could be the for statement in your :controls section. Try putting quotation marks around the variable inside the brackets.
It didn't work, it just stopped moving...
I fixed it. It think it was some of your movement code (:up, :right, :left). <br> <br>@echo off <br>setlocal enabledelayedexpansion <br>Title Movement <br>mode con cols=45 lines=15 <br>color 0a <br> <br>set length= <br>set height= a <br>Set Nitro= <br> <br>:Start <br>cls <br>echo Batch Streets V 0.0.1 <br>echo --------------------- <br>echo 1.New File <br>echo 2.Load File <br>echo 3.Exit <br>Set /p Start= <br>cls <br>if %Start% == 1 goto New <br>if %Start% == 2 goto Load <br>if %Start% == 3 Exit <br>goto Start <br> <br>:New <br>cls <br>echo Enter your name: <br>Set /p Name= <br>cls <br>echo Enter your Age: <br>Set /p Age= <br>cls <br>echo Set your Controls: <br>echo. <br>echo Up... <br>Set /p U= <br>echo. <br>echo Down... <br>Set /p D= <br>echo. <br>echo Left... <br>Set /p L= <br>echo. <br>echo Right... <br>Set /p R= <br>echo Nitro... <br>Set /p N= <br>cls <br>Set Money=50000 <br>Set P_Points=50 <br>echo Choose your car <br>echo. <br>echo Name: %Name% Money: %Money% <br>echo. <br>echo 1.@ $10000 <br>echo 2.# $20000 <br>echo 3.* $35000 <br>Set /p Car= <br>if %Car% == 1 Set Car=@ <br>if %Car% == 1 Set /a Money= %Money% - 10000 <br>if %Car% == 2 Set Car=# <br>if %Car% == 2 Set /a Money= %Money% - 20000 <br>if %Car% == 3 Set Car=* <br>if %Car% == 3 Set /a Money= %Money% - 35000 <br>cls <br>echo Controls Set... <br>Pause&gt;nul <br>goto controls <br> <br>:controls <br>cls <br>echo [ ] %Height% <br>for %%a in ( %height% ) do echo. <br>echo %length% %Car% <br>choice /c %U%%L%%D%%R%%N% /n &gt;nul <br>if %errorlevel% equ 1 call :up <br>if %errorlevel% equ 2 call :left <br>if %errorlevel% equ 3 call :down <br>if %errorlevel% equ 4 call :right <br>if %errorlevel% equ 5 call :Nitro <br>if %errorlevel% equ !height:~0,0! call :Carshop <br> <br>:left <br>cls <br>set length=%length:~0,-1% <br>goto controls <br> <br>:right <br>cls <br>set length=%length% <br>goto controls <br> <br>:up <br>cls <br>set height=%height:~0,-1% <br>goto controls <br> <br>:down <br>cls <br>set height=%height% a <br>goto controls <br> <br>:Nitro <br>cls <br>set length=%length% <br>goto controls <br> <br>:Carshop <br>cls <br>echo Name: %Name% Money: %Money% <br>echo. <br>echo 1.@ $10000 <br>echo 2.# $20000 <br>echo 3.* $35000 <br>Set /p Car= <br>if %Car% == 1 Set Car=@ <br>if %Car% == 1 Set /a Money= %Money% - 10000 <br>if %Car% == 2 Set Car=# <br>if %Car% == 2 Set /a Money= %Money% - 20000 <br>if %Car% == 3 Set Car=* <br>if %Car% == 3 Set /a Money= %Money% - 35000 <br>goto controls
<p>Prof please add me in facebook i need help :( please reply thank you :(</p>
<p>I would prefer it if we could communicate through the services provided by Instructables. If you need help, don't hesitate to message me with your problem and I'll see what I can do.</p>
Are you sure? I copied your fixed version of the code and &quot;Down&quot; and &quot;Right&quot; were working but &quot;Up&quot; and &quot;Left&quot; were not working. I'm wondering if it's the &quot;if %errorlevel% equ !height:~0,0! call :Carshop&quot; Part that is messing it up...
On my Computer (Windows 8) it works. That line of code does absolutely nothing and can be taken out with no penalty. Does your version of Windows support both the Choice and Errorlevel commands?
<p>This is not pong. I tried it, and I do not know what it is. All that it does is tell you to move your &quot;character with the WASD keys, the &quot;character does not not block anything (like there's anything to block). This is a fake code for what it is supposed to be.</p>
<p>its not supposed to be pong, its a tutorial on how to make a character move the pictures can be misleading but you should read the titles and the entire thing ^</p><p> |<br></p>
<p>IM SO CONFUSED!! every code tells me to put the choice part, but when I do, it says :choice is not recognized as an internal command, external command, batch file.....</p><p>HELP ME PLEASE!!!</p>
<p>Some versions of Windows do not come with the choice command. You can get it here (http://www.dynawell.com/de/support-de/resource-kit...</p><p>Chuck the file into your Windows\System32 folder and you should be good to go.</p>
<p>Thanks prof. pickle, but the website doesn't work. It says: this page may have been renamed or deleted or doesn't exist(something like that I cant remember exactly). I have windows 8 btw. Is there another site? I am trying to make a simple game.</p>
<p>IM SO CONFUSED!! every code tells me to put the choice part, but when I do, it says :choice is not recognized as an internal command, external command, batch file.....</p><p>HELP ME PLEASE!!!</p>
I copied the code exactly except my character cannot go left
<p>'choice' is not recognized as an internal or external command, operable program of batch file.</p><p>any help?</p>
<p>The CHOICE unfortunately does not come with all Windows operating systems, however, you can download it from here: http://hp.vector.co.jp/authors/VA007219/dkclonesup/choice.html</p>
<p>How would you put several colors on one line or atleast in one section of the batch file without changing ALL the words</p><p>like having Hello in gold then %username% in red or something, Please help!</p>

About This Instructable

66,572views

19favorites

License:

Bio: I enjoy anything to do with computers. I have made some interesting scripts, and I am constantly improving my skill set. One day I hope ... More »
More by Prof. Pickle:How to Create your own Commands with Batch Start a batch file completely hidden Tips on how to find errors in code (focused on DOS) 
Add instructable to: