Libraries‎ > ‎Library‎ > ‎Attributes‎ > ‎

Set two attributes

BehaviourComposer: ignore everything before this.

Begin micro-behaviour:
Begin description:
Set two attributes, parameters, or NetLogo variables to new values.
End description

Set two attributes

Begin NetLogo code:
substitute-text-area-for attribute-name-1 my-a
substitute-text-area-for attribute-value-1 1
substitute-text-area-for attribute-name-2 my-b
substitute-text-area-for attribute-value-2 2
set attribute-name-1 
    attribute-value-1
set attribute-name-2 
    attribute-value-2
End NetLogo code

Variants

Change the attribute name in the first and third text areas whatever attributes you want to create or set. If the name begins with 'my-' or 'my-next-' then the system will treat it as an attribute of an agent. If the name ends with '-of-patch' then it treated as an attribute of the patch running this behaviour. If it begins with 'the-' then it is treated as a parameter (i.e. global or model variable). Otherwise it is assumed to be a NetLogo variable.

The second and fourth text areas can contain any value or an expression that will evaluate to a value. To repeatedly update these attribute use the 'Enhance' menu to make this repeat.

How this works
The BehaviourComposer treats specially variables whose name begins with "my-" or "my-next-".  Note that, unlike NetLogo, you don't need to declare "breed" variables. More details in the programming guide.

Related micro-behaviours

History

Set two attribute was implemented by Ken Kahn.
BehaviourComposer: ignore everything after this.
Comments