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 Edit Behavior and a behavior editor, like the one shown below, will appear. You can also double-click on the agent in the worksheet to edit its behavior.
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 double-clicking on the Trigger of any method in a behavior editor.
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 double-clicking on the IF side of a rule.
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 double-clicking on the THEN side of a rule.
Behavior Editor Buttons
The behavior editor has a number of buttons which are described below.
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 Copy button makes a copy of a selected rule, condition, or action. You cannot use the Copy button to copy methods.
The Apply button makes the behavior specified in the editor take effect for all instances of the agent, but does not close the behavior editor nor does it save the changes to the agent's behavior file.
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 and without permanently saving them. 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 Trash Can on a Macintosh desktop. You can drag commands, rules, or methods onto the Trash Can to discard them.
| Next | Previous | Reference Manual | Getting Started Manual |