Difference between revisions of "Delayed-Message Action"

From AgentCubes
Jump to navigation Jump to search
imported>Mike
imported>Corrina
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
[[Image:Delayed message.png|150px|Delayed message.png]]  
+
[[Image:Delayed message action.png|200px|Delayed message.png]]  
  
 
{| 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. Note that it is not possible to send delayed messages to other agents.&nbsp; Also note, that all delayed messages will be cleared when the simulation is started or stopped, and delayed messages will only be triggered in a running simulation.&nbsp; <br>
+
| width="100%" valign="top" align="left" | The '''delayed-message''' action: ''will trigger a message in this agent after a specified amount of time. Messages will only be triggered in a running simulation.''&nbsp; <br>
 
|-
 
|-
 
| width="80" valign="top" align="left" | '''Parameters:'''  
 
| width="80" valign="top" align="left" | '''Parameters:'''  
| width="100%" valign="top" align="left" | [[Method parameter|method]], [[Time parameter|time]]
+
| width="100%" valign="top" align="left" |  
 +
[[Method parameter|method]]: ''name of the message''
 +
 
 +
[[Time parameter|time]]: ''how long the delay will last, in seconds.''
 +
 
 
|-
 
|-
 
| 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" |  
'''Fading shield:'''&nbsp; Imagine you are creating somesort of space based action game where there are obstacles that you must avoid or take damage.&nbsp; In this sort of game you could use the delayed message action to create a shield which would activae upon a key press condition and which would be set to fade after a certain amount of time with the delayed action.&nbsp; In the following image we see a Spaceship ship agent's behavior.&nbsp; When the user presses the space key and the spaceship is not shielded it will change to the shielded shape and trigger a delayed message to call "Shields_Fade" in 3 seconds.&nbsp; After three seconds have passed "Shields_Fade" will be called and the spaceship will change back to its not shielded shape.&nbsp; <br>  
+
'''Fading shield:'''&nbsp; Imagine you are creating somesort of space based action game where there are obstacles that you must avoid or take damage.&nbsp; In this sort of game you could use the '''delayed message''' action to create a shield which would activae upon a key press condition and which would be set to fade after a certain amount of time with the '''delayed message''' action.&nbsp; In the following image we see a Spaceship agent's behavior.&nbsp; When the user presses the space key and the spaceship is not shielded, it will change to the shielded shape and trigger a delayed message to call "Shields_Fade" in 3 seconds.&nbsp; After three seconds have passed, "Shields_Fade" will be called and the spaceship will change back to its non shielded shape.&nbsp; <br>  
  
 
[[Image:Shields.png]]<br>  
 
[[Image:Shields.png]]<br>  

Latest revision as of 20:36, 20 April 2012

Delayed message.png

Definition: The delayed-message action: will trigger a message in this agent after a specified amount of time. Messages will only be triggered in a running simulation. 
Parameters:

method: name of the message

time: how long the delay will last, in seconds.

Example 1:

Fading shield:  Imagine you are creating somesort of space based action game where there are obstacles that you must avoid or take damage.  In this sort of game you could use the delayed message action to create a shield which would activae upon a key press condition and which would be set to fade after a certain amount of time with the delayed message action.  In the following image we see a Spaceship agent's behavior.  When the user presses the space key and the spaceship is not shielded, it will change to the shielded shape and trigger a delayed message to call "Shields_Fade" in 3 seconds.  After three seconds have passed, "Shields_Fade" will be called and the spaceship will change back to its non shielded shape. 

Shields.png