Syntax:
on message {block} on event {block} on {timer} {block} on exit {module} {block}
Keyword handler:
net.eclecity.linguist.basic.keyword.BasicKOn.class
Runtime handler(s):
net.eclecity.linguist.basic.handler.BasicHOn.class net.eclecity.linguist.basic.handler.LHStop.class
Function:
The first form handles a message from another running script module (see send). If the recipient is idle the message will be executed immediately, otherwise the system will wait for the current thread to stop, then deal with the message. For this (and other) reasons, threads should be kept as short as possible, avoiding lengthy loops. There are some circumstances where new thread is useful.
The second form deals with events sent from outside Linguist. What happens next is usually covered by extra keywords in a custom additional package.
The third form defines where the program restarts when a timer fires..
The fourth form allows you to specify some processing that must be done before (when) the script quits.
Example(s):
on message prompt the message on message begin if the sender is "Main" gosub to ProcessMessage end on event go to ProcessEvent on Timeout go to TimeoutCB on exit Intro run "Main"