BehaviourComposer: ignore everything before this. Begin micro-behaviour: Begin description:Set an attribute, parameter, or Netlogo variable to a new value.End description New value Begin NetLogo code: substitute-text-area-for attribute-name my-attributesubstitute-text-area-for attribute-value value-of-attributeset attribute-name attribute-value End NetLogo code VariantsChange the attribute name in the first text area to whatever attribute 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 text area can contain any value or an expression that will evaluate to a value. To repeatedly update an attribute use the 'Enhance' menu to make this repeat. Examples using this behaviour include: Set my-heading to a random angle, Increase the age attribute on every tick, and Set the pen mode to 'down' so a trail is left as this agent moves. How this worksThe 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-behavioursSet two attributes, parameters, or NetLogo variables to new values sets two attributes at once. HistoryNew value was implemented by Ken Kahn. BehaviourComposer: ignore everything after this. |