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

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="upc"></span>
+
= UNIT_ST_PC =
−
'''if the type is UNIT_ST_PC'''
+
'''Constant''' (integer, vme.h: 0x02).
  
−
      'birth'        :integer (RO)
+
A player character. <code>u.type == UNIT_ST_PC</code> is true for a player, also one who is switched into a monster (the monster itself stays <code>UNIT_ST_NPC</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 time a PC was created.
 
−
  'editing'        :integer (RO)
 
−
    Is the PC editing?  TRUE for yes FALSE for no.
 
−
      'hometown'      :integer (RO)
 
−
          The hometown of a PC.
 
−
      'pcflags'      :integer (RW)
 
−
          The setup of player options. See PC_* in values.h and/or vme.h
 
−
      'playtime'      :integer (RO)
 
−
          The time a PC has played.
 
−
      'skill_points'  :integer (RW)
 
−
          The amount of unused skill points the PC has.
 
−
      'ability_points' :integer (RW)
 
−
          The amount of unused ability points the PC has.
 
−
        'exptol' :integer (RW)
 
−
          The amount of experience player needs to level
 
−
      'skills'[]    :integer (RO)
 
−
          The skills of a PC. Index should be SKI_* in values.h and/or vme.h
 
−
      'guild'        :string (RW)
 
−
          The guild the PC belongs to.
 
−
      'prompt'        :string (RW)
 
−
          The players prompt string..
 
−
      'crimes'      :integer (RW)
 
−
          The number of crimes the PC has.
 
−
      'full'        :integer (RW)
 
−
          How hungry the PC is.
 
−
      'thirst'      :integer (RW)
 
−
          How thirsty the PC is.
 
−
      'drunk'        :integer (RW)
 
−
          How drunk the PC is.
 
−
      'quests'      :extraptr (RW)
 
−
          The quests a PC is finishing/has finished.
 
−
      'info'        :extraptr (RW)
 
−
          The info structure of a PC.
 
−
      'acc_balance'  : integer (RO)
 
−
          If the game is in accounting mode, then this returns the balance
 
−
          of the player, what would be shown on balance in wstat <player> acc.
 
−
      'acc_total'  : integer (RO)
 
−
          If the game is in accounting mode, then this returns the total
 
−
          credit of the player, what would be shown on total in wstat
 
−
          &ltplayer&gt acc.
 
−
<span id="upc"></span>
 
−
'''if the type is UNIT_ST_PC'''
 
  
−
      'birth'        :integer (RO)
+
== Fields ==
−
          The time a PC was created.
+
Players have the fields of all characters (see [[Manual:DIL Manual/UNIT ST PC and UNIT ST NPC|UNIT_ST_PC and UNIT_ST_NPC]]) and these, which only players have: [[Manual:DIL Manual/acc balance|acc_balance]], [[Manual:DIL Manual/acc total|acc_total]], [[Manual:DIL Manual/ability costs|ability_costs]], [[Manual:DIL Manual/ability levels|ability_levels]], [[Manual:DIL Manual/ability points|ability_points]], [[Manual:DIL Manual/birth|birth]], [[Manual:DIL Manual/crimes|crimes]], [[Manual:DIL Manual/drunk|drunk]], [[Manual:DIL Manual/editing|editing]], [[Manual:DIL Manual/full|full]], [[Manual:DIL Manual/guild|guild]], [[Manual:DIL Manual/hometown|hometown]], [[Manual:DIL Manual/idx|idx]], [[Manual:DIL Manual/info|info]], [[Manual:DIL Manual/lastroom|lastroom]], [[Manual:DIL Manual/lifespan|lifespan]], [[Manual:DIL Manual/pcflags|pcflags]], [[Manual:DIL Manual/playtime|playtime]], [[Manual:DIL Manual/profession|profession]], [[Manual:DIL Manual/prompt|prompt]], [[Manual:DIL Manual/quests|quests]], [[Manual:DIL Manual/skill costs|skill_costs]], [[Manual:DIL Manual/skill levels|skill_levels]], [[Manual:DIL Manual/skill points|skill_points]], [[Manual:DIL Manual/skills|skills]], [[Manual:DIL Manual/spell costs|spell_costs]], [[Manual:DIL Manual/spell levels|spell_levels]], [[Manual:DIL Manual/thirst|thirst]], [[Manual:DIL Manual/vlevel|vlevel]], [[Manual:DIL Manual/weapon costs|weapon_costs]], [[Manual:DIL Manual/weapon levels|weapon_levels]].
−
  'editing'        :integer (RO)
+
 
−
    Is the PC editing?  TRUE for yes FALSE for no.
+
== Notes ==
−
      'hometown'      :integer (RO)
+
* 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]].
−
          The hometown of a PC.
+
* In the global list all players come first: <code>ghead()</code> starts with them, and a walk with <code>.gnext</code> can stop at the first unit that isn't <code>UNIT_ST_PC</code>.
−
      'pcflags'      :integer (RW)
+
* On a player, <code>level</code>, <code>vlevel</code>, <code>exp</code>, <code>max_hp</code>, <code>profession</code>, <code>lifespan</code>, <code>abilities</code>, <code>skills</code>, <code>spells</code>, <code>weapons</code> and their <code>*_levels</code> can only be assigned by a program in a zone with access level 0 (the fourth column of <code>vme/etc/zonelist</code>). Elsewhere they can be read, but an assignment stops the program with a type error in the log.
−
          The setup of player options. See PC_* in values.h and/or vme.h
+
* Reading a field the unit doesn't have fails, and a failed value is false in every comparison: test the type first.
−
      'playtime'      :integer (RO)
+
 
−
          The time a PC has played.
+
== Example ==
−
      'skill_points'  :integer (RW)
+
<pre>
−
          The amount of unused skill points the PC has.
+
dilbegin hungry(pc : unitptr);
−
      'ability_points' :integer (RW)
+
code
−
          The amount of unused ability points the PC has.
+
{
−
        'exptol' :integer (RW)
+
  if (pc.type != UNIT_ST_PC)
−
          The amount of experience player needs to level
+
       return;
−
      'skills'[]    :integer (RO)
+
  if (pc.full < 4)
−
          The skills of a PC. Index should be SKI_* in values.h and/or vme.h
+
       sendtext("Your stomach rumbles.<br/>", pc);
−
      'guild'        :string (RW)
+
  return;
−
          The guild the PC belongs to.
+
}
−
      'prompt'        :string (RW)
+
dilend
−
          The players prompt string..
+
</pre>
−
      'crimes'       :integer (RW)
+
Tells a player who is getting hungry; <code>full</code> exists only on players.
−
          The number of crimes the PC has.
+
 
−
      'full'        :integer (RW)
+
== See also ==
−
          How hungry the PC is.
+
* [[Manual:DIL Manual/type|type]]
−
      'thirst'       :integer (RW)
+
* [[Manual:DIL Manual/Fields|Fields]]
−
          How thirsty the PC is.
+
* [[Manual:DIL Manual/UNIT ST NPC|UNIT_ST_NPC]]
−
      'drunk'        :integer (RW)
+
* [[Manual:DIL Manual/UNIT ST PC and UNIT ST NPC|UNIT_ST_PC and UNIT_ST_NPC]]
−
          How drunk the PC is.
+
* [[Manual:DIL Manual/UNIT ST OBJ|UNIT_ST_OBJ]]
−
      'quests'      :extraptr (RW)
+
* [[Manual:DIL Manual/UNIT ST ROOM|UNIT_ST_ROOM]]
−
          The quests a PC is finishing/has finished.
 
−
      'info'        :extraptr (RW)
 
−
          The info structure of a PC.
 
−
      'acc_balance'  : integer (RO)
 
−
          If the game is in accounting mode, then this returns the balance
 
−
          of the player, what would be shown on balance in wstat <player> acc.
 
−
      'acc_total'  : integer (RO)
 
−
          If the game is in accounting mode, then this returns the total
 
−
          credit of the player, what would be shown on total in wstat
 
−
          &ltplayer&gt acc.
 

Latest revision as of 23:24, 14 November 2026

UNIT_ST_PC

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

A player character. u.type == UNIT_ST_PC is true for a player, also one who is switched into a monster (the monster itself stays UNIT_ST_NPC). The type of a unit is in its type field; the four unit types are bits, so they can be combined with |.

Fields

Players have the fields of all characters (see UNIT_ST_PC and UNIT_ST_NPC) and these, which only players have: acc_balance, acc_total, ability_costs, ability_levels, ability_points, birth, crimes, drunk, editing, full, guild, hometown, idx, info, lastroom, lifespan, pcflags, playtime, profession, prompt, quests, skill_costs, skill_levels, skill_points, skills, spell_costs, spell_levels, thirst, vlevel, weapon_costs, weapon_levels.

Notes

Example

dilbegin hungry(pc : unitptr);
code
{
   if (pc.type != UNIT_ST_PC)
      return;
   if (pc.full < 4)
      sendtext("Your stomach rumbles.<br/>", pc);
   return;
}
dilend

Tells a player who is getting hungry; full exists only on players.

See also