Sub

From Wiki
Revision as of 10:37, 3 August 2007 by 65.32.162.67 (Talk)

Jump to: navigation, search

{{body|sub {sub name} |The sub command starts a smaller macro within the macro. You transfer to the sub by using gosub elsewhere in the macro. Use return to go back to where the gosub was previously.

Note: You must not jump out of a sub! Use return to properly terminate a sub routine. To prevent a stack overflow, EUO only supports 1000 consecutive GoSubs without returning. Remember this when using recursion! When the GoSub stack is about to get 1001 levels, the very first level in the bottom of the stack is deleted to make room.


Example 1

mainloop:
 gosub speakgame hi
 wait 1s
goto mainloop

sub speakgame
   exevent macro 1 0 %1
return


Related Commands

Gosub Return

See also

Main Page Documentation