Skip to content

tell

Syntax

tell(agent-id, variable, pair-expression)
tell(agent-list, variable, pair-expression)

Parameters

agent-id
An expression that evaluates to the ID of the other agent whose variable should be set.
agent-list
An expression that evaluates to a list of agent IDs whose variables should be set.
variable
The name of the variable to assign.
<pair-expression>
The expression to assign to the other agent's or agents' variable.

Description

Agent action which sets the given variable for the agent whose ID is the value of the first argument to the value of the expression in the pair expression.

If the first argument is a list, then the given variable is set for each agent whose ID is in the list.

The pair-expression is evaluated with respect to the agent performing the action, but any occurrence of the special variable _ is replaced by the ID of the other agent specified by the first argument.

Examples

If the following action is executed by agent A and the value of agent A's my_friend variable is the ID of agent B, then the my_age_diff variable of agent B is set to agent A's age() minus agent B's age().

tell(my_friend, my_age_diff, age() - ask(_, age()))

In this case, ask(_, age()) evaluates to agent B's age.

See Also