Action Format

Actions are a special form of function. The general form of an action is:

If TriggerExpression DestinationState;

[

  ScriptStatements;

]

TriggerExpression is any logical expression. A logical expression will evaluate to either false (0) or true (any non-0 number). DestinationState is the name of the state in this module that will become active if TriggerExpression is true. ScriptStatements is a list of statements that will be executed in order, from top to bottom, if TriggerExpression is true.

If level > 36 Done;

[

  fillValve = 0 { Close the fill valve }; 

  heaterSetpoint = volume * secretConstant; 

]

This shows an action with all components. The trigger expression is level > 36, Done is the destination state, and the script has two statements - fillValve = 0; and heaterSetpoint = volume * secretConstant. Note that certain functions and statements are not allowed in scripts - these are listed in detail in "Function Usage in States, Scripts, and Threading".

For more information on actions and how they work, please refer to Actions and Scripts.