Conditions
Conditions are the IF rules. Select the appropriate condition in the list of conditions then drag it into the left side of a rule.
Current-world
The current-world condition checks if the agent executing it is in a certain world. This can be useful in games, for determining behavior based on which level your character is in.
Parameters
Level Name
Select the name of your level(s).
Empty
Check in a certain direction to see if that cell exists and is empty. Typically this is used to make sure you can move into a cell. All the cells beyond the edge of the world are considered NOT empty. That is you could NOT move there.
Parameters
Direction
The direction in which you check if there is an empty cell.
Layer
Relative layer reference: 0 = same layer, > 0 layers above, < 0 layers below.
Relative Mode
When turned on agent moves relative to it's "front". You can change the front of the agent by rotating it and or by moving the camera direction in the agent's first person view. Check out Relative Mode tutorial for more information.
First-person-view
True if the world is in first-person camera mode. False if the world is in bird's eye camera mode.
Has-attribute
True if the agent has this attribute.
Parameters
Direction
check the agent in which direction?
Attribute Name
The name of the attribute.
Layer
Relative layer reference: 0 = same layer, > 0 layers above, < 0 layers below.
Example
Relative Mode
When turned on agent moves relative to it's "front". You can change the front of the agent by rotating it and or by moving the camera direction in the agent's first person view. Check out Relative Mode tutorial for more information.
In the Ultimate Pacman project, the Red Ghost agent checks if the agent above it has the attribute p. It then compares this attribute p to the current maxp (the maximum p) and, if p is greater, sets maxp to p. The Red Ghost then changes its facial expression to look as if it is going upwards. This is part of the behavior for tracking down the Pacman agent (see the Ultimate Pacman "Readme" file for a complete explanation of the tracking behavior).
Is-selected
True if the agent is selected.
Example
If you have many agents of the same type but like to have only one of them be cursor key controlled then make the user click the agent to select it and write cursor key rules which will also check if the agent is selected. This way only one agent can be selected at one time and only this agent would be controlled through cursor keys.
Key
True if the specified key is pressed on keyboard.
Parameters
Key
A Key press from your keyboard including shift + key.
Next-to
True if there is a certain number of agents adjacent to me. Only check the eight agents immediately adjacent to me.
Parameters
Comparator
mathematical operator.
Number
How many (may be a number or VAT formula).
Shape
what shape layer: which layer to search for the target agent.
Layer
Relative layer reference: 0 = same layer, > 0 layers above, < 0 layers below.
Once-every
Checks every specfied number of seconds. The Once-every condition acts as a local timer for an agent. Unlike the Wait_Action, Once-every can be used to slow down individual agents without stopping other agents.
Parameters
Number
Attribute name, Number or VAT formula.
Example
See the “Clock” agent and the “@clock” simulation property in this project. Run the simulation and observe that the @clock simulation property is immediately set to 5, after which it is incremented by 5 every 5 seconds. So if the intended programming is for an event to be delayed by the specified amount before the rule executes, additional programming is required.
Once-every condition executes initially and then re-executes periodically according to the interval specified. For example, if the condition is “once every 5 seconds”, when simulation starts, that event will occur immediately and then subsequently every 5 seconds afterward.
Percent-chance
The Percent-chance condition succeeds with a certain percent chance, as specified by a number or formula. For instance, with a value of 50 this condition will succeed, on average, 50% of the time. The Percent Chance condition chooses a random number between 1 and 99 whenever it is executed. If this number is less than the number indicated in its number field, the condition is true. Otherwise, the condition is false. Use this to introduce randomness to an agent's behavior.
Parameters
Number
Attribute name, Number or VAT formula.
Specifying “0” as the operand produces no instances of a true condition and specifying “100” as the operand produces an unconditionally true result.
See
The See condition checks if the agent at the cell indicated by the Direction parameter looks for the shape specified in the Shape parameter. The agent can check its own shape.
Parameters
Direction
The direction to check for the target agent.
Shape
The specific agent shape of the target agent.
Layer
The See condition can check to see if the specified agent exists in a layer other than the current layer the agent resides on.
Relative Mode
When turned on agent moves relative to it's "front". You can change the front of the agent by rotating it and or by moving the camera direction in the agent's first person view. Check out Relative Mode tutorial for more information.
See-a
The See-A condition: checks if the agent at the cell indicated by the Direction parameter is of the class specified in the Agent Class Name parameter.
In contrast to the See Condition, the See-a condition picks out all the shapes of a given agent. Use it to identify an agent regardless of the way it looks.
Parameters
Direction
The direction to check for the target agent.
Agent class name
The type of agent to look for.
Layer
the See-a condition can check to see if the specified agent exists in a layer other than the current layer the agent resides on.
Relative Mode
When turned on agent moves relative to it's "front". You can change the front of the agent by rotating it and or by moving the camera direction in the agent's first person view. Check out Relative Mode tutorial for more information.
Stacked
The Stacked condition: checks if the agent's location in relation to the agent specified by the exact shapematches the adjacency choice
Parameters
Adjacency
where to look for the target agent.
Shape
The exact shape of an agent to look for.
Stacked-a
Checks if the agent's location in relation to the agent specified by the exact shapematches the adjacency choice.
The difference between the Stacked and the Stacked-A conditions is that the Stacked condition checks for a specific shape/look and is true only if the agent has that exact shape, whereas Stacked-A checks for any shape of the given agent and is true regardless of how the agent looks.
Parameters
Adjacency
where to look for the target agent.
Agent class name
The type of agent to look for.
Test
The Test condition compares the values of two formulae. If the comparison yields true, then the condition is true. Otherwise, it is false. Test is typically used to compare agent attributes or simulation properties to numbers or formulae that may contain other attributes or properties.
Parameters
Formula
Attribute name, Number or VAT formula.
Comparator
Comparator selector.
Formula
Attribute name, Number or VAT formula.
Yes-or-no-dialog
The Yes or No Dialog condition lets you write programs that can ask users yes/no questions and act based on their answer. Both the questions asked and the labels for the Yes/No answers can be customized by changing the text fields in the condition. If the user answers "Yes", the condition is true. If the user answers "No", the condition is false.
Parameters
String
Enter a question you want to pop up.
True string*
Enter a string for true, default "yes".
False string*
Enter a string for false, default "no".
* Text boxes may include: agent attribute values when the name is preceeded by ~ (for example: ~value) May also include the special values: ~self.row (agent's current row), ~self.column (agent's current column), and ~self.layer (agent's current layer)