contents
contents <object|room>
The objects inside a container or lying in a room, as an iterable.
- Given an object, it lists what that object contains.
- Given a room, it lists the objects on the ground there.
Arguments
<object|room>— the container or room to look inside. A value of any other type yields null.
Returns
An iterable whose elements are objects. Consume it with
each, count, first,
select, or another iterable consumer. An empty or
unresolved argument yields null.
Examples
after command (say) {
oload 1
do "say The box holds [count [contents [first [inventory $self]]]] items."
}
oload loads object vnum 1 (a strongbox) onto the owner;
[first [inventory $self]] is that box, and [contents ...] lists what
is inside it. The freshly loaded box is empty, so [count ...] evaluates
to 0 and the mob says "The box holds 0 items."
after command (say) {
do "say There are [count [contents [room $self]]] objects here."
}
Passing [room $self] lists the objects on the ground in the owner's
room. In the bare debug room this evaluates to 0.