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

On Trigger

Definition: On triggers allow you to name methods that will later be called. The method is called when the appropriate message is sent to the agent via a Make action or a Broadcast action from itself or from another agent. The message sent needs to be a valid method name.

Upon receiving 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.

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.


Method Name

Example: In the Pascal's Adding Machine simulation, the On trigger is called when the Digit agent gets the "Digit-Inc" message, which causes the number to increment by one.

Pascal's Adding Machine

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