The Beginners Text Adventure Tutorial
Make your own free website on Tripod.com
Welcome fellow programmers to be. Here are some concepts to know before you can start programming.

The first concept is the PRINT statement. What this does is prints a string onto the string. A string is just a line of text, numbers, or other characters. Let's see an example.

PRINT "Hi, my name is Fred."

run this example and see what it does.

You always have to have the quotation marks in place if you want to print text. Now, when you ran that program, you probably got alot of garbage printed on the screen as well. You can get rid of that by using the CLS command. What this does is clear the screen. You would want to put this command in before your PRINT statement. Here's an example of what I'm talking about.

CLS
PRINT "Hi, my name is Fred."

run this program.

Nify huh?

Ok. You have that mastered. Now, lets ask a question that you can answer. To do that, we need to use the PRINT statement, the INPUT a$ statement, and an IF THEN statment. We already now what the PRINT statement does. The INPUT a$ statment lets you put in a line of text after the PRINT statement. The If THEN statement lets you programm in choises of what would happen. Observe.

CLS
PRINT "Which do you like, apples or grapes?"
INPUT a$
If a$ = "apples" THEN 10
If a$ = "grapes" THEN 20
10 PRINT "I like grapes too."
END
20 PRINT "YUCK!!! I hate apples!!!"
END

Ok. The END statement simply ends the program. The a$ is just a label, so you can replace it with p$, or z$, etc... just so long as you have the $ after it. 10, and 20, are just line numbers to go to. Now for the If Then statement.
If a$ = "apples" THEN 10


This is saying, if the INPUT a$ statement that you entered, wich is labeled a$ by the computer, equals apples then it will proceed to line 10. Now, you do not need quotes if you are using numbers. You do need quotes of you are using words, however. Expand upon this, write your own program, have fun, because this first tutorial is now at its end. You can actually make a text adventure game with this knowledge, but not a very good one.