• Register

Learn to Batch script like a pro! Uploading tutorials everyday (hopefully) I will teach you the basics, the intermediates and the Hard codes required to make epic batch scripts. Don't make just games with batch scripting, but also commands that you can modify at will to take control of your computer! MUAHAHAHAHA!

Post news Report RSS Basics to understand - Part 1 -

We will start bath scripting with the basics! you need to know every command in order to use them properly, can't just copy and paste from websites! But i'll teach you the script ways. Join the Script side. Be pro! Part 2 will be released soon enough. be patient! x3 And sorry the tutorials are long like this one, why do you think I made it more than 1 part?

Posted by on

Welcome fellow coders, I am Jacob.
I will be teaching you the basic codes required to make good batch scripts.
Be sure to follow me on IndieDB to read more tutorials on Batch Scripting!

You might be wondering why batch scripting relates to games on IndieDB?
When you become pro at scripting, you can create your own codes in any order you want,
you can even make games... Yep! (I post the code for a game I made at the end of this tutorial) ;)

Let's begin with the basics:

@echo off

This command is something you always type in FIRST when scripting.
It hides all of the commands used to show what is shown, so when you use the echo command, it just shows what's after the echo
not including the actual echo. Here is what it should look like:


@echo off

#####

#####

echo Yo what up!

#####


In the actual batch, it will look like this:


Yo what up!


If you didn't put the @echo off it will look like this in the batch:


#####

#####

echo Yo what's up!

#####


Get it? Good.
So @echo off hides all of the commands used in the batch script.

Next:
cls is a command the clears the batch off everything before cls is used
Example In the script:

@echo off

echo yo what's up?

cls
echo how are you doing?

######


it will look like this in the batch after the cls code:


how are you doing?


Yep, it removes the previous text before the cls code.
this is what it looks like without the cls code:


yo what's up?


how are you doing?


x3 I'm going to split this into 2 parts, considering I am not done yet with the basics, you might not want to read a lot...
but then again, you want to learn how to code, you'll just have to read tutorials! But if you really want, I can upload videos
explaining things easier with better examples! YAY! but only if this gets lots of support.
and as I promised, a scripted game! I am still developing it now and it will be big, but I finished the demo and will continue!
here you go: (also, copy this code into a notepad document and save it as gameplay1.bat NMUST DO DIS! I would recommend it!


@echo off

title Survive The Monster thing.

color 0e

:Reminder
cls
echo.
echo Remember
echo.
echo When you are given choices,
echo.
echo type in numbers according to the order of the choices you are given
echo.
ping -n 6 localhost>nul
echo.
echo For example:
echo.
echo Either be awesome or don't be awesome
echo.
ping -n 6 localhost>nul
echo.
echo It would be (1) Be awesome or (2) Don't be awesome
echo.
echo get it?
echo.
ping -n 6 localhost>nul
echo.
echo If you didn't get it, then just read through this again.
echo.
ping -n 6 localhost>nul
echo.
echo Start Game or Restart Reminder?
echo.
ping -n 6 localhost>nul
set /p input8=What do you want to do?
if %input8%==1 goto loading
if %input8%==2 goto Reminder
goto Reminder2

:Reminder2
cls
echo.
echo My god, read this carefully!
echo.
ping -n 5 localhost>nul
echo.
echo WHen given a choice, type in the number coresponding to the order of the choices given.
echo.
ping -n 6 localhost>nul
cls
echo.
echo Like this:
echo.
echo Either Be awesome or Don't be awesome.
echo.
ping -n 7 localhost>nul
echo.
echo What do you do? -->
echo.
ping -n 5 localhost>nul
cls
echo.
echo Like this:
echo.
echo Either be awesome or Don't be awesome.
echo.
echo.
echo What do you do? --> 1
echo.
ping -n 6 localhost>nul
echo.
echo I just picked 'Be awesome'.
echo.
echo Now do you get it?
echo.
ping -n 5 localhost>nul
echo.
echo Yes or no?
echo.
set /p input21=You should understand now -->
if %input21%==1 goto yay
if %input21%==2 goto aww
goto aww

:yay
echo.
echo YAY!
echo.
ping -n 4 localhost>nul
echo.
echo STRAIGHT TO GAMEPLAY FROM HERE! :D
echo.
ping -n 5 localhost>nul
goto loading

:aww
echo.
echo ... You'll understand eventually
echo.
ping -n 4 localhost>nul
goto loading


:loading
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo Loading.
echo --------------------------------------
echo
echo --------------------------------------
ping -n 2 localhost>nul
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo Loading..
echo --------------------------------------
echo []
echo --------------------------------------
ping -n 2 localhost>nul
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo Loading...
echo --------------------------------------
echo [][]
echo --------------------------------------
ping -n 2 localhost>nul
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo Loading....
echo --------------------------------------
echo [][][]
echo --------------------------------------
ping -n 2 localhost>nul
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo Loading.
echo --------------------------------------
echo [][][][]
echo --------------------------------------
ping -n 2 localhost>nul
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo Loading..
echo --------------------------------------
echo [][][][][]
echo --------------------------------------
ping -n 2 localhost>nul
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo Loading...
echo --------------------------------------
echo [][][][][][]
echo --------------------------------------
ping -n 2 localhost>nul
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo Loading....
echo --------------------------------------
echo [][][][][][][]
echo --------------------------------------
ping -n 2 localhost>nul
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo Loading.
echo --------------------------------------
echo [][][][][][][][]
echo --------------------------------------
ping -n 2 localhost>nul
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo Loading..
echo --------------------------------------
echo [][][][][][][][][]
echo --------------------------------------
ping -n 2 localhost>nul
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo Loading...
echo --------------------------------------
echo [][][][][][][][][][]
echo --------------------------------------
ping -n 2 localhost>nul
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo Loading....
echo --------------------------------------
echo [][][][][][][][][][][]
echo --------------------------------------
ping -n 2 localhost>nul
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo Loading.
echo --------------------------------------
echo [][][][][][][][][][][][]
echo --------------------------------------
ping -n 2 localhost>nul
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo Loading..
echo --------------------------------------
echo [][][][][][][][][][][][][][]
echo --------------------------------------
ping -n 2 localhost>nul
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo Loading...
echo --------------------------------------
echo [][][][][][][][][][][][][][][]
echo --------------------------------------
ping -n 2 localhost>nul
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo Loading....
echo --------------------------------------
echo [][][][][][][][][][][][][][][][]
echo --------------------------------------
ping -n 2 localhost>nul
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo Loading.
echo --------------------------------------
echo [][][][][][][][][][][][][][][][][]
echo --------------------------------------
ping -n 2 localhost>nul
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo Loading..
echo --------------------------------------
echo [][][][][][][][][][][][][][][][][][]
echo --------------------------------------
ping -n 2 localhost>nul
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo Loading...
echo --------------------------------------
echo [][][][][][][][][][][][][][][][][][][]
echo --------------------------------------
ping -n 2 localhost>nul
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo Loading....
echo --------------------------------------
echo [][][][][][][][][][][][][][][][][][][]
echo --------------------------------------
ping -n 2 localhost>nul
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo Loading.
echo --------------------------------------
echo [][][][][][][][][][][][][][][][][][][]
echo --------------------------------------
ping -n 2 localhost>nul
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo Loading..
echo --------------------------------------
echo [][][][][][][][][][][][][][][][][][][]
echo --------------------------------------
ping -n 2 localhost>nul
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo Loading...
echo --------------------------------------
echo [][][][][][][][][][][][][][][][][][][]
echo --------------------------------------
ping -n 2 localhost>nul
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo Loading....
echo --------------------------------------
echo [][][][][][][][][][][][][][][][][][][]
echo --------------------------------------
ping -n 2 localhost>nul
goto start

:start
cls
echo You wake up in a room.
echo.
ping -n 4 localhost>nul
echo.
echo You sit up to see a figure standing over you.
echo.
ping -n 4 localhost>nul
echo.
echo Do you attack the mysterious figure above(1) you or do you wake up fully to see the figure(2)?
set input=
set /p input=Enter chosen number:
if %input%==1 goto attack
if %input%==2 goto investigate
goto donothing

:attack
cls
echo.
echo You throw a weak fist at the figure.
echo Did you hit?
echo.
set /a hand=%random% %% 3
if %hand%==0 goto hit
if %hand%==1 goto miss
if %hand%==2 goto miss
if %hand%==3 goto miss
goto miss

:hit
cls
echo.
echo You hit.
echo.
ping -n 5 localhost>nul
echo.
echo You regain complete vision and realize you hit your younger brother smack in the face.
echo.
ping -n 5 localhost>nul
goto brotherhit

:miss
cls
echo.
echo You missed
echo.
ping -n 5 localhost>nul
echo.
echo You regain complete vision and see you missed your younger brother.
echo.
ping -n 5 localhost>nul
goto brothermiss

:investigate
cls
echo.
echo You regain vision and you see that your younger brother is standing over you.
echo.
ping -n 5 localhost>nul
echo.
echo You get out of bed by force of your brother.
echo.
ping -n 5 localhost>nul
echo.
echo 1) Leave Room
echo.
echo 2) Get changed
echo.
echo 3) Go back to sleep
echo.
set /p input1=Select option:
if %input1%==1 goto leaveroom1
if %input1%==2 goto getchanged1
if %input1%==3 goto sleepin1
goto sleepin1

:brotherhit
cls
echo.
echo Your brother leaves the room crying and you fall back to sleep.
echo.
ping -n 5 localhost>nul
echo.
echo You wake up many hours later and get out of bed.
echo.
ping -n 5 localhost>nul
echo.
echo 1) Leave Room
echo.
echo 2) Get dressed
echo.
set /p input3=What do you do?
if %input3%==1 goto leaveroom2
if %input3%==2 goto getchanged2
goto leaveroom2

:brothermiss
cls
echo.
echo You miss your brother and he gets a really shocked expression on his face
echo.
ping -n 5 localhost>nul
echo.
echo He then forces you up out of bed.
echo.
ping -n 5 localhost>nul
echo.
echo 1) leave room
echo.
echo 2) Get dressed
echo.
echo 3) Go back to sleep
echo.
ping -n 5 localhost>nul
set /p input4=What do you do?
if %input4%==1 goto leaveroom1
if %input4%==2 goto getchanged1
if %input4%==3 goto sleepin1
goto sleepin1

:sleepin1
cls
echo.
echo You wake up many hours later.
echo.
ping -n 5 localhost>nul
echo.
echo 1) Leave room
echo.
echo 2) Get dressed
echo.
ping -n 5 localhost>nul
echo.
set /p input5=What do you do?
if %input5%==1 goto leaveroom2
if %input5%==2 goto getchanged2
goto leaveroom2

:leaveroom1
cls
echo.
echo Still early in the morning, you realize that it's
echo.
ping -n 5 localhost>nul
echo.
echo CHRISTMAS EVE!
echo.
ping -n 5 localhost>nul
echo.
echo You go to the kitchen to eat breakfast.
echo.
echo Your younger brother is bouncing around the house like a lunatic.
echo.
ping -n 5 localhost>nul
echo.
echo Do you calm him down or leave him alone?
set /p input6=Do you do something to stop your brother?
if %input6%==1 goto happyparents1
if %input6%==2 goto annoyedparents1
goto annoyedparents1

:happyparents1
cls
echo.
echo You shut your brother up before your parents woke up.
echo.
ping -n 5 localhost>nul
echo.
echo You are safe from your parents, but your brother is annoyed.
echo.
ping -n 5 localhost>nul
echo.
echo You play with your Brother before you leave to go shopping.
echo.
ping -n 5 localhost>nul
goto later1

:annoyedparents1
cls
echo.
echo You leave your brother alone and only minutes later...
echo.
ping -n 5 localhost>nul
echo.
echo YOUR PARENTS COME DOWN IN A MIGHTY RAGE!
echo.
ping -n 5 localhost>nul
echo.
echo You get into trouble with your brother.
echo.
echo You play quietly with your brother until you have to go shopping.
echo.
ping -n 6 localhost>nul
goto later1

:leaveroom2
cls
echo.
echo You leave your room, It's about 1:24 pm
echo.
ping -n 5 localhost>nul
echo.
echo You can't hear anyone.
echo.
echo You are home alone.
echo.
ping -n 5 localhost>nul
echo.
echo You watch Pewdiepie for hours on Youtube.
echo.
ping -n 6 localhost>nul
goto later1


:getchanged1
cls
echo.
echo You get changed and leave your room.
echo.
ping -n 5 localhost>nul
goto leaveroom1

:getchanged2
cls
echo.
echo You get changed and leave your room.
echo.
ping -n 5 localhost>nul
goto leaveroom2

:later1
cls
echo.
echo Coming close to evening, You are getting ready to go to bed after the day you had.
echo.
echo You go to bed.
ping -n 8 localhost>nul
goto loading2

:loading2
cls
echo.
echo.
echo.
echo _______ _______ ___ ___ _________
echo | | | | |\ | | / \ | | |
echo | |_____| |_____ | \ | | | __ |_____| |
echo | | | | | \ | | | | | | |
echo | | | |_______ | \| _|_ \___/ | | |
echo.
ping -n 5 localhost>nul
cls
echo.
echo.
echo.
echo _______ _______ ___ ___ _________
echo | | | | |\ | | / \ | | |
echo | |_____| |_____ | \ | | | __ |_____| |
echo | | | | | \ | | | | | | |
echo | | | |_______ | \| _|_ \___/ | | |
echo.
echo.
echo ____ ____ ____ ___ _____ ____
echo | | /\ / \ /\ | \ | \ | \ / | | \
echo |______| | | \____ | | |____/ |____/ | \ / |____ | |
echo | | /____\ \ /____\ |\_ |\_ | \ / | | |
echo | | | | \____/ | | | \_ | \_ _|_ \/ |_____ |____/
echo.
ping -n 6 localhost>nul
goto loading22

:loading22
cls
echo END OF DEMO!
echo.
echo Lol, soz tho.
ping -n 5 localhost>nul
msg * You better like the game! :D
msg * Because I will release the full thing eventually, this game is big.
msg * Plus, I will add a code that will make it so you only need to download the GameMenu.bat
msg * lel
pause
ping -n 2 localhost>nul
cls
echo and thx for reading my tutorial on IndieDB! cause this is where it where came from
echo.
echo © 2015 Jacob Murray all scripting and ideas belong to Jacob Murray and no one else.
echo.
echo I am allowing use of this game to anyone as long as you don't claim any work for it yourself.
echo.
echo HAVE A GREAT DAY!
echo.
pause
exit


(don't copy here)
That's the code for a great game, and as you can see if you look here, I added some legal copyright stuff.
so don't even think about it! Have a great day!
I will post regularly if you want more tutorials!
cya!

Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: