Associating behaviors with states

A state can have many behaviors associated with it. A behavior, which is defined using C statements, is executed upon entry, exit, on trigger, or presence in a given state.

To associate a behavior with a state

1.    Right-click over the Header bar of the state.

2.    Click the Activity Manager tab.

3.    Under Actions, select the action for the behavior. That is, specify when the code that defines the behavior is executed. Your choices are:

Action

Description

Entry

Code is executed on state entry

Exit

Code is executed on state exit

Do

Code is executed for each execution cycle that the state remains active

On Trigger

Code is executed when the state is active and when a specified trigger is TRUE; you must also select the trigger from Available Triggers

5.    Press Add Action.

6.    The selected action is displayed in the Selected Actions and Edit Actions windows.

7.    In the Edit Actions window, using C statements, enter the state behavior for the corresponding action.

8.    Click OK, or press ENTER.