Qbasicnews.com

Full Version: GOSUB help SOLVED
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Quote:
axipher Wrote:but anyway it does the same thing, doesnt it
No I don't believe so. With yours it checks choice$ over and over again for each one. with SELECT CASE it's only once.....
You're absolutley right, Whitey.

Axipher,
You said " ...the main menu works fine up until i access a option wioth another INPUT command".
Maybe you did an INPUT OPTION$ in one of the sub-menus. Then when you returned to the main menu OPTION$ was now different. Now, using the SELECT CASE, you don't care whether OPTION$ is re-used by a sub-menu. You used it already, and don't need it anymore when returning from the sub-menu.
*****
well thnx for the input, ill hav my cpu bak soon to continue work, my file is on a floppy, and my new cpu dont have a floppy drive, wats up wit that...

o and for ea menu, the option variable is different, like choice$, townchoice$, warchoice$, etc
Also, to avoid reprinting the options menu and the selected option, we may do something like this:

Code:
do
   '' display options menu
   cls
   print "What would you like to do next?"
   print
   print "a. Stats"
   print "b. Inventory"
   print "c. Town"
   print "d. Battle"
   print "e. Quit"

   do
      '' check for input
      dim choice as string
      choice$ = lcase$( inkey$ )

      '' and act accordingly
      if( choice$ <> "" ) then
         select case choice$
            case "a": gosub Stats : exit do
            case "b": gosub Inventory : exit do
            case "c": gosub Town : exit do
            case "d": gosub Battle : exit do
            case "e": gosub Quit : system
         end select
      end if
   loop
loop
much appreciatated, now how do u close a topic???
You can't close topics.
How do I shoot web?
Go web, go!
Up, Up and away!

axipher, you can request the topic closed from an admin, but there's really no reason to do so..
Just leave the topic and never look back Big Grin
lol, i guess so, but its so active
Pages: 1 2