Sub

From Wiki
Jump to: navigation, search

Synopsis

sub {sub name}

Description

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

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