Methods

From AgentSheetsWiki

(Difference between revisions)
Jump to: navigation, search
(Created page with "An agent's behavior can contain any number of methods. A method is a segment of the agent's behavior that contains a set of rules. A trigger is at the head of every method and de...")
 
(3 intermediate revisions not shown)
Line 1: Line 1:
-
An agent's behavior can contain any number of methods. A method is a segment of the agent's behavior that contains a set of rules. A trigger is at the head of every method and determines when the method will be called. Triggers that label method boxes in the Visual AgenTalk language behavior editors include:
+
An agent's behavior can contain any number of methods. A method is a segment of the agent's behavior that contains a set of rules. A trigger is at the head of every method and determines when the method will be called. Triggers that label method boxes in the Visual AgenTalk language behavior editors include:  
-
* While running: the agent's main method is labeled with the While Running trigger. This method is repeatedly called at each simulation cycle (time step) while the simulation is running.
+
 
-
* On
+
*'''While running''': the agent's main method is labeled with the While Running trigger. This method is repeatedly called once at each simulation cycle (time step) while the simulation is running.  
-
* When Creating A New Agent
+
*'''On &lt;''method_name''&gt;''': a user-defined method that gets called by the agent that contains it or any other agent using the Message or the Broadcast action.&nbsp;Upon receiving such a message, an agent calls the method referred to in the message and carries out the actions associated with the first rule whose conditions are all met in that method.&nbsp;<br>When programming an agent, it is recommended that you divide the agent's behavior into "chunks." It is natural to do this when describing an agent's activity in words. At different times an agent might walk, run, sit, speak, or act in any number of ways. If you focus on walking, you may wish to create one method to describe how an agent walks. You may even wish to create another method to describe how an agent takes a step. We suggest that you divide groups of rules into named methods that make sense for the agents in your specific simulation.
-
* On Mouse Click
+
*'''When Creating A New Agent''':&nbsp;This trigger executes the enclosed rules whenever a new agent is created in a worksheet using the Draw tool, the Volume Insert tool, or the New action.&nbsp;The When Creating New Agent trigger is usually used to initialize the agent's state.<br>
-
* On Mouse Hover
+
*'''On Mouse Click''':&nbsp;The Mouse Click trigger is used to program an agent to respond to a modified or unmodified mouse click. The rules located in a method labeled with a Mouse Click trigger are executed whenever the executing agent senses the designated mouse click (modified or unmodified), whether the simulation is running or not. The Mouse Click trigger increases the number of ways in which you can interact with your agents in the world.
The behavior editor for a new agent or an agent with no behavior comes up with a single method containing the While Running trigger and one empty rule.
The behavior editor for a new agent or an agent with no behavior comes up with a single method containing the While Running trigger and one empty rule.

Latest revision as of 18:41, 11 October 2011

An agent's behavior can contain any number of methods. A method is a segment of the agent's behavior that contains a set of rules. A trigger is at the head of every method and determines when the method will be called. Triggers that label method boxes in the Visual AgenTalk language behavior editors include:

The behavior editor for a new agent or an agent with no behavior comes up with a single method containing the While Running trigger and one empty rule.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox