Making a Game in Notepad and Much Much More

114,736

42

24

Introduction: Making a Game in Notepad and Much Much More

This is my first instructable. So if you have any suggestions please comment. Lets get started!

When we all hear the word notepad we think of some boring useless applications to note down stuff.Well notepad is much more than that.We can control our pc,do some cool hacking and make fun games.

ps here is the batch file for the tic tac toe game

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Introduction to Batch

Batch is a language that runs primarily out of your Windows command prompt.Not only is it useful, but it can also be used to create amazing text-based games! What is a text-based game you ask? It's a game (a very simple one) in which the user interacts through the use of text and choice-making.You will learn how to set up situations in which the characters will have to make choices about how they want to approach the problem.

First of all open notepad

Code!
Now you're ready to begin typing your first lines of code, as well as learning you first commands. Commands are each of the words that we type in to the program that have a function; such as the echo, or pause commands.

echo, echo. and pause

echo - echo is used to display regular text in your game. For example you can type: "echo Hello adventurer!", and the people playing your game will see is "Hello adventurer!" (So long as you typed in @echo off).

echo. - echo. (with a period) is used to create a blank line in your game. This can be useful in keeping your text uncluttered.

pause - This command is used when you want your players to take a break, and is used most often when you want to give them time to read some text. When you use this code it shows up as "Press any key to continue . . ." Your players can then press any key, when they are ready, in order to continue playing.

Save your game as : nameofyourgame.bat

the .bat extension makes it a batch file.

Step 2: Cls, Exit, Title, and Color

Ok, this next set of commands are all really simple as well, but are nice to have.

cls - cls is a command that I use a lot. It stands for "clear screen", and what it does is remove all of the text that has been made in the command prompt window (ergo, making the screen blank). This is a good tool when you want to keep your game looking clean and in order.

exit - This does exactly what it sounds like, it closes the game. You should only use this when the characters reach the end of the game, or if you want the game to close when they die or make a wrong decision.

title - title displays whatever you type after it in the title bar of the command prompt window.

color - color is a really fun command, and can be used to liven up your game. When you add the color code, followed by a space and a specific set of numbers or letter, you can change the colors of the command prompt window. For a list of the available colors see the picture below or open up the command prompt(cmd) and type in "color/?".

It is a set of two numbers.First number is background color.Second number is font color.

eg. 19

Step 3: Goto

The "goto" command is simple, once you get to know it. The command is used when you want a player to jump to a different section of your game, such as when they make a certain decision.

It works this way: You enter the "goto" command on a separate line, or at the end of an "if" statement (which we will go over later). You then specify a variable which will become the name of the destination. The name can be anything you want, and consists of the word(s) you type after "goto".

Step 4: Set/p and If

These commands are the most advanced commands that I am going to teach you.

set /p variable= - This command is used when you want your player to insert a variable (a varying answer). This could be anywhere from their name to the name of a weapon or even the answer to one of the choices you have given them. Often times this variable will be referenced later, and therefore must be given a name. The name can be whatever you want it to be.

We can reference this variable by placing the name of variable between %.Eg. %answer%

if - this command is used when we create if/then statements. We can use it in conjunction with "set /p" in order to create choices for are players.
Ask the player a question with the "echo" command. Make sure to clearly state their options.Give them the ability to enter an answer with the "set /p" command.

Create "if" statements that allow the players' choices to have consequences, and that 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:

:start

echo YES or NO?

set /p variable=

if %variable% equ YES goto situation1

if %variable% equ NO goto situation2

if %variable neq YES goto start

All of this code means that if the player types in "YES" he will be sent to "situation1"; if he types in "NO" he will be sent to "situation2"; if he types in neither "YES" or "NO" he will be sent back to the start of the question.

Step 5: Ping Localhost -n 7 >nul

This statement delays the execution of the statement for 7 seconds. You can change the value.

For eg.

@echo off

:start

color 10

ping localhost -n 0 >nul

color 20

ping localhost -n 0 >nul

color 30

ping localhost -n 0 >nul

goto start

This program creates a blinking screen that never stops( infinate loop).

Step 6: %random%

This comand creats a random 5 digit number.This command is often usesd to create a matrix type of program.

@echo off

color 02

:start

echo %random%%random%%random%%random%%random%%random%

goto start

Step 7: Text to Speech Converter

This is my most favourite thing about notepad.This uses SAPI.The Speech Application Programming Interface or SAPI is an API developed by Microsoft to allow the use of speech recognition and speech synthesis within Windows applications.

This is slightly different becouse this is in vbs script not batch.(The volume is low)

dim msg

msg = inputbox("Enter text here","Text to speech converter")

set sapi = CreateObject("sapi.spvoice")

sapi.speak msg

save it with a .vbs extension

for eg. texttospeech.vbs

Step 8: Star Wars!!!

There is a complete copy of Star Wars done entirely in ASCII characters that you can watch in the Windowsoperating system (or any OS that supports telnet). The only thing required to watch it is an internet connection; speed does not matter.

To watch it on Windows XP, Mac OS X and Linux

Go to Start, Run. (Only for Windows users)

Now type "telnet towel.blinkenlights.nl" without the quotes and press Enter.

Users of Mac OS X and Linux can directly execute this code in the terminal window.

On Windows 8, Windows 8.1, Windows 7 and Windows VistaTelnet is turned off by default in the latest versions of Windows.

So, in order to watch star wars, you must first enable telnet by going to Control Panel › Programs › Turn Windows Feature On or Off and ticking both the telnet check boxes.

After doing that, follow the steps given below:-Go to Start, Search in Windows Vista and Windows 7. On Windows 8 and Windows 8.1, open the main Start page.

Type telnet and press Enter.In the following command prompt window, type "o" without quotes and press Enter.

Now type "towel.blinkenlights.nl" without the quotes and press Enter.

If you do not need telnet anymore, you can turn it off.

Step 9: Constantly Repeat Messages to Annoy Someone

Using this notepad trick you can annoy anyone and can actually force them to log off or leave the computer (LOL….). This notepad trick will create an infinite cycle of a message in the computer. Follow the steps to know more: Open Notepad.Type the following code in the notepad file.

:@ECHO off :

:Begin msg * Hi

msg * Are you having a bad day?

msg * well, i'm having fun!

msg * Lets have fun together!

msg * Because you have been o-w-n-e-d

GOTO BEGIN

to end it restart your computer

Step 10: Slowly Type Messages

Completely harmless trick and perfect for playing pranks on one’s friends. This trick can really freak out anyone! Follow the below mentioned steps to perform this trick: Open Notepad.Paste the following code in the notepad file:

(retype all quotes)

WScript.Sleep 180000

WScript.Sleep 10000

Set WshShell = WScript.CreateObject(“WScript.Shell”)

WshShell.Run “notepad”

WScript.Sleep 100

WshShell.AppActivate “Notepad”

WScript.Sleep 500

WshShell.SendKeys “Hel”

WScript.Sleep 500

WshShell.SendKeys “lo ”

WScript.Sleep 500

WshShell.SendKeys “, I”

WScript.Sleep 500

WshShell.SendKeys “love”

WScript.Sleep 500

WshShell.SendKeys “instructables ”

WScript.Sleep 500

Save the file with any name and with .vbs extension and close it.

To end it open task manager and end thewscript.exe process as shown in image above.

Coded Creations

Participated in the
Coded Creations

Be the First to Share

    Recommendations

    • Finish It Already Speed Challenge

      Finish It Already Speed Challenge
    • Arduino Contest 2020

      Arduino Contest 2020
    • First Time Author Contest

      First Time Author Contest

    24 Discussions

    1
    2022izpe
    2022izpe

    Question 8 weeks ago

    when i open my game on google chrome it just shows all the coding i've done


    minecreate
    let's start
    press any key to continue
    c:\users\izaak\desktop>echominecreate minecreate
    c:\users\izaak\desktop>echo.
    c:\users\izaak\desktop>echo lets start lets start
    c:\users\izaak\desktop>pause press any key to continue. . .
    0=black
    1=blue
    2=green
    3=aqua
    4=red
    5=purple
    6=yellow
    7=white
    8=gray
    9=light blue
    a=light green
    b=light aqua
    c=light red
    d=light purple
    e=light yellow
    f=bright white
    echo are you ready
    echo.
    cls
    color 04
    echo lets start
    echo.
    pause
    :start
    echo are you ready
    echo.
    pause
    cls
    color 09
    echo let's start
    echo.
    pause
    goto start
    @echo off:start
    color 10
    ping localhost -n O>nul
    color 20
    ping localhost -n o>nul
    goto start
    @echo off
    color 02
    :start
    echo
    %random%%random%%random%%random%%random%%random
    goto start
    dim msg
    msg=imputbox(Enter text here","Text to speech converter")
    set sapi=CreatObject("sapi.spvoice")
    sapi.speakmsg
    save it with a .vbs extension
    for eg.texttospeech.vbs
    Enter,In
    "o"
    "towel.blinkenlights.ni"
    :@ECHO off:
    :Begain msg * Hi
    msg * Are you having a bad day?
    msg * well,i'm having fun!
    msg * Let's have fun together!
    msg * Because you have been o-w-n-e-d
    GOTO BEGIN
    to end it restart your computer
    (retype all quotes)
    WScript.Sleep 180000
    Wscript.sleep10000
    Set WshShell=WScript.CreateObject("WScript.shell")
    WshShell.run"notepad"
    WScript.sleep 100
    WshShell.AppActivate"notepad"
    Wshcript.sleep 500
    Wshshell.SendKeys"Hel"
    WScript.sleep 500
    Wshcriptshell.SendKeys "lo"
    WScript.sleep 500
    WshShell.SendKeys"l"
    WScript.sleep 500
    WshShell.sendKeys"love"
    WScript.sleep 500
    WshShell.SendKeys"instructables
    WScript.sleep 500
    title my game
    color03
    echo what is your name ?
    set/p name=
    echo hello%name%,myname is izaak
    echo.
    pause

    0
    lelolp2
    lelolp2

    Tip 5 months ago on Step 9

    You can end the task in the Task-manager too or you right-click the Icon in the toolbar and hit "close all windows".

    0
    ReChan
    ReChan

    Answer 1 year ago

    name .bat

    0
    TheNewbTewb
    TheNewbTewb

    Question 1 year ago on Step 4

    Total beginner here. So after the if/then choice, what's the next line of code? I keep having trouble with the choice not taking me to the proper goto situation.

    0
    ReChan
    ReChan

    Answer 1 year ago

    Example:
    set /p notepad=
    if %notepad% equ ok goto ok1
    if %notepad% equ exit goto exit
    :exit
    exit
    :ok1
    echo Okay you're here.
    echo.
    pause
    cls
    (So you see here I put the exit first so it doesn't end screen after ":ok1") (Maybe you for got this ":" when you selected where you wanted the program to run)

    0
    DanielS1154
    DanielS1154

    1 year ago

    External tools can be used for speeach, and several other functions, using only pure CMD.

    0
    DanielS1154
    DanielS1154

    1 year ago

    In order to use FOR in many cases of code, it reduces the size of the code. I like the Game Tictactoe.bat too !!!

    1
    TristanR37
    TristanR37

    Question 2 years ago on Step 9

    CAN U PUT THIS ON SOMEONE ELSES COMPUTER FROMM YOUR COMPUTER

    0
    OpioS
    OpioS

    Answer 2 years ago

    yes you can

    0
    Raid On
    Raid On

    2 years ago

    Great Nice Work ! I have made my own Text to Speech Converter and here is the image.

    Capture.PNG
    0
    SohanA1
    SohanA1

    Reply 2 years ago

    that's great!!

    0
    Raid On
    Raid On

    Reply 2 years ago

    Thanks !