creatures

creatures <room|creature>

The living creatures in a room, as an iterable.

Given a room it lists that room's occupants; given a creature it lists the occupants of the room that creature is in (including the creature itself).

Arguments

Returns

An iterable whose elements are creatures. Consume it with each, count, first, select, or another iterable consumer. An empty or unresolved argument yields null.

Examples

after command (say) {
  do "say There are [count [creatures $self]] of us here."
}

[creatures $self] lists the living creatures in the owner's room. In the debug world that room holds three creatures, so [count ...] evaluates to 3 and the mob says "There are 3 of us here."

after command (wave) {
  each [creatures $self] { <bystander>
    do "smile $bystander"
  }
}

The iterable drives each: the mob smiles at every living creature present, one per pass. The block parameter <bystander> is declared inside the braces, right after {.

after command (say) {
  each [select [creatures $self] { <c> [ismob $c] }] { <m>
    do "say I see a mobile."
  }
}

select filters the iterable down to just the mobiles before each runs.

See also