Difference between revisions of "Manual:DIL Manual/unitptr"

From DikuMUD Wiki
Jump to navigation Jump to search
(XML import of LLM wiki pages)
(XML import)
Tag: Replaced
Line 1: Line 1:
  
  
<span id="unit"></span>
+
<span id="uptr"></span>
  '''The unitptr has the following fields:'''
+
  '''Unitptr:'''
  
    unitptr:
+
  Unit pointers are used to keep track of units: rooms, players, non-player or
      'names'        :stringlist (RW)
+
  objects. Through a variable of this type you can access most of the information
          A list of names that matches the unit.
+
in a unit. Unitptr variables are 'volatile', and thus cleared whenever there is
      'name'        :string (RW)
+
a possibility that they are rendered unusable.
          The first name in the namelist in 'names'
 
      'outside_descr' :string (RW)
 
          The description of the unit from the 'outside'. f.inst.
 
          the description of a boat, seen from the outside.
 
      'inside_descr' :string (RW)
 
          The description of the unit from the 'inside'. f.inst.
 
          the description of a boat, seen from the inside.
 
      'next'        :unitptr (RO)
 
          The next unit in the local list of units. For instance, the
 
          units in the inventory of a PC, is linked with this field.
 
      'title'        :string (RW)
 
          The title of the unit.
 
      'extra'        :extraptr (RW)
 
          Extra descriptions of the unit (identify, look at, read etc.).
 
      'outside'      :unitptr (RO)
 
          The outside of the unit hierarchy (carried by, contained by).
 
          For instance, the contents of a bag have their 'outside'
 
          field pointing to the bag.
 
      'inside'      :unitptr (RO)
 
          The inside of the unit hierarchy (carry, contains).
 
          For instance the first unit in a PC's inventory is referenced
 
          by the 'inside' field.
 
      'key'      :string (RO)
 
          The key that will open this unitptr
 
          For instance "big_key@blackzon"
 
          by the 'inside' field.
 
      'gnext'        :unitptr (RO)
 
          Next unit in the global list of units.
 
      'gprevious'    :unitptr (RO)
 
          Previous unit in the global list of units.
 
      'hasfunc'      :integer (RO)
 
          Returns TRUE if unit has special functions attached to it.
 
      'max_hp'      :integer (RO/RW)
 
          The maximum hitpoints of unit, RO for players, RW for mobiles.
 
      'max_mana'      :integer (RO)
 
          The maximum mana of the character (player or mobile).
 
      'max_endurance' :integer (RO)
 
          The maximum endurance of the character (player or mobile).
 
      'lifespan'      :integer (RW)
 
          The lifespan of a character, write permission only on root access.
 
      'hp'          :integer (RW)
 
          The current hitpoints of unit. For objects, this can render
 
          it 'broken' by being set low. If an unit has -1 hitpoints
 
          its considered unbreakable.
 
      'manipulate'  :integer (RW)
 
          Bits that specify how unit can be handled, see MANIPULATE_*
 
          flags in values.h and/or vme.h
 
      'flags'        :integer (RW)
 
          Bits that specify different properties of a unit, see
 
          UNIT_FL_* in values.h and/or vme.h
 
      'baseweight'   :integer (RO)
 
          The empty weight of the unit. This can be set with the
 
          procedure 'setweight()'
 
      'weight'      :integer (RO)
 
          The current weight of the unit (and its contents).
 
      'capacity'    :integer (RW)
 
          The amount of weight the unit can contain.
 
      'height'      :integer (RW)
 
          The height of a PC/NPC, the length of a rope, the size of weapons,
 
          armours, and shields.
 
      'alignment'    :integer (RW)
 
          The alignment of the unit. [1000..-1000],
 
          1000 is good, 0 is neutral, -1000 is evil.
 
      'openflags'    :integer (RW)
 
          Bits thats specify how a unit may be opened, locked, etc,
 
          see EX_* in values.
 
      'light'        :integer (RO)
 
          How much light is inside the unit.
 
      'bright'      :integer (RO)
 
          How much the unit lights up. This can be set with the
 
          procedure 'setbright()'
 
      'illum'        :integer (RO)
 
          How much light units inside a transparent unit create
 
      'minv'        :integer (RW)
 
          The 'wizard invisibility' level.
 
      'spells'[]    :integer (RO)
 
          The defence/skill of the different spell spheres/spells
 
          The index should be one of the SPL_* in values.h and/or vme.h
 
      'zoneidx'      :string (RO)
 
          The unique database name (in the zone) for this unit.
 
      'nameidx'      :string (RO)
 
          The unique database zone name for this unit.
 
      'idx'      :integer (RO)
 
          The unique database index (in the zone) for this unit.
 
          This provides a smart alternative to check for zoneidx
 
          and nameidx. Thus if (u1.idx == u2.idx) then
 
          (u1.nameidx == u2.nameidx) and (u1.zoneidx == u2.zoneidx).
 
          Be warned, this value change between each reboot, so do not
 
          count on it for purposes of saving.
 
      'zone'        :string (RO)
 
          The name of the zone the unit is in.
 
      'type'        :integer (RO)
 
          The type of the unit, see UNIT_ST_* in values.h and/or vme.h
 
      'loadcount'    :integer (RO)
 
          Returns the number of units loaded in the game
 
          of this definition (zoneidx,nameidx / idx)
 

Revision as of 11:08, 4 December 2025


Unitptr:
  Unit pointers are used to keep track of units: rooms, players, non-player or
objects. Through a variable of this type you can access most of the information
in a unit. Unitptr variables are 'volatile', and thus cleared whenever there is
a possibility that they are rendered unusable.