echo color title goto if set labeling (not a command, but how to label)
The echo command is used to print out text to the console. Below, the echo command prints out “Hello, world!”: {“smallUrl”:“https://www. wikihow. com/images/thumb/9/9e/610238-3b1. jpg/v4-460px-610238-3b1. jpg”,“bigUrl”:"/images/thumb/9/9e/610238-3b1. jpg/aid610238-v4-728px-610238-3b1. jpg",“smallWidth”:460,“smallHeight”:345,“bigWidth”:728,“bigHeight”:546,“licensing”:"<div class="mw-parser-output">
License: <a target="_blank" rel="nofollow noreferrer noopener" class="external text" href="https://creativecommons.
org/licenses/by-nc-sa/3.
0/">Creative Commons</a>
\n</p>
<br />\n</p></div>"} The color command is used to change the color of the text in the command line. This isn’t very useful, and probably shouldn’t be focused on until you have finished the game itself, but the results of the color change can be quite appealing. Colors in DOS command lines are numbered, there is a table of the colors at the end of this article. The following command will change the text color to black background with green text: {“smallUrl”:“https://www. wikihow. com/images/thumb/0/07/610238-3b2. jpg/v4-460px-610238-3b2. jpg”,“bigUrl”:"/images/thumb/0/07/610238-3b2. jpg/aid610238-v4-728px-610238-3b2. jpg",“smallWidth”:460,“smallHeight”:345,“bigWidth”:728,“bigHeight”:546,“licensing”:"<div class="mw-parser-output">
License: <a target="_blank" rel="nofollow noreferrer noopener" class="external text" href="https://creativecommons.
org/licenses/by-nc-sa/3.
0/">Creative Commons</a>
\n</p>
<br />\n</p></div>"} The title command simply changes the name of the window on the title bar and task bar, and is by no means useful, however, it can make your program look professional. Using it like so will change the title of the window to “Fun Program”: {“smallUrl”:“https://www. wikihow. com/images/thumb/4/4e/610238-3b3. jpg/v4-460px-610238-3b3. jpg”,“bigUrl”:"/images/thumb/4/4e/610238-3b3. jpg/aid610238-v4-728px-610238-3b3. jpg",“smallWidth”:460,“smallHeight”:345,“bigWidth”:728,“bigHeight”:546,“licensing”:"<div class="mw-parser-output">
License: <a target="_blank" rel="nofollow noreferrer noopener" class="external text" href="https://creativecommons.
org/licenses/by-nc-sa/3.
0/">Creative Commons</a>
\n</p>
<br />\n</p></div>"} The goto command is used to go to a certain part of the program. You will be using it to determine what will happen when certain answers are chosen from questions. To use the goto command to go to a label called “WRONG”: {“smallUrl”:“https://www. wikihow. com/images/thumb/1/12/610238-3b4. jpg/v4-460px-610238-3b4. jpg”,“bigUrl”:"/images/thumb/1/12/610238-3b4. jpg/aid610238-v4-728px-610238-3b4. jpg",“smallWidth”:460,“smallHeight”:345,“bigWidth”:728,“bigHeight”:546,“licensing”:"<div class="mw-parser-output">
License: <a target="_blank" rel="nofollow noreferrer noopener" class="external text" href="https://creativecommons.
org/licenses/by-nc-sa/3.
0/">Creative Commons</a>
\n</p>
<br />\n</p></div>"} The if command is used to determine what will happen if a certain event occurs. After the if statement (if [something]), a command follows. At the if statement, if a certain event is true, the command in the statement will be carried out. You will be using this statement to determine which goto command is to be used. This if statement will be true if the input is equal to 12: {“smallUrl”:“https://www. wikihow. com/images/thumb/e/eb/610238-3b5. jpg/v4-460px-610238-3b5. jpg”,“bigUrl”:"/images/thumb/e/eb/610238-3b5. jpg/aid610238-v4-728px-610238-3b5. jpg",“smallWidth”:460,“smallHeight”:345,“bigWidth”:728,“bigHeight”:546,“licensing”:"<div class="mw-parser-output">
License: <a target="_blank" rel="nofollow noreferrer noopener" class="external text" href="https://creativecommons.
org/licenses/by-nc-sa/3.
0/">Creative Commons</a>
\n</p>
<br />\n</p></div>"} The set command is actually quite complicated, since it may be used in many ways. As for now, all you need it for is to get the computer to receive input. To do this: {“smallUrl”:“https://www. wikihow. com/images/thumb/1/10/610238-3b6. jpg/v4-460px-610238-3b6. jpg”,“bigUrl”:"/images/thumb/1/10/610238-3b6. jpg/aid610238-v4-728px-610238-3b6. jpg",“smallWidth”:460,“smallHeight”:345,“bigWidth”:728,“bigHeight”:546,“licensing”:"<div class="mw-parser-output">
License: <a target="blank" rel="nofollow noreferrer noopener" class="external text" href="https://creativecommons.
org/licenses/by-nc-sa/3.
0/">Creative Commons</a> <br />\n</p></div>"} Finally, labeling.
Labeling can name certain parts of the program so that you may use the goto command.
You can name certain sections of the program anything, so long as the name isn’t a command.
To label a section “main”, type the following: :MAIN Labeled sections include the label itself and all code that follow it until another label is present or the file reaches the end! Make sure you place the label before the section being labeled, and another label following it so that the computer understands what section is labeled! Example below: @echo off :LABEL1 echo THIS IS A TEST OF TEXT set/p input=THIS IS A TEST INPUT
\n</p>
From this point on you will be having multiple files per game (especially if you want to have ASCII graphics). You can get the batch script to print out the contents of any file on the screen with the type command. The below will print the contents of TEST. txt: {“smallUrl”:“https://www. wikihow. com/images/thumb/5/56/610238-5b1. jpg/v4-460px-610238-5b1. jpg”,“bigUrl”:"/images/thumb/5/56/610238-5b1. jpg/aid610238-v4-728px-610238-5b1. jpg",“smallWidth”:460,“smallHeight”:345,“bigWidth”:728,“bigHeight”:546,“licensing”:"<div class="mw-parser-output">
License: <a target="_blank" rel="nofollow noreferrer noopener" class="external text" href="https://creativecommons.
org/licenses/by-nc-sa/3.
0/">Creative Commons</a>
\n</p>
<br />\n</p></div>"} It’s important to remember to include the file extension, or the command may not work properly. Create an instructions page in notepad. It should say something like: {“smallUrl”:“https://www. wikihow. com/images/thumb/8/87/610238-5b2. jpg/v4-460px-610238-5b2. jpg”,“bigUrl”:"/images/thumb/8/87/610238-5b2. jpg/aid610238-v4-728px-610238-5b2. jpg",“smallWidth”:460,“smallHeight”:345,“bigWidth”:728,“bigHeight”:546,“licensing”:"<div class="mw-parser-output">
License: <a target="_blank" rel="nofollow noreferrer noopener" class="external text" href="https://creativecommons.
org/licenses/by-nc-sa/3.
0/">Creative Commons</a>
\n</p>
<br />\n</p></div>"} Save this as INST. txt in the folder of the batch file, then make it so that your game will print the text to the console on the instructions page: {“smallUrl”:“https://www. wikihow. com/images/thumb/a/a4/610238-5b3. jpg/v4-460px-610238-5b3. jpg”,“bigUrl”:"/images/thumb/a/a4/610238-5b3. jpg/aid610238-v4-728px-610238-5b3. jpg",“smallWidth”:460,“smallHeight”:345,“bigWidth”:728,“bigHeight”:546,“licensing”:"<div class="mw-parser-output">
License: <a target="_blank" rel="nofollow noreferrer noopener" class="external text" href="https://creativecommons.
org/licenses/by-nc-sa/3.
0/">Creative Commons</a>
\n</p>
<br />\n</p></div>"} Run the program and make sure it works. {“smallUrl”:“https://www. wikihow. com/images/thumb/7/7d/610238-5b4. jpg/v4-460px-610238-5b4. jpg”,“bigUrl”:"/images/thumb/7/7d/610238-5b4. jpg/aid610238-v4-728px-610238-5b4. jpg",“smallWidth”:460,“smallHeight”:345,“bigWidth”:728,“bigHeight”:546,“licensing”:"<div class="mw-parser-output">
License: <a target="_blank" rel="nofollow noreferrer noopener" class="external text" href="https://creativecommons.
org/licenses/by-nc-sa/3.
0/">Creative Commons</a>
\n</p>
<br />\n</p></div>"}
Run the program and make sure it works.
Run the program and make sure it works.
In other words, if you wanted a bright white background and black text: @echo off color f0 :MAIN cls echo.