How to add a break in a batch code
Posted: 19 Jun 2015 05:40
Hi just asking how to make batch not automatically move on to the next line. Example.
This is a game where you act as a teacher and you go around finding students who are playing games. For example i click on 'north' and it reacts as normal. when everything gets to the end, it automatically jumps to 'east'. is there someway i can place a break in between these choices. Thanks
@echo off
echo Welcome to my adventure game where you catch students playing games.
echo.
:menu
cls
echo Choose an action
echo.
echo Move North - N
echo Move East - E
echo Move South - S
echo Move West - W
pause
SET /P M=
IF %M%==N GOTO North
IF %M%==E GOTO East
IF %M%==S GOTO South
IF %M%==W GOTO West
:North
cls
echo You have chosen to venture North
set /a a =%random% %% 3
goto :ChoiceN%a%
cls
:ChoiceN0
cls
echo You caught troll playing games
ping 192.0.2.2 -n 1 -w 2000 > nul
echo What will you do?
echo.
echo Educate
echo Flee
SET /P Q=
IF %Q%==Educate GOTO educate
IF %Q%==educate GOTO educate
IF %Q%==Flee GOTO Menu
IF %Q%==flee GOTO Menu
pause
:ChoiceN1
cls
echo You caught Lion playing games
ping 192.0.2.2 -n 1 -w 2000 > nul
echo What will you do?
echo.
echo Educate
echo Flee
SET /P W=
IF %W%==Educate GOTO educate
IF %W%==educate GOTO educate
IF %W%==Flee GOTO Menu
IF %W%==flee GOTO Menu
pause
:ChoiceN2
cls
echo You caught John playing games
ping 192.0.2.2 -n 1 -w 2000 > nul
echo What will you do?
echo.
echo Educate
echo Flee
SET /P E=
IF %E%==Educate GOTO educate
IF %E%==educate GOTO educate
IF %E%==Flee GOTO Menu
IF %E%==flee GOTO Menu
pause
:ChoiceN3
cls
echo You caught Bob playing games
ping 192.0.2.2 -n 1 -w 2000 > nul
echo What will you do?
echo.
echo Educate
echo Flee
SET /P R=
IF %R%==Educate GOTO educate
IF %R%==educate GOTO educate
IF %R%==Flee GOTO Menu
IF %R%==flee GOTO Menu
pause
:East
cls
echo You have chose to venture East
pause
set /a b =%random% %% 3
goto :ChoiceE%b%
:educate
cls
echo You educated the student
ping 192.0.2.2 -n 1 -w 2000 > nul
echo The student replied back with lies
ping 192.0.2.2 -n 1 -w 1000 > nul
echo You shout at the student for lieing.
ping 192.0.2.2 -n 1 -w 1000 > nul
echo The student has lost confididince in playing games again
ping 192.0.2.2 -n 1 -w 3000 > nul
pause
goto menu
This is a game where you act as a teacher and you go around finding students who are playing games. For example i click on 'north' and it reacts as normal. when everything gets to the end, it automatically jumps to 'east'. is there someway i can place a break in between these choices. Thanks
@echo off
echo Welcome to my adventure game where you catch students playing games.
echo.
:menu
cls
echo Choose an action
echo.
echo Move North - N
echo Move East - E
echo Move South - S
echo Move West - W
pause
SET /P M=
IF %M%==N GOTO North
IF %M%==E GOTO East
IF %M%==S GOTO South
IF %M%==W GOTO West
:North
cls
echo You have chosen to venture North
set /a a =%random% %% 3
goto :ChoiceN%a%
cls
:ChoiceN0
cls
echo You caught troll playing games
ping 192.0.2.2 -n 1 -w 2000 > nul
echo What will you do?
echo.
echo Educate
echo Flee
SET /P Q=
IF %Q%==Educate GOTO educate
IF %Q%==educate GOTO educate
IF %Q%==Flee GOTO Menu
IF %Q%==flee GOTO Menu
pause
:ChoiceN1
cls
echo You caught Lion playing games
ping 192.0.2.2 -n 1 -w 2000 > nul
echo What will you do?
echo.
echo Educate
echo Flee
SET /P W=
IF %W%==Educate GOTO educate
IF %W%==educate GOTO educate
IF %W%==Flee GOTO Menu
IF %W%==flee GOTO Menu
pause
:ChoiceN2
cls
echo You caught John playing games
ping 192.0.2.2 -n 1 -w 2000 > nul
echo What will you do?
echo.
echo Educate
echo Flee
SET /P E=
IF %E%==Educate GOTO educate
IF %E%==educate GOTO educate
IF %E%==Flee GOTO Menu
IF %E%==flee GOTO Menu
pause
:ChoiceN3
cls
echo You caught Bob playing games
ping 192.0.2.2 -n 1 -w 2000 > nul
echo What will you do?
echo.
echo Educate
echo Flee
SET /P R=
IF %R%==Educate GOTO educate
IF %R%==educate GOTO educate
IF %R%==Flee GOTO Menu
IF %R%==flee GOTO Menu
pause
:East
cls
echo You have chose to venture East
pause
set /a b =%random% %% 3
goto :ChoiceE%b%
:educate
cls
echo You educated the student
ping 192.0.2.2 -n 1 -w 2000 > nul
echo The student replied back with lies
ping 192.0.2.2 -n 1 -w 1000 > nul
echo You shout at the student for lieing.
ping 192.0.2.2 -n 1 -w 1000 > nul
echo The student has lost confididince in playing games again
ping 192.0.2.2 -n 1 -w 3000 > nul
pause
goto menu