<Label> = A predefined 'label' in your script.
Allows you to define the name and location of a <Label> that is used as the jump destination for a gosub statement.
When a gosub statement is encounted the script will jump to the location of the <Label> and continue on until the first endsub is reached and then return to the position directly under the gosub statement.
The 'sub' part of the name implies a downward direction, however, 'gosub' intructions can be jumps in an upwards direction in your script.
Example:
write to player logbook = 1
write to player logbook = 2
gosub mix.numbers
write to player logbook = 3
write to player logbook = 4
return null
mix.numbers:
write to player logbook = 5
endsub
In this case the numbers would be written to the logbook in the following order, 1, 2, 5, 3 and 4 due to the 'gosub' causing 3 and 4 to be put after 5. (5 would not be written twice due to the 'return null' being encountered)
Command Location:
- »» General Commands
- »» Flow Control
gosub <Label>
- »» Flow Control