Posted: Tue Jan 15, 2008 6:44 pm Post subject: Exiting A Procedure
I have a game running in a loop in one procedure and if the user clicks on a box it goes to procedure mainMenu...but the loop is still running and all the mainMenu does is sit there like an image Is their any way to full exit a procedure?
Sponsor Sponsor
TokenHerbz
Posted: Tue Jan 15, 2008 7:11 pm Post subject: RE:Exiting A Procedure
recursion...
code:
proc menu
if speed selected then
call speed_adjust proc
elsif username change then
call username proc
end if
if menu isnt exited then
menu %% recalls the menu
elsif menu is exited then
back to where you go
end if
end menu
loop
game stuff here
if key = menu then
call menu proc
end if
end loop
thats just theory, seems logical, i would try it!
"Edit for code tags"
syntax_error
Posted: Tue Jan 15, 2008 7:34 pm Post subject: Re: Exiting A Procedure
although TokenHerbz idea maybe better and more sophisticated
but how bout you have a cls before each proc starts and a cls before you draw ur menu
simple no?
ericfourfour
Posted: Tue Jan 15, 2008 9:54 pm Post subject: RE:Exiting A Procedure
That is a poor example of where to use recursion. A situation like this just requires planning of how your are going to make your loop. Pay attention to scope and where your exit statements are. If you are using Turing's GUI make sure you are using the ProcessEvent funtion and Quit procedure correctly.
Do not use recursion in a situation like this. It only decreases the robustness of your program.
Clayton
Posted: Tue Jan 15, 2008 10:23 pm Post subject: RE:Exiting A Procedure