Associating and editing state behaviors

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. If you are unfamiliar with the C language, refer to C: A Software Engineering Approach.

To associate a behavior with a state

1.    Right-click the state header.

2.    Click the Activity Manager tab.

3.    Under Actions, select the action for the behavior.

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

4.    Press Add Action.

The Selected Actions and Edit Behavior windows display the selected action.

5.    In the Edit Behavior window, using C statements, enter the state behavior for the corresponding action.

6.    Click OK, or press ENTER.

To edit a behavior

1.    Right-click the state header.

2.    Click the Activity Manager tab.

3.    Under Selected Actions, select the action corresponding to the behavior you want to edit.

The Edit Behavior window displays the code to be edited.

4.    Edit the code.

5.    Click OK, or press ENTER.

To change the execution order

When a state has two or more internal transitions, you may need to change their execution order.

1.    Right-click the state header.

2.    Click the Activity Manager tab.

3.    Under Selected Actions, select the trigger whose execution order is to be changed.

4.    Use the Up and Down squiggle arrows arrows to change the order of the triggers.