hello.
Right now I am making a very large text adventure RPG. My problem is that in one sub after an input command I want it to go to a different sub. Can I do that? here is some source:
DECLARE SUB INTRO ()
DECLARE SUB DOG ()
SUB INTRO
10 PRINT "HELLO "
INPUT A$
SELECT CASE A$
CASE IS = "HELLO"
GOTO SUB DOG ' <--------- this is the line i need help with
CASE IS = ELSE
GOTO 10
END SUB
SUB DOG
PRINT "HELLO"
END SUB
thanks
can I do this in a SUB?
Yes, in fact, you shouldn't have to use the text "GOTO SUB" at all. Just type the name of your sub. QB recognizes the implicit CALL command when you just type the name of the SUB. So the code below should work fine.
Good luck.
Code: Select all
SUB INTRO
10 PRINT "HELLO "
INPUT A$
SELECT CASE A$
CASE IS = "HELLO"
DOG
CASE IS = ELSE
GOTO 10
END SUB
While learning qbasic and subs try this
While learning to program in Qbasic and using subroutines you might want to try this:
instead of
This will help you to remember that "dog" is a subroutine that you coded.
Code: Select all
call dog
Code: Select all
dog
Roger Greenlaw