Navigation Bar AgentSheets Education R&D Support About Us Manuals Tutorial Movies FAQ Books Classes

Edit Behavior

Description: The Gallery | Edit Behavior menu option allows you to edit the selected agent's behavior. Select the agent in the gallery by single-clicking on it, then choose Gallery | Edit Behavior and a behavior editor, like the one shown below, will appear. You can also double-click on the blue part of the agent's definition in the gallery or select the agent and click the Edit Behavior button in the gallery to edit its behavior.

    Power User Shortcut

    An agent's behavior can be edited by right-clicking the agent whose behavior you wish to edit. This will show the following pop-up menu, from which you can select the Edit Behavior menu option.

Visual AgenTalk (VAT) is the visual programming language of the AgentSheets environment. You program in the Visual AgenTalk language by dragging and dropping conditions and actions into rules in an agent's behavior editor (shown below).

Lists of rules are grouped together into methods. Each method is labeled with a trigger, the yellow and black striped tag at the upper left corner of the behavior editor shown above. The rule above is located in a method labeled with the While Running trigger. Rules located in the While Running method of an agent will be checked by the AgentSheets scheduler at every simulation cycle . A full list of triggers is housed in the Triggers palette which is accessed via the Tools | Triggers Palette menu option. You can also access the Triggers palette by clicking on the Triggers button in the Toolbar.

The user decides how to define different methods for agents by filling those methods with lists of rules, which in turn are assembled from lists of conditions and actions.

Condition commands are blue and are permanently housed in the conditions palette. They are always dragged into the IF side of a rule. An implicit "and" exists between all conditions in a rule. This means that all the conditions of a rule must be true in order for the actions of that rule to be executed. You can access the conditions palette via the Tools | Conditions Palette menu option. You can also access it by clicking on the Conditions button in the Toolbar.

Action commands are red and are permanently housed in the actions palette. They are always placed in the THEN side of a rule. An implicit "and" also exists between all actions in a rule. This means that all the actions in a rule will be executed if the rule's conditions are true. You can access the actions palette via the Tools | Actions Palette menu option. You can also access it by clicking on the Actions button in the Toolbar.

    Power User Shortcuts

    A condition can be added to the agent's behavior by right-clicking in the part of the rule where conditions reside. This will show the following pop-up menu, from which you can select the Add Condition menu option and then select the desired condition to add. The example below illustrates the addition of the Next To condition.

    An action can be added to the agent's behavior by right-clicking in the part of the rule where actions reside. This will show the following menu, from which you can select the Add Action menu option and then select the desired action to add. The example below illustrates the addition of the Change action.

    A trigger can be replaced on an agent's method in the behavior editor by right-clicking on the current trigger. This will show the following menu, from which you can select the Change Trigger menu option and then select the desired trigger. The example below illustrates the change of a trigger to the On trigger.


Behavior Editor Buttons
The New Rule button adds a new rule to the method currently highlighted. A new rule is added right below the currently selected rule. If no particular rule is highlighted, the new rule gets added at the end of the method. If no method is currently highlighted, the new rule is added to the bottom of the While Running method.
The New Method button adds a new method with an On trigger to the list of methods in the behavior editor. New methods are always added at the bottom of a behavior editor.
The Duplicate button makes a copy of a selected rule, condition, or action. You cannot use the Copy button to copy methods.
The Explain button shows a context-sensitive explanation of the selected language component (condition, action, trigger, rule, or method) in an animated tool tip. The system steps through the parts of the language component being explained, while the corresponding piece of explanation gets highlighted. The example below shows how the Change action is explained.

Each parameter of the Change action is highlighted with a red rectangle, while the corresponding explanation text also gets highlighted by turning red. Explanations are context-sensitive as they depend on the currently selected parameters for the language component. For instance, if the direction parameter was set to the right arrow in the Change action, the explanation would show:

The Test button shows the effect that a selected language component has on a particular agent selected in the worksheet. AgentSheets lets you "play" with the language to find out what each component does without having to create a complete program. You can select a single condition or action, a rule or an entire method in the Behavior Editor, select an agent in the worksheet using the Arrow tool, and click the Test button. The selected language component will execute in the specific context. A condition will return true or false depending on the context of execution. An action will execute and show its effect on that agent. A rule will execute by stepping through all the conditions and, if all true, execute all actions; if any condition fails, testing it will reveal which one.

For example, testing the Next To condition on an agent will test if any of the 8 adjacent agents looks like the depiction specified in the condition. A yellow and black striped frame around the condition indicates that the condition is being tested. If the condition is true then the frame quickly disappears and a sound is played. If the condition is false, the frame begins to blink and a different alert sound is played.

In the situation above, the condition is true since there is one or more adjacent agents that looks like the one specified by the condition.

The Apply button makes the behavior specified in the editor take effect for all instances of the agent and saves the changes to the agent's behavior file, but does not close the behavior editor.

Pressing the Apply button applies any changes in an agent's behavior (i.e. new/changed methods, new/changed rules, new commands, reordered rules, changed parameters etc.). This means that any instances of an agent that own the rule editor where new rules have been applied will act according to those new rules. Pressing the Apply button allows you to change an agent's behavior, and then to check those changes, without closing the rule editor. The Apply button turns blue if changes to the behavior editor that houses them were made since you last saved or applied your rules.

The OK button saves the agent's behavior and closes the behavior editor. When you open the behavior editor again, any changes made since the last time it was saved will have been preserved.

The OK button turns blue if changes to the behavior editor that houses them were made since you last saved or applied your rules.


The Trash Can located on the bottom right of the behavior editor works just like the Recycle Bin on your desktop. You can drag commands, rules, or methods onto the Trash Can to discard them.

reference manual | ©2010 AgentSheets, Inc. | contact us