How to make a batch game (For absolute beginners) 03-27-2013, 07:09 PM
#1
I am posting this as a basic tutorial for making batch games. Since they are fun to make
.
I will comment on all the commands, anything after a < is a comment.
@echo off < Most important part, forget this and it won't work.
title <what the game is named, in the top let corner.
color 0A < Gives you a green color, go to cmd and type color list to get all the combinations The 0 keeps the background black such as color 4A will make cmd red and green.
echo <Uses for what you want it to display, such as echo "Hi World" will display High World.
echo. <This commands only purpose is to create a break, or space similar to just hitting enter.
set /p var=Set Command: <Makes the next code I show you work
if %var%==1-9 goto menu1 <Enter 1-9 here, I will show an example below after I'm done with commands.
pause <Must be pust here after if %var% or else the game won't work. Pause stops the code from running it's corse
cls <clears the screen, usefull to use to avoid too much text on one page.
:exit <Makes an end point/command. Never put anywhere except for the last line of code
:menu <followed by any number, use it as template or the game. Anything there will be like the next slide or transition.
echo 1.)??? <This is the ideal format for the game, since it lets players know which number to hit per command.
Now an example run : I believe in teaching through example, so try editing the code after reading and testing it through.
.I will comment on all the commands, anything after a < is a comment.
@echo off < Most important part, forget this and it won't work.
title <what the game is named, in the top let corner.
color 0A < Gives you a green color, go to cmd and type color list to get all the combinations The 0 keeps the background black such as color 4A will make cmd red and green.
echo <Uses for what you want it to display, such as echo "Hi World" will display High World.
echo. <This commands only purpose is to create a break, or space similar to just hitting enter.
set /p var=Set Command: <Makes the next code I show you work
if %var%==1-9 goto menu1 <Enter 1-9 here, I will show an example below after I'm done with commands.
pause <Must be pust here after if %var% or else the game won't work. Pause stops the code from running it's corse
cls <clears the screen, usefull to use to avoid too much text on one page.
:exit <Makes an end point/command. Never put anywhere except for the last line of code
:menu <followed by any number, use it as template or the game. Anything there will be like the next slide or transition.
echo 1.)??? <This is the ideal format for the game, since it lets players know which number to hit per command.
Now an example run : I believe in teaching through example, so try editing the code after reading and testing it through.
Code:
@echo off
title My tutorial
color 0A
echo Welcome to my tut -Pinkleton-
echo.
echo Want to see how this really works?
echo.
echo Copy and Paste this code to a new .txt and then save it as BatTut.bat.
echo.
echo 1.) Begin Tut?
echo 2.) Exit Tut?
set /p var=Set Command:
if %var%==1 goto menu1
if %var%==2 goto exit
:menu1
cls
echo You have started the tut
pause
cls
echo Now I show you a 5way command that reverts back here
echo.
echo 1.) Start (Note that the reason for this is I plan on making a revert so you don't have to relaunch or reread)
set /p var=Set Command:
if %var%==1 goto menu2
pause
:menu2
cls
echo Go to a command that will put a word on here.
echo.
echo 1.) Say Cheese
echo 2.) Say Shit
echo 3.) Say Love
echo 4.) Say Forever Alone
echo 5.) Say WOW!
echo 6.) Ingore and exit tut
set /p var=Set Command:
if %var%==1 goto menu3
if %var%==2 goto menu4
if %var%==3 goto menu5
if %var%==4 goto menu6
if %var%==5 goto menu7
if %var%==6 goto exit
pause
:menu3
cls
echo Cheese
echo.
echo 1.) Return to other choices
set /p var=Set Command:
if %var%==1 goto menu2
pause
:menu4
cls
echo Shit
echo.
echo 1.) Return to other choices
set /p var=Set Command:
if %var%==1 goto menu2
pause
:menu5
cls
echo Love
echo.
echo 1.) Return to other choices
set /p var=Set Command:
if %var%==1 goto menu2
pause
:menu6
cls
echo Forever Alone
echo.
echo 1.) Return to other choices
set /p var=Set Command:
if %var%==1 goto menu2
pause
:menu7
cls
echo WOW!
echo.
echo 1.) Return to other choices
set /p var=Set Command:
if %var%==1 goto menu2
pause
:exitGoals:
Release at least one free product: ☑
Release a HQ tutorial: ☑
Release multiple HQ tutorials:☒
Help many users with problems relating to many fields:☒
Release at least one free product: ☑
Release a HQ tutorial: ☑
Release multiple HQ tutorials:☒
Help many users with problems relating to many fields:☒


![[+]](https://sinister.li/images/modern/collapse_collapsed.png)