exists
exists <value>
Whether a value is present — not null, and, for an entity reference, still pointing at a live entity.
For a creature, object, or room reference, exists checks that the entity
the reference names is still in the world. A reference to a creature that
has since been extracted, for example, is not live, so exists reports
false even though the reference itself is not null.
Arguments
<value>— any value.
Returns
A bool — true unless the value is null or a stale entity reference.
Examples
after command (say) {
require [exists $actor]
do "say I can tell that $actor is really here."
}
The guard lets the handler run only when $actor resolves to a live
creature; otherwise the script advances to the next matching handler (see
require).
after command (say) {
let target [first [creatures $self]]
do "say exists=[exists $target]."
}
When at least one creature shares the owner's room, [first ...] yields a
live creature and [exists $target] is true; in an empty room first
yields null and exists is false.