location
location <object> <where>
Whether an object is currently at a named kind of location.
location takes an object and a place name, and reports whether the object
is held in that way. It is the precise counterpart to the broader
isholding/iswearing vnum tests: those
ask "is some object of vnum N here?", while location asks "where is
this object right now?".
Arguments
<object>— the object to inspect. A null or unresolved reference yields false.<where>— a string naming the place to test, one of:carried— carried in a creature's inventory;container— inside another object;worn— worn in an equipment slot;wielded— wielded as a weapon (primary or secondary);held— held in the hold slot;implanted— implanted in a creature;room— lying on the floor of a room.
Any other place name is a run-time error.
Returns
A bool — true if the object is at the named location, false otherwise.
Examples
after command (say) {
oload 1
let item [first [inventory $self]]
do "say carried=[location $item carried] room=[location $item room]."
}
oload puts object vnum 1 into the owner's inventory, so
[location $item carried] is true while [location $item room] is
false.
after command (wield) {
let weapon [first [equipment $actor]]
require [location $weapon wielded]
emit room "$self admires the blade $actor just drew."
}
The guard reacts only when the inspected object is actually wielded;
otherwise the script advances (see require).