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.
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
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.
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:
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.
ping localhost -n 0 >nul
ping localhost -n 0 >nul
ping localhost -n 0 >nul
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.
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)
msg = inputbox("Enter text here","Text to speech converter")
set sapi = CreateObject("sapi.spvoice")
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
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)
Set WshShell = WScript.CreateObject(“WScript.Shell”)
WshShell.SendKeys “lo ”
WshShell.SendKeys “, I”
WshShell.SendKeys “instructables ”
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.