I want to create a batch file rogue like, however I need to fix a slight problem. When the character walks into a wall ( # ) I want the character to go back a step, and that works, however I cannot get the batch script to recognise if the character has walked into a wall!
@echo off
set drive=%~dp0%
:start
echo %~dp0%
echo Set name
set /p file=">"
if not exist "%drive%Locations\%file%.bat" goto mdfile
set x=12
set y=15
goto level
:level
set loc=x%x%y%y%
set x%x%y%y%=a
call %drive%Locations\%file%.bat
if '%loc%'=='a' goto start
if '%loc%'=='0' echo Entered shop && pause && goto %dire%
if '%loc%'=='~' echo You are drowning && pause && goto boucle
goto boucle
:mdfile
call %~dp0%Locations\make.bat
set x=12
set y=15
goto level
:boucle
cls
echo.
call :map
echo.
echo %loc%
if '%%!x%x%y%y%!%%' == !#! (echo Equal) else (echo Not Equal)
echo q w e a s d ///// %let%
echo.
set loc=x%x%x%y%
choice /c qweasd /n >nul
if %errorlevel%==1 goto :savenum
if %errorlevel%==2 goto :up
if %errorlevel%==3 goto :savenuma
if %errorlevel%==4 goto :left
if %errorlevel%==5 goto :down
if %errorlevel%==6 goto :right
goto boucle
:map
%xay30%%xay30%%xay30%%xay30%%xay30%%xay30%%xay30%
echo %c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%
echo %c0c0%%x24y1%%x24y2%%x24y3%%x24y4%%x24y5%%x24y6%%x24y7%%x24y8%%x24y9%%x24y10%%x24y11%%x24y12%%x24y13%%x24y14%%x24y15%%x24y16%%x24y17%%x24y18%%x24y19%%x24y20%%x24y21%%x24y22%%x24y23%%x24y24%%x24y25%%x24y26%%x24y27%%x24y28%%x24y29%%x24y30%%c0c0%
echo %c0c0%%x23y1%%x23y2%%x23y3%%x23y4%%x23y5%%x23y6%%x23y7%%x23y8%%x23y9%%x23y10%%x23y11%%x23y12%%x23y13%%x23y14%%x23y15%%x23y16%%x23y17%%x23y18%%x23y19%%x23y20%%x23y21%%x23y22%%x23y23%%x23y24%%x23y25%%x23y26%%x23y27%%x23y28%%x23y29%%x23y30%%c0c0%
echo %c0c0%%x22y1%%x22y2%%x22y3%%x22y4%%x22y5%%x22y6%%x22y7%%x22y8%%x22y9%%x22y10%%x22y11%%x22y12%%x22y13%%x22y14%%x22y15%%x22y16%%x22y17%%x22y18%%x22y19%%x22y20%%x22y21%%x22y22%%x22y23%%x22y24%%x22y25%%x22y26%%x22y27%%x22y28%%x22y29%%x22y30%%c0c0%
echo %c0c0%%x21y1%%x21y2%%x21y3%%x21y4%%x21y5%%x21y6%%x21y7%%x21y8%%x21y9%%x21y10%%x21y11%%x21y12%%x21y13%%x21y14%%x21y15%%x21y16%%x21y17%%x21y18%%x21y19%%x21y20%%x21y21%%x21y22%%x21y23%%x21y24%%x21y25%%x21y26%%x21y27%%x21y28%%x21y29%%x21y30%%c0c0%
echo %c0c0%%x20y1%%x20y2%%x20y3%%x20y4%%x20y5%%x20y6%%x20y7%%x20y8%%x20y9%%x20y10%%x20y11%%x20y12%%x20y13%%x20y14%%x20y15%%x20y16%%x20y17%%x20y18%%x20y19%%x20y20%%x20y21%%x20y22%%x20y23%%x20y24%%x20y25%%x20y26%%x20y27%%x20y28%%x20y29%%x20y30%%c0c0%
echo %c0c0%%x19y1%%x19y2%%x19y3%%x19y4%%x19y5%%x19y6%%x19y7%%x19y8%%x19y9%%x19y10%%x19y11%%x19y12%%x19y13%%x19y14%%x19y15%%x19y16%%x19y17%%x19y18%%x19y19%%x19y20%%x19y21%%x19y22%%x19y23%%x19y24%%x19y25%%x19y26%%x19y27%%x19y28%%x19y29%%x19y30%%c0c0%
echo %c0c0%%x18y1%%x18y2%%x18y3%%x18y4%%x18y5%%x18y6%%x18y7%%x18y8%%x18y9%%x18y10%%x18y11%%x18y12%%x18y13%%x18y14%%x18y15%%x18y16%%x18y17%%x18y18%%x18y19%%x18y20%%x18y21%%x18y22%%x18y23%%x18y24%%x18y25%%x18y26%%x18y27%%x18y28%%x18y29%%x18y30%%c0c0%
echo %c0c0%%x17y1%%x17y2%%x17y3%%x17y4%%x17y5%%x17y6%%x17y7%%x17y8%%x17y9%%x17y10%%x17y11%%x17y12%%x17y13%%x17y14%%x17y15%%x17y16%%x17y17%%x17y18%%x17y19%%x17y20%%x17y21%%x17y22%%x17y23%%x17y24%%x17y25%%x17y26%%x17y27%%x17y28%%x17y29%%x17y30%%c0c0%
echo %c0c0%%x16y1%%x16y2%%x16y3%%x16y4%%x16y5%%x16y6%%x16y7%%x16y8%%x16y9%%x16y10%%x16y11%%x16y12%%x16y13%%x16y14%%x16y15%%x16y16%%x16y17%%x16y18%%x16y19%%x16y20%%x16y21%%x16y22%%x16y23%%x16y24%%x16y25%%x16y26%%x16y27%%x16y28%%x16y29%%x16y30%%c0c0%
echo %c0c0%%x15y1%%x15y2%%x15y3%%x15y4%%x15y5%%x15y6%%x15y7%%x15y8%%x15y9%%x15y10%%x15y11%%x15y12%%x15y13%%x15y14%%x15y15%%x15y16%%x15y17%%x15y18%%x15y19%%x15y20%%x15y21%%x15y22%%x15y23%%x15y24%%x15y25%%x15y26%%x15y27%%x15y28%%x15y29%%x15y30%%c0c0%
echo %c0c0%%x14y1%%x14y2%%x14y3%%x14y4%%x14y5%%x14y6%%x14y7%%x14y8%%x14y9%%x14y10%%x14y11%%x14y12%%x14y13%%x14y14%%x14y15%%x14y16%%x14y17%%x14y18%%x14y19%%x14y20%%x14y21%%x14y22%%x14y23%%x14y24%%x14y25%%x14y26%%x14y27%%x14y28%%x14y29%%x14y30%%c0c0%
echo %c0c0%%x13y1%%x13y2%%x13y3%%x13y4%%x13y5%%x13y6%%x13y7%%x13y8%%x13y9%%x13y10%%x13y11%%x13y12%%x13y13%%x13y14%%x13y15%%x13y16%%x13y17%%x13y18%%x13y19%%x13y20%%x13y21%%x13y22%%x13y23%%x13y24%%x13y25%%x13y26%%x13y27%%x13y28%%x13y29%%x13y30%%c0c0%
echo %c0c0%%x12y1%%x12y2%%x12y3%%x12y4%%x12y5%%x12y6%%x12y7%%x12y8%%x12y9%%x12y10%%x12y11%%x12y12%%x12y13%%x12y14%%x12y15%%x12y16%%x12y17%%x12y18%%x12y19%%x12y20%%x12y21%%x12y22%%x12y23%%x12y24%%x12y25%%x12y26%%x12y27%%x12y28%%x12y29%%x12y30%%c0c0%
echo %c0c0%%x11y1%%x11y2%%x11y3%%x11y4%%x11y5%%x11y6%%x11y7%%x11y8%%x11y9%%x11y10%%x11y11%%x11y12%%x11y13%%x11y14%%x11y15%%x11y16%%x11y17%%x11y18%%x11y19%%x11y20%%x11y21%%x11y22%%x11y23%%x11y24%%x11y25%%x11y26%%x11y27%%x11y28%%x11y29%%x11y30%%c0c0%
echo %c0c0%%x10y1%%x10y2%%x10y3%%x10y4%%x10y5%%x10y6%%x10y7%%x10y8%%x10y9%%x10y10%%x10y11%%x10y12%%x10y13%%x10y14%%x10y15%%x10y16%%x10y17%%x10y18%%x10y19%%x10y20%%x10y21%%x10y22%%x10y23%%x10y24%%x10y25%%x10y26%%x10y27%%x10y28%%x10y29%%x10y30%%c0c0%
echo %c0c0%%x9y1%%x9y2%%x9y3%%x9y4%%x9y5%%x9y6%%x9y7%%x9y8%%x9y9%%x9y10%%x9y11%%x9y12%%x9y13%%x9y14%%x9y15%%x9y16%%x9y17%%x9y18%%x9y19%%x9y20%%x9y21%%x9y22%%x9y23%%x9y24%%x9y25%%x9y26%%x9y27%%x9y28%%x9y29%%x9y30%%c0c0%
echo %c0c0%%x8y1%%x8y2%%x8y3%%x8y4%%x8y5%%x8y6%%x8y7%%x8y8%%x8y9%%x8y10%%x8y11%%x8y12%%x8y13%%x8y14%%x8y15%%x8y16%%x8y17%%x8y18%%x8y19%%x8y20%%x8y21%%x8y22%%x8y23%%x8y24%%x8y25%%x8y26%%x8y27%%x8y28%%x8y29%%x8y30%%c0c0%
echo %c0c0%%x7y1%%x7y2%%x7y3%%x7y4%%x7y5%%x7y6%%x7y7%%x7y8%%x7y9%%x7y10%%x7y11%%x7y12%%x7y13%%x7y14%%x7y15%%x7y16%%x7y17%%x7y18%%x7y19%%x7y20%%x7y21%%x7y22%%x7y23%%x7y24%%x7y25%%x7y26%%x7y27%%x7y28%%x7y29%%x7y30%%c0c0%
echo %c0c0%%x6y1%%x6y2%%x6y3%%x6y4%%x6y5%%x6y6%%x6y7%%x6y8%%x6y9%%x6y10%%x6y11%%x6y12%%x6y13%%x6y14%%x6y15%%x6y16%%x6y17%%x6y18%%x6y19%%x6y20%%x6y21%%x6y22%%x6y23%%x6y24%%x6y25%%x6y26%%x6y27%%x6y28%%x6y29%%x6y30%%c0c0%
echo %c0c0%%x5y1%%x5y2%%x5y3%%x5y4%%x5y5%%x5y6%%x5y7%%x5y8%%x5y9%%x5y10%%x5y11%%x5y12%%x5y13%%x5y14%%x5y15%%x5y16%%x5y17%%x5y18%%x5y19%%x5y20%%x5y21%%x5y22%%x5y23%%x5y24%%x5y25%%x5y26%%x5y27%%x5y28%%x5y29%%x5y30%%c0c0%
echo %c0c0%%x4y1%%x4y2%%x4y3%%x4y4%%x4y5%%x4y6%%x4y7%%x4y8%%x4y9%%x4y10%%x4y11%%x4y12%%x4y13%%x4y14%%x4y15%%x4y16%%x4y17%%x4y18%%x4y19%%x4y20%%x4y21%%x4y22%%x4y23%%x4y24%%x4y25%%x4y26%%x4y27%%x4y28%%x4y29%%x4y30%%c0c0%
echo %c0c0%%x3y1%%x3y2%%x3y3%%x3y4%%x3y5%%x3y6%%x3y7%%x3y8%%x3y9%%x3y10%%x3y11%%x3y12%%x3y13%%x3y14%%x3y15%%x3y16%%x3y17%%x3y18%%x3y19%%x3y20%%x3y21%%x3y22%%x3y23%%x3y24%%x3y25%%x3y26%%x3y27%%x3y28%%x3y29%%x3y30%%c0c0%
echo %c0c0%%x2y1%%x2y2%%x2y3%%x2y4%%x2y5%%x2y6%%x2y7%%x2y8%%x2y9%%x2y10%%x2y11%%x2y12%%x2y13%%x2y14%%x2y15%%x2y16%%x2y17%%x2y18%%x2y19%%x2y20%%x2y21%%x2y22%%x2y23%%x2y24%%x2y25%%x2y26%%x2y27%%x2y28%%x2y29%%x2y30%%c0c0%
echo %c0c0%%x1y1%%x1y2%%x1y3%%x1y4%%x1y5%%x1y6%%x1y7%%x1y8%%x1y9%%x1y10%%x1y11%%x1y12%%x1y13%%x1y14%%x1y15%%x1y16%%x1y17%%x1y18%%x1y19%%x1y20%%x1y21%%x1y22%%x1y23%%x1y24%%x1y25%%x1y26%%x1y27%%x1y28%%x1y29%%x1y30%%c0c0%
echo %c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%%c0c0%
goto :eof
:LEFT
if '%y%'=='1' goto selecmap
set dire=right
set /a y=%y% - 1
set x%x%y%y%=a
goto level
:RIGHT
if '%y%'=='30' goto selecmap
set dire=left
set /a y=%y% + 1
set x%x%y%y%=a
goto level
:UP
if '%x%'=='24' goto selecmap
set dire=down
set /a x=%x% + 1
set x%x%y%y%=a
goto level
:DOWN
if '%x%'=='1' goto selecmap
set dire=up
set /a x=%x% - 1
set x%x%y%y%=a
goto level
:selecmap
goto boucle
set /p =
goto level
Essentially, the call :level command calls the set x1y1=. all the way through to set x24y30=. . This is the way the map is refreshed. after that, there is set x%x%y%y%=a to show the avatar. The walls are set after that line. I want the batch script to recognise it has walked into a wall because the avatar is not set to a, but rather the avatar is # instead. then it would goto :dire and reset where the avatar is. any help?
Aucun commentaire:
Enregistrer un commentaire