Difference between revisions of "Manual:DIL Manual/UNIT ST OBJ"

From DikuMUD Wiki
Jump to navigation Jump to search
(XML import)
(checked against the compiler and the interpreter; example compiles)
 
Line 1: Line 1:
−
<span id="uobj"></span>
+
= UNIT_ST_OBJ =
−
'''if the type is UNIT_ST_OBJ'''
+
'''Constant''' (integer, vme.h: 0x08).
  
−
      'objecttype'  :integer (RW)
+
An object: a weapon, a container, a key, money, a corpse. <code>u.type == UNIT_ST_OBJ</code>. The type of a unit is in its <code>type</code> field; the four unit types are bits, so they can be combined with <code>|</code>.
−
          The type of an object, see ITEM_* in values.h and/or vme.h for types.
 
−
      'value'[]      :integer (RW)
 
−
          Values for an object. The meaning of the values differ
 
−
          from object type to object type. Index should be [0..4].
 
−
          These values are used differently for each object type.
 
−
      'objectflags'  :integer (RW)
 
−
          Bits specifying special properties for an object. Some
 
−
          combinations may not be logical, see OBJ_* in values.h and/or vme.h
 
−
      'cost'        :integer (RW)
 
−
          The basic cost of an object. (old gold value)
 
−
      'rent'        :integer (RW)
 
−
          The basic cost of renting an object. Mostly used on very
 
−
          special objects. (old gold value)
 
−
      'equip'        :integer (RO)
 
−
          The position in equipment. This is used by units in a PC/NPC's
 
−
          inventory to tell if they are equipped by that PC/NPC.
 
−
          use the 'addequip()' and 'unequip()' procedures.
 
−
<span id="uobj"></span>
 
−
'''if the type is UNIT_ST_OBJ'''
 
  
−
      'objecttype'  :integer (RW)
+
== Fields ==
−
          The type of an object, see ITEM_* in values.h and/or vme.h for types.
+
Only objects have: [[Manual:DIL Manual/objecttype|objecttype]], [[Manual:DIL Manual/value|value]], [[Manual:DIL Manual/objectflags|objectflags]], [[Manual:DIL Manual/cost|cost]], [[Manual:DIL Manual/rent|rent]], [[Manual:DIL Manual/equip|equip]]. What the five <code>value[]</code> numbers mean depends on <code>objecttype</code> (<code>ITEM_*</code> in values.h).
−
      'value'[]     :integer (RW)
+
 
−
          Values for an object. The meaning of the values differ
+
== Notes ==
−
          from object type to object type. Index should be [0..4].
+
* Every unit, whatever its type, has the general fields: [[Manual:DIL Manual/name|name]], [[Manual:DIL Manual/names|names]], [[Manual:DIL Manual/title|title]], [[Manual:DIL Manual/descr|descr]], [[Manual:DIL Manual/outside descr|outside_descr]], [[Manual:DIL Manual/inside descr|inside_descr]], [[Manual:DIL Manual/extra|extra]], [[Manual:DIL Manual/type|type]], [[Manual:DIL Manual/symname|symname]], [[Manual:DIL Manual/nameidx|nameidx]], [[Manual:DIL Manual/zoneidx|zoneidx]], [[Manual:DIL Manual/zone|zone]], [[Manual:DIL Manual/key|key]], [[Manual:DIL Manual/outside|outside]], [[Manual:DIL Manual/inside|inside]], [[Manual:DIL Manual/next|next]], [[Manual:DIL Manual/gnext|gnext]], [[Manual:DIL Manual/gprevious|gprevious]], [[Manual:DIL Manual/flags|flags]], [[Manual:DIL Manual/manipulate|manipulate]], [[Manual:DIL Manual/openflags|openflags]], [[Manual:DIL Manual/opendiff|opendiff]], [[Manual:DIL Manual/weight|weight]], [[Manual:DIL Manual/baseweight|baseweight]], [[Manual:DIL Manual/capacity|capacity]], [[Manual:DIL Manual/height|height]], [[Manual:DIL Manual/light|light]], [[Manual:DIL Manual/bright|bright]], [[Manual:DIL Manual/illum|illum]], [[Manual:DIL Manual/minv|minv]], [[Manual:DIL Manual/alignment|alignment]], [[Manual:DIL Manual/hp|hp]], [[Manual:DIL Manual/max hp|max_hp]], [[Manual:DIL Manual/loadcount|loadcount]], [[Manual:DIL Manual/hasfunc|hasfunc]], [[Manual:DIL Manual/spells|spells]].
−
          These values are used differently for each object type.
+
* <code>spells[]</code> on an object is its magic resistance; the index is not used.
−
      'objectflags'  :integer (RW)
+
* An object that is worn has a <code>equip</code> position other than 0; <code>addequip()</code> and <code>unequip()</code> change it.
−
          Bits specifying special properties for an object. Some
+
* Reading a field the unit doesn't have fails, and a failed value is false in every comparison: test the type first.
−
          combinations may not be logical, see OBJ_* in values.h and/or vme.h
+
 
−
      'cost'        :integer (RW)
+
== Example ==
−
          The basic cost of an object. (old gold value)
+
<pre>
−
      'rent'        :integer (RW)
+
dilbegin integer pricey(obj : unitptr);
−
          The basic cost of renting an object. Mostly used on very
+
code
−
          special objects. (old gold value)
+
{
−
      'equip'        :integer (RO)
+
  if (obj.type != UNIT_ST_OBJ)
−
          The position in equipment. This is used by units in a PC/NPC's
+
      return (FALSE);
−
          inventory to tell if they are equipped by that PC/NPC.
+
  return (obj.cost > 10000);
−
          use the 'addequip()' and 'unequip()' procedures.
+
}
 +
dilend
 +
</pre>
 +
Tells whether a unit is an expensive object.
 +
 
 +
== See also ==
 +
* [[Manual:DIL Manual/type|type]]
 +
* [[Manual:DIL Manual/Fields|Fields]]
 +
* [[Manual:DIL Manual/UNIT ST PC|UNIT_ST_PC]]
 +
* [[Manual:DIL Manual/UNIT ST NPC|UNIT_ST_NPC]]
 +
* [[Manual:DIL Manual/UNIT ST PC and UNIT ST NPC|UNIT_ST_PC and UNIT_ST_NPC]]
 +
* [[Manual:DIL Manual/UNIT ST ROOM|UNIT_ST_ROOM]]

Latest revision as of 23:24, 14 November 2026

UNIT_ST_OBJ

Constant (integer, vme.h: 0x08).

An object: a weapon, a container, a key, money, a corpse. u.type == UNIT_ST_OBJ. The type of a unit is in its type field; the four unit types are bits, so they can be combined with |.

Fields

Only objects have: objecttype, value, objectflags, cost, rent, equip. What the five value[] numbers mean depends on objecttype (ITEM_* in values.h).

Notes

Example

dilbegin integer pricey(obj : unitptr);
code
{
   if (obj.type != UNIT_ST_OBJ)
      return (FALSE);
   return (obj.cost > 10000);
}
dilend

Tells whether a unit is an expensive object.

See also