Skip to main content

Of

Returns the value of a trait belonging to another agent (such as collidee or my parent).

Of block

Description

The Of block returns the value of a trait belonging to another agent (such as collidee or my parent). This is a code block part of the Traits drawer.

Usage

Returns the value of a trait belonging to another agent (such as collidee or my parent).

Syntax

Inputs in this block:

  • First input: a type of trait from the drop down menu
  • Second input: an agent block in the socket

Example

This is a model of bacterial growth and reproduction. Bacteria eat food in order to grow. After eating a sufficient amount, the bacteria will undergo mitosis and split into two new bacterial cells. Each lineage of bacteria has its own color, which has been established using the trait of block combined with the my parent block.

Of example code

Notes

The Of block is essential for accessing traits of other agents, enabling interactions and communication between agents in simulations.

  • My - Access an agent's own trait value
  • Set My to - Set an agent's own trait value
  • Set of to - Set another agent's trait value
  • My Parent - Reference to the agent that created this agent
  • Collidee - Reference to the agent being collided with