ENUM

From Creatures Wikia

Jump to: navigation, search

ENUM is a CAOS command which controls flow.

Usage

Syntax: ENUM family (int) genus (int) species (int)

This marks the start of an enumeration loop, which must be ended by NEXT. It cycles through every agent which matches the classifier: first setting TARG, then evaluating the content of the loop, then going on to the next agent, and so on until all agents of the given class number have been exhausted.

Any or all of the arguments may be 0, which is a wildcard. So ENUM 0 0 0 will loop through all agents.

At the end of the loop, TARG is set to OWNR - so store the original TARG somewhere else if it's important.

Example

Destroy all badbugs:

ENUM 2 14 0
  KILL TARG
NEXT

Limit elasticity of all toys:

ENUM 2 21 0
  DOIF ELAS gt 50
    ELAS 50
  ENDI
NEXT

Age all creatures to adult:

ENUM 4 0 0
  SETV va00 4
  SUBV va00 CAGE
  DOIF va00 gt 0
    AGES va00
  ENDI
NEXT

Show the bounding boxes of everything:

ENUM 0 0 0
  DCOR 1
NEXT

See also

  • ESEE - 'visible' enumeration loop
  • ETCH - 'touching' enumeration loop
  • EPAS - vehicle's passengers
  • ECON - port connections
Personal tools