You only need to use one loop for all of them, you just need to make it big enough to include all of that code.
For that example, you would add these two lines:
Code:'(just before line 119) DoThis is basically the same idea as Shaggy Hiker's example above (if you ignore functions/subs), but this way is a little bit more messy because you are using lots of variables to determine what the current action/stage should be.Code:'(just after line 151) Loop While (help = 1) OrElse (inventory = 1) OrElse (Stage1 = 1)
It would probably be easier to have one String variable to contain the current 'action' (eg: "inventory" or "map" or "stage"), and for the stage either an Integer (eg: 1 or 3) or a String (eg: "Stage1" or "Stage1Wall").
Note that using functions/subs instead is possibly another good way to deal with the situation, but in a way that changes the behaviour a bit - perhaps in a way you want.
If you create functions/subs for the 'standard' actions (such as Help), you could call it from anywhere in your code, and it would run immediately, then return to exactly the same point as you called it.
For example, a sub called ShowHelp would be like this:
...and you would call it like this:Code:'(add this outside of your current subs/functions) Private Sub ShowHelp 'put the "~stuff happens~" code here from Line 126 of your last example. End Sub
Note that any variables you use in the code for Help will need to have their Dim lines moved to outside of any sub/function.Code:ElseIf enteredText = "help" Then ShowHelp 'this will show the Help immediately Stage1 = 0 '...and when it finishes, this line will run ElseIf enteredText = "inventory" Then




Reply With Quote
