The Trigger

The trigger is any logical expression that determines if a state transfer is to take place. Nothing happens as long as the trigger expression evaluates to a logical false (0).

If an action trigger is false, no action is taken; if it becomes true, the following occurs:

1.  The present active state (and all its statements) is stopped.

2.  The script (if any) is executed in order from the top of the list to the bottom only once.

3.  The destination state (if any) is started as the new active state.

There is a special case when the destination state is the present state. In this situation, no states start or stop, but the script is executed in order as before. If the action trigger remains true after the script has executed, the script will be executed again, since the action is still in the active state and the action trigger is still true. This will continue until the action trigger becomes false. Take care not to inadvertently create such a repetitive loop since it will consume processing time and greatly degrade the overall system performance.