Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Grouping IF's
#1
Im making a little rpg type thing to practice my qbasic skills and i have a question:

i finding for each room of my rpg i have to write out a repetitive list of IF's eg:
Code:
If a$ = "look" THEN .....
if a$ = "stand" THEN ....
if a$ = "stand" THEN ...
if a$ = "sleep" THEN ...

such commands are common to each room and all have the same effect but i want to be able to tidy the code up by being able to recall all those if commands using one small command that refers to that particular group of IFs, but im not sure how to do this?
can anyone help?
:???:
-p
Reply
#2
.
ravelling Curmudgeon
(geocities sites require copying and pasting URLs.)
I liked spam better when it was something that came in a can.
Windows should be defenestrated.
Reply
#3
Use subroutines, GOSUB and RETURN. Look in QB help about those.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#4
Hey Na_tH_an (I don't have the QBHELP handy... I guess I could go to the website qbasicnews but I'm too lazy and I got to go soon) does the GOSUB/RETURN commands ... hmm, does it go to a certain sub and then automatically return back to where the GOSUB command was issued?
ovaProgramming.

One night I had a dream where I was breaking balls. The next morning, BALLSBREAKER was born.

Quote: Excellent. Now you can have things without paying for them.

BALLSBREAKER 2
~-_-Status Report-_-~
Engine: 94%
Graphics: 95%
Sound: 100%
A Severe Error has crippled BB2 for the time being... I have to figure it out, but until then you won't see much of it Sad.
-----------------------------
Reply
#5
Yes.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#6
Thanks :wink:
ovaProgramming.

One night I had a dream where I was breaking balls. The next morning, BALLSBREAKER was born.

Quote: Excellent. Now you can have things without paying for them.

BALLSBREAKER 2
~-_-Status Report-_-~
Engine: 94%
Graphics: 95%
Sound: 100%
A Severe Error has crippled BB2 for the time being... I have to figure it out, but until then you won't see much of it Sad.
-----------------------------
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)