Minecraft Blogs / Tutorial

How to make a text game with notepad!

  • 6,840 views, 3 today
  • 11
  • 7
  • 15
Supercrafter1710's Avatar Supercrafter1710
Level 37 : Artisan Crafter
7
So, I'm sure alot of people look at minecraft and think how awesome it would be to make a game, except just using computer resources, and being able to get right into developing after a little practice. Well then you have come to the right place! Let's get right into it! Note that I don't believe it works on mac. Sorry, mac users.

You will need:


-A computer
-Notepad
-A good idea


The basics



We are gonna be coding in batch, an extremely simple coding language. Don't expect to have any music or images, just text, however you can add colour to the text and background. The first thing you should type is @echo off, trust me you will need it. Next let's do a title. Just type "TITLE [Title here]" I'll call mine "Cupcake" ( Don't ask why I did, I just did ).Heres how it should look:

@echo off
TITLE Cupcake

Now let's add a new section! Skip a line and put a : before anything.  A very important command should be added to every section and always be first which is called "cls". If you don't, all your text will pile up on the one screen. Here it is now

@echo off
TITLE Cupcake

:Menu
cls

Writing the code



There we go! Now let's add some actual text. Type echo to have text there. If you want to skip a line type "echo." No, that dot on the echo is not a fullstop for the sentence, it's what you need to type. If your gonna make a game you got to have a few options somewhere so let's add some for Starting, and exiting. A helpful thing is to convert a image to text! Just go into any photo editing program (Yes, even MS Paint) and type "Menu" or something up in a fancy font (The best things you could do is have the text black and the file as a .jpeg) then go to http://www.text-image.com/ and do your stuff! (Not required). Ok so now let's take a look about how the .bat file looks now! (The menu text is messed up on this blog, so I won't include it on my file).

@echo off
TITLE Cupcake

:Menu
cls
echo Hello, welcome to the greatest cupcake of all time!
echo What would you like to do?
echo.
echo 1.Start
echo 2.Exit
echo.

Right now the player can't type anything, and if you open the file it will close in a flash. Let's add in an input! Type
"set /p input=[Anything here]" Now the user can input, but it will do nothing and close the file. Let's make it so that typing "1" or "2" or "Start" or "Exit" will work. Type "If "%input%"=="[Insert text here]" [Insert command here]. So there is quite alot of "Insert here stuff" Basically if you type "1" or whatever in there it will run the Specified command in the second box. This can start an app, create folders and stuff, but we are making a game so we won't need it to run anything else. If your making a text game mainly on the second blank spot you will be using goto "section" (Sections are the things like :Menu). As for the exit option all you need to type is exit in the command. Now let me edit up my batch file.....Ok! Here is the file so far!

@echo off
TITLE Cupcake

:Menu
cls
echo Hello, welcome to the greatest cupcake of all time!
echo What would you like to do?
echo.
echo 1.Start
echo 2.Exit
echo.
echo Type "1" or "2" to do their respective uses
echo.
set /p input=Enter:
if "%input%"=="1" goto
if "%input%"=="2" exit

While only typing "2" works right now, you can still run it! Check above photos for it in action. Now I think it's about time we add a new section. Let's make this game ask for what to call you. But first we gotta add an "Invalid" section, otherwise typing something that is not "1" or "2" will take you to the name. Also use a command called "pause>nul" it will make it so that if you press any key any commands after that will activate. Let's add all that stuff now.

@echo off
TITLE Cupcake

:Menu
cls
echo Hello, welcome to the greatest cupcake of all time!
echo What would you like to do?
echo.
echo 1.Start
echo 2.Exit
echo.
echo Type "1" or "2" to do their respective uses
echo.
set /p input=Enter:
if "%input%"=="1" goto
if "%input%"=="2" exit

:Invalid1
cls
echo Your input is invalid, please
echo enter a valid entry.
pause>nul
goto Menu

There we go! Now let's get the name done. This time you don't need to add the input stuff, as no specific name is needed. We will be taking advantage of set /p. Type in "set /p Name=[Insert text here]". It's not like the name is useless, you can tell the game to use it! Now that we have a new section we should probably finish off the input command we put previously. There we go!

@echo off
TITLE Cupcake

:Menu
cls
echo Hello, welcome to the greatest cupcake of all time!
echo What would you like to do?
echo.
echo 1.Start
echo 2.Exit
echo.
echo Type "1" or "2" to do their respective uses
echo.
set /p input=Enter:
if "%input%"=="1" goto Name
if "%input%"=="2" exit

:Invalid1
cls
echo Your input is invalid, please
echo enter a valid entry.
pause>nul
goto Menu

:Name
cls
echo Hey there, what's your name?
echo.
set /p Name=Name:
goto Stuff

If we want the game to use what we put in as our name type in %Name%. Were gonna be coming to an end soon so let's just get the last few details done.

@echo off
TITLE Cupcake

:Menu
cls
echo Hello, welcome to the greatest cupcake of all time!
echo What would you like to do?
echo.
echo 1.Start
echo 2.Exit
echo.
echo Type "1" or "2" to do their respective uses
echo.
set /p input=Enter:
if "%input%"=="1" goto Name
if "%input%"=="2" exit

:Invalid1
cls
echo Your input is invalid, please
echo enter a valid entry.
pause>nul
goto Menu

:Name
cls
echo Hey there, what's your name?
echo.
set /p Name=Name:
goto Stuff

:Stuff
cls
echo Oh so it's %Name% eh?
echo that name sounds cool!
pause>nul
goto Loss

:Loss
cls
echo You lost the game.
echo You mean we didn't begin?
echo The whole goal of this game was not to tell me your name
echo (Not that you can skip it)
echo.
echo Try again?
echo.
echo Yes No
echo.
set /p input=Enter:
if "%input%"=="Yes" goto Menu
if "%input%"=="No" exit
if "%input%"=="yes" goto Menu
if "%input%"=="no" exit

:Invalid2
cls
echo Your input is invalid, please
echo enter a valid entry.
pause>nul
goto Loss


Finishing up




It's easy from here. Click save as, click all files, put .bat at the end of the files name, and then your finished. When you open it it will have a cmd interface and try typing in all the stuff you set it to do. If a black background with white text seems a little blank to you then create a shortcut of the file, then click properties of the shortcut there is a little vanity options for that. If you click the shortcut tab by clicking change Icon you can give it a premade icon or a custom icon (Icons must be a special file, just look up how to make an  icon) The rest should be pretty obvious and easy to figure out. If you want to play my game copy and paste the final code above into notepad and save it like mentioned above.

Well, that's pretty much it! Please leave a diamond or a favorite if this helped you!
Tags

Create an account or sign in to comment.

1
11/13/2014 9:39 pm
Level 31 : Artisan Dragon
EthanConcept
EthanConcept's Avatar
Awesome blog! +1 Diamond.
1
10/28/2014 3:32 pm
Level 19 : Journeyman Crafter
PotatoBeenCrafted
PotatoBeenCrafted's Avatar
Isn't it easier to do this in Python? Plus Mac users could then do it I think...
1
10/29/2014 6:18 pm
Level 37 : Artisan Crafter
Supercrafter1710
Supercrafter1710's Avatar
I would try to experiment with Mac, but unfortunately I do not own one. I also do not know what Python is, however if you would need to download Python then that would ruin the whole point of this blog, making a game with only Pre-installed software / Computer resources. I hope this blog helped you too.
1
10/29/2014 6:35 pm
Level 19 : Journeyman Crafter
PotatoBeenCrafted
PotatoBeenCrafted's Avatar
I made a blog on my page on how to code part of a simple text based adventure game, Python is really easy to use and can be used to make way more advanced things...have you ever heard of MCEdit? If so...that was made in python :3 I one day hope to make something like that xD
1
10/17/2014 5:02 pm
Level 46 : Master Magical Girl
ralts
ralts's Avatar
Oh yes, I forgot to give this a diamond. :) I'm working on an rpg where you can pick a name, town name and stuff :)
1
10/17/2014 5:35 pm
Level 37 : Artisan Crafter
Supercrafter1710
Supercrafter1710's Avatar
I hope that RPG works out well for you :)
1
10/16/2014 10:24 pm
Level 14 : Journeyman Modder
searchndstroy
searchndstroy's Avatar
Oh I love batch!
1
10/17/2014 10:33 am
Level 37 : Artisan Crafter
Supercrafter1710
Supercrafter1710's Avatar
Yeah, batch is really good! It can really be helpful for shortcuts!
1
10/16/2014 5:06 pm
Level 46 : Master Magical Girl
ralts
ralts's Avatar
Awesome tutorial! I successfully made a quiz game using this tutorial. But I don't understand how to change the colors of background and text. Please help
1
10/16/2014 5:34 pm
Level 46 : Master Magical Girl
ralts
ralts's Avatar
Okay, never mind, I figured it out.
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome