carrier

carrier <object>

The creature carrying an object, if any.

Only objects held in a creature's inventory have a carrier. An object lying in a room, worn as equipment, or inside a container is not "carried" in this sense, so carrier returns null for it.

Arguments

Returns

A creature — the creature carrying the object — or null if nothing is carrying it.

Examples

after command (say) {
  oload 1
  let box [first [inventory $self]]
  do "say [name $box] is carried by [name [carrier $box]]."
}

After loading object vnum 1 into the owner's inventory, [carrier $box] is the owner Puff, so the mob says "a jail strongbox is carried by Puff."

Guard against an uncarried object by checking for null first:

after command (get) {
  let item [first [objects $self]]
  unless [isnull [carrier $item]]
  do "say [name [carrier $item]] is holding that."
}

The unless guard advances to the next matching handler when the item has no carrier, so the report only fires when someone is actually holding it.

See also