Multiple objects Tags![]() Tag |
The collection of Tag objects that can be assigned to Bot and Cell objects.
The Tags collection methods and properties can only be accessed through the Bots or Cells collections. When a Tag is added at the collection level, a Tag object is created for all members of the collection. When a Tag is destroyed, it is destroyed for all members of the Bots/Cells collections.
An individual Tag object can be accessed and manipulated at both the Bots/Cells collection level and the Bot/Cell object level.
The Item method is the default method for the Tags object.
Tag names are case-insensitive. For example, the names "Alive" and "alive" are interpreted as the same name.
The following example creates a new Tag called "detect close bird" for the Bots collection. The Tag for each Bot object is initialized to false. Then each Bot is checked to see if it's closest neighbor Bot is within a distance of 20. If a close neighbor exists, the Tag is set to true.
Birds.Tags.Add "detect close bird"
Birds.Tags("detect close bird").value = False
For Each Bird In Birds
If Not(Bird.Closest(20) Is Nothing) then
Bird.Tags("detect close bird").Value = True
End If
Next Bird