Difference between revisions of "Delayed-Message Action"

From AgentCubes
Jump to navigation Jump to search
imported>Mike
(Created page with "150px {| width="100%" cellspacing="0" cellpadding="10" border="0" |- | width="80" valign="top" align="left" | '''Definition:''' | width="100%" valign=...")
 
imported>Mike
Line 3: Line 3:
 
{| width="100%" cellspacing="0" cellpadding="10" border="0"
 
{| width="100%" cellspacing="0" cellpadding="10" border="0"
 
|-
 
|-
| width="80" valign="top" align="left" | '''Definition:'''
+
| width="80" valign="top" align="left" | '''Definition:'''  
| width="100%" valign="top" align="left" | The '''delayed-message''' action will trigger a message in this agent after a specified amount of time.
+
| width="100%" valign="top" align="left" | The '''delayed-message''' action will trigger a message in this agent after a specified amount of time. Note that it is not possible to send delayed messages to other agents.&nbsp; <br>
 
|-
 
|-
| width="80" valign="top" align="left" | '''Parameters:'''
+
| width="80" valign="top" align="left" | '''Parameters:'''  
| width="100%" valign="top" align="left" | [[Direction parameter|direction]]
+
| width="100%" valign="top" align="left" | [[Method parameter|method]], [[Time parameter|time]]
 
|-
 
|-
| width="80" valign="top" align="left" | '''Example 1:'''
+
| width="80" valign="top" align="left" | '''Example 1:'''  
 
| width="100%" valign="top" align="left" |  
 
| width="100%" valign="top" align="left" |  
'''move on the same layer''': In the Frogger game, the Truck agent moves to the right once every half a second, as long as there is road there (second rule in the behavior below).&nbsp;
+
'''Move after 2 second: '''This agent has two methods delayed_moved and move, when it receives a delayed_move message it will wait 2 second then call its own move method which will move it randomly. &nbsp;  
  
 +
[[Image:Delayed-message2.png]]
  
 +
<br>
  
|-
 
| width="80" valign="top" align="left" | '''Example 2:'''
 
| width="100%" valign="top" align="left" | '''move between layers''': In the 3D Matrix game, in its "Lift" method, the Nebuchadnezzar agent moves to the layer above it if the shift and up arrow key are pressed together and if at that position in the layer above, there is a Hole agent (first rule). Similarly, it moves to the layer below it if the shift and down arrow key are pressed together and if at that position in the layer above, there is a Hole agent (second rule). [[Image:Move action example2.png|500px|Move action example2.png]]
 
 
|}
 
|}
  
 
[[Category:AgentCubes_Actions]]
 
[[Category:AgentCubes_Actions]]

Revision as of 22:34, 4 April 2012

150px

Definition: The delayed-message action will trigger a message in this agent after a specified amount of time. Note that it is not possible to send delayed messages to other agents. 
Parameters: method, time
Example 1:

Move after 2 second: This agent has two methods delayed_moved and move, when it receives a delayed_move message it will wait 2 second then call its own move method which will move it randomly.  

Delayed-message2.png