Manual:DIL Manual/equipment()
Jump to navigation
Jump to search
equipment()
Function (unitptr). The object a character wears or wields in a given position.
equipment(ch : unitptr, pos : integer) : unitptr
Looks through what ch carries and returns the first object that is equipped in position pos, or null when nothing is there.
Parameters
| Name | Type | Meaning |
|---|---|---|
| ch | unitptr | The character (player or NPC) to look at. |
| pos | integer | A WEAR_* position from vme/include/vme.h, such as WEAR_WIELD, WEAR_HOLD, WEAR_SHIELD, WEAR_BODY or WEAR_FINGER_R.
|
Returns
The equipped object, or null when that position is empty. When ch is null or not a character, the call fails: a variable it is assigned to keeps its old value.
Notes
- The position is read as a number from 0 to 255. Position 0 means "not equipped", so
equipment(ch, 0)returns the first object in the inventory that isn't worn. UseWEAR_*values only. - It doesn't check the object's type:
equipment(ch, WEAR_WIELD)can be something other than a weapon. - The position of an object itself is its
equipfield.
Example
dilbegin show_wielded();
var
wpn : unitptr;
code
{
wpn := equipment(self, WEAR_WIELD);
if (wpn == null)
sendtext("You wield nothing.<br/>", self);
else
act("You wield $2n.", A_ALWAYS, self, wpn, null, TO_CHAR);
quit;
}
dilend
Tells the character what it is wielding.