Login Register






How to make a batch game (For absolute beginners) filter_list
Author
Message
How to make a batch game (For absolute beginners) #1
I am posting this as a basic tutorial for making batch games. Since they are fun to make Smile.

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 :exit
Goals:
Release at least one free product:
Release a HQ tutorial:
Release multiple HQ tutorials:
Help many users with problems relating to many fields:

Reply

RE: How to make a batch game (For absolute beginners) #2
Instead of goto exit, why not just exit?

Code:
if %var%==1 goto menu1 if %var%==2 goto exit :menu1

Also, for instance here, if it is neither 1 or 2, it will still go to :menu1. Which may be undesired.
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]

Reply

RE: How to make a batch game (For absolute beginners) #3
Instead of goto exit, why not just exit?

Code:
if %var%==1 goto menu1 if %var%==2 goto exit :menu1

Also, for instance here, if it is neither 1 or 2, it will still go to :menu1. Which may be undesired.
ArkPhaze
"Object oriented way to get rich? Inheritance"
Getting Started: C/C++ | Common Mistakes
[ Assembly / C++ / .NET / Haskell / J Programmer ]

Reply

RE: How to make a batch game (For absolute beginners) #4
(03-30-2013, 03:37 AM)ArkPhaze Wrote: Instead of goto exit, why not just exit?

Code:
if %var%==1 goto menu1 if %var%==2 goto exit :menu1

Also, for instance here, if it is neither 1 or 2, it will still go to :menu1. Which may be undesired.

The guy is right! wouldn't be better:
Code:
:start if %var%==1 goto menu1 if %var%==2 exit echo %var% is not a valid choice. < nul set /p pause=Press any key... Pause > nul goto start :menu1
?
My Bitcoin address: 1AtxVsSSG2Z8JfjNy9KNFDUN6haeKr7LiP
Give me money by visiting www.google.com here: http://coin-ads.com/6Ol83U

If you want a Bitcoin URL shortener/advertiser, please, use this referral: http://coin-ads.com/register.php?refid=noize

Reply

RE: How to make a batch game (For absolute beginners) #5
(03-30-2013, 03:37 AM)ArkPhaze Wrote: Instead of goto exit, why not just exit?

Code:
if %var%==1 goto menu1 if %var%==2 goto exit :menu1

Also, for instance here, if it is neither 1 or 2, it will still go to :menu1. Which may be undesired.

The guy is right! wouldn't be better:
Code:
:start if %var%==1 goto menu1 if %var%==2 exit echo %var% is not a valid choice. < nul set /p pause=Press any key... Pause > nul goto start :menu1
?
My Bitcoin address: 1AtxVsSSG2Z8JfjNy9KNFDUN6haeKr7LiP
Give me money by visiting www.google.com here: http://coin-ads.com/6Ol83U

If you want a Bitcoin URL shortener/advertiser, please, use this referral: http://coin-ads.com/register.php?refid=noize

Reply

RE: How to make a batch game (For absolute beginners) #6
(06-24-2013, 11:11 PM)ANONYMOUSxHACKS Wrote: could you help me??

Try saying what you need.
My Bitcoin address: 1AtxVsSSG2Z8JfjNy9KNFDUN6haeKr7LiP
Give me money by visiting www.google.com here: http://coin-ads.com/6Ol83U

If you want a Bitcoin URL shortener/advertiser, please, use this referral: http://coin-ads.com/register.php?refid=noize

Reply