Help creating text based RPG

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
Newbie

Help creating text based RPG

Post by Newbie »

I am using Pete's Tutorials on the site. I am on Tutorial 2, Challenge 4 and I cant figure out how to start it. I got past the first three challenges without any problems. I think if I could just figure out how to start it the rest would be easy. Here is the code I do have:

PRINT "You can go left, right, or forward"
PRINT "Which direction do you want to go? ";: INPUT d$
IF d$ = "Left" OR d$ = "left" GOTO 1
IF d$ = "Right" OR d$ = "right" GOTO 2
IF d$ = "Forward" OR d$ = "forward" GOTO 3
5 attack=INT(RND*4)+1
1 PRINT "You have been attacked"
4 PRINT "Enemy 1"
HP=INT(RND*9)+1
PRINT HP
7 PRINT "What do you want to do? You can attack or use an item";: INPUT choices!
IF choices$ = Attack
IF choices$ = item GOTO 6
2
3
6 PRINT "You dont have any items yet";: GOTO 7
User avatar
Deleter
Veteran
Posts: 119
Joined: Sat May 07, 2005 7:31 pm

Post by Deleter »

well, this is just a minor point, but you have it checking for left or Left...etc, what you should do is use the ucase$( text$ ) or lcase$( text$ ) commands. ucase makes the string all uppercase, and lcase makes the string all lowercase so like this:

Code: Select all

IF ucase$( d$ ) = "LEFT" THEN GOTO 1 
User avatar
Pete
Site Admin
Posts: 887
Joined: Sun Dec 07, 2003 9:10 pm
Location: Candor, NY
Contact:

Post by Pete »

I would suggest checking out the answers to that tutorial for help...

http://www.petesqbsite.com/sections/tut ... swers1.txt

If you're serious about making text adventures though, you should read Na_th_an's IF Games series in QB Express.
Post Reply