Watch

Description:              This function watches its parameters and returns true when any of their types or values change.

Returns:                    Boolean

Usage:                       Steady State

Format:                      Watch(Start[, Parm1 [, Parm2, ...])

Parameters:             Start     { Boolean }  { required }  { no default: }

                                                Any expression which evaluates to a false (0) or true (non-0) value. This will be the initial return value of the function.

                                    Parm1, Parm2, ...    { varies }  { optional }  { no default: }

                                                Are any number of optional variables that are to be monitored by this function.

Comments:               This is a reset-able function whose initial return value will be set by the first parameter. This parameter is ignored after the initial evaluation of the function.

                             The Watch function will not be triggered by a variable whose value has been set to its existing value; that is to say, if a variable has a value of 3 and it is set in the code again to a value of 3, this function will not be triggered.

                             Only the first parameter (Start) is mandatory. Use Watch(1) to trigger a script once only on the first entry to a state.

Examples:

If Watch(1);

[

  ...; 

]

This script will be executed once only, and then the function will be reset to false (i.e. the script will never again execute unless the module is stopped and restarted).

If Watch(0, xValue, yValue);

[

  ...; 

]

This script will be executed if either of the variables' values change by any amount, if they become invalid, or if their type changes.

See Also:

Change | Edge | WatchArray