Best 5 Game in Notepad Batch Scripting

Welcome to another Batch Scripting Post By CYBER GEEK. Today we are going to make a game.
Did you recognize that the straightforward Notepad program on your computer is really a really powerful programming tool? That’s right, and it’s also very easy to find out . during this article I’m getting to show you ways to form an easy game using only the Notepad program and a programing language called “Batch.”

Batch may be a language that runs primarily out of your Windows prompt . Now, it isn’t even on the brink of being the foremost powerful programing language out there, but it still let’s you are doing enough to be extremely useful to understand (at least for anyone within the computer field).Batch Scripting

Not only is it useful, but it also can be wont to create amazing text-based games! what’s a text-based game you ask? it is a game (a very simple one) during which the utilization r interacts through the use of text and choice-making.You will find out how to line up situations during which the characters will need to make choices about how they need to approach the matter .

Important Points

I want to travel over a couple of quick things before we get in to the particular code. the primary thing is that each one of your commands should be kept on separate lines. So after you type something in, and are through with what’s getting to get on that line, hit the “enter” button on your keyboard to maneuver to subsequent line.Batch Scripting

Best Game in Notepad | Batch Scripting
Game Script
The second thing i would like to say is that batch files read from top to bottom. this suggests that once you run a batch file, all of your code at the highest are going to be interpreted and can run before your code at rock bottom . this idea is what allows a number of the items I’m getting to teach you, to work. If for instance you place a “echo” command and within the next line place a “cls” command, all of your text are going to be erased without your player going to read it (this will make more sense later on).
If you ever have a drag and your game isn’t working correctly, confirm you return and make sure that you haven’t made any of those errors.

Open your Notepad

Let’s start by opening up Notepad:
Click on your start menu icon and attend “All Programs.” an inventory of all the programs on your computer should appear, along side a file called “Accessories.” enter to the accessories folder and you ought to find Notepad, click there on to start .

Code Explanation

Now you’re able to begin typing your first lines of code, also as learning you initially commands. Commands are each of the words that we type in to the program that have a function; like the echo, or pause commands.
Batch Scripting

@echo off, echo, echo. and pause

The first commands I’m getting to teach you’re very simple, however, they play a crucial part within the coding process (especially if you are making a game!).
  • @echo off This command is employed to get rid of all of the unnecessary text which will interfere together with your game. It should be added first; once it’s added to a file, it doesn’t need to be typed in again.

  • echo echo is employed to display regular text in your game. for instance you’ll type: “echo Hello adventurer!”, and therefore the people playing your game will see is “Hello adventurer!” (So long as you typed in @echo off).
  • echo. – echo. (with a period) is employed to make a blank line in your game. this will be useful keep your text uncluttered.
  • pause – This command is employed once you want your players to require an opportunity , and is employed most frequently once you want to offer them time to read some text. once you use this code it shows up as “Press any key to continue . . .” Your players can then press any key, once they are ready, so as to continue playing.

cls, exit, title, and color

Ok, this next set of commands are all really simple also , but are nice to possess .
  • cls – cls may be a command that i exploit tons . It stands for “clear screen”, and what it does is take away all of the text that has been made within the prompt window (ergo, making the screen blank). this is often an honest tool once you want to stay your game looking clean and so as .
  • exit – This does exactly what it seems like , it closes the sport . you ought to only use this when the characters reach the top of the sport , or if you would like the sport to shut once they die or make a wrong decision.
  • title – title displays whatever you type after it within the title bar of the prompt window.
  • color – color may be a really fun command, and may be wont to enliven your game. once you add the colour code, followed by an area and a selected set of numbers or letter, you’ll change the colours of the prompt window. For an inventory of the available colors see the image below or open up the prompt and sort in “color/?”

You can access the prompt by going back in to the accessories folder within the start menu. It should be within the same list as Notepad.

Batch Scripting

Let’s Sum up what we have learn till now

Let’s stop for a second and appearance at what we’ve thus far . I’ve shown you many basic commands, and have taught you ways to use them. Remember that every command should continue a special line (so hit “enter” after you finish with each command). Take a glance at the image to the proper , in order that way you’ll make certain that you simply realize what your file should appear as if .
The “goto” command is straightforward , once you get to understand it. The command is employed once you need a player to leap to a special section of your game, like once they make a particular decision.
It works this way:
You enter the “goto” command on a separate line, or at the top of an “if” statement (which we’ll re-evaluate later). You then specify a variable which can become the name of the destination. The name are often anything you would like , and consists of the word(s) you type after “goto”.
To specify your destination:
Move to a replacement line of code, directly above where you would like your player to start out . A colon ‘:’ followed by the name of the destination.
set /p and if
These commands are the foremost advanced commands that i’m getting to teach you. They both need to be found out a selected way and also work with several other, smaller commands so as to function correctly.
  • set /p variable= This command is employed once you want your player to insert a variable (a varying answer). this might be anywhere from their name to the name of a weapon or maybe the solution to at least one of the alternatives you’ve got given them. Often times this variable are going to be referenced later, and thus must tend a reputation . The name are often whatever you would like it to be (but remember that you simply could also be typing it during a lot when making your game). i feel it might be easiest if I gave you some pictures showing you ways to make variables.

See how i exploit the “echo” command to ask my player what his name is? I then plow ahead and type:

  • set /p name= –This is where my player will type his name. “name” during this line is my variable. during a sense what we do is setting (set) a variable (name) to equal (=) regardless of the user types.

We can reference this variable later by placing the name of the variable within two of the ‘%’ symbols. 

For example:
echo Hello %name%, my name is Tonny.

This will feed regardless of the player typed in, back to him within the sort of text.

  • if this command is employed once we create if/then statements. we will use it in conjunction with “set /p” so as to make choices for are players.
    • Ask the player an issue with the “echo” command. confirm to obviously state their options.
    • Give them the power to enter a solution with the “set /p” command.
    • Create “if” statements that allow the players’ choices to possess consequences, which allow the story to continue.
“if” statements are used with “equ” and “neq” which mean “equals” and “doesn’t equal”, respectively.
This is how your statements should look:
Batch Scripting
echo YES or NO?
set /p variable=
if %variable% equ YES goto situation 1
if %variable% equ NO goto situation 2
if %variable neq YES goto start
All of this code means if the player types in “YES” he are going to be sent to “situation 1”; if he types in “NO” he are going to be sent to “situation 2”; if he types in neither “YES” or “NO” he are going to be sent back to the beginning of the question.
Remember once I said earlier that the order you write your code matters? If you typed within the “neq YES” code before the “equ NO” code, your player would never be ready to make it to “situation 2”.

Batch Scripting
Working Game Script


The last item i want to point out you ways to try to to is to save lots of your file. Once you’re all done, click the “file” button at the highest of the screen, then click on “Save As.” this may display a window where you’ll then create a reputation for you game and reserve it wherever you’d like. However, you would like to form sure that you simply reserve it as a Batch (.bat) file and not as a daily document (.txt).(Batch Scripting)
To do this, after you type within the name of your game add .bat behind it. You then got to attend “Save as type” and choose “All Files.”
Then you’re done! All you’ve got to try to to is hit the “save” button.
Remember, you’ll edit your game at any time by right clicking on the batch file and selecting “edit.”


If you guys are interested to learn more about Batch Scripting Game then Follow me up on my Youtube channel. Where I’m Teaching Batch Scripting in Virus Series.

Leave a Comment

17 − ten =