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

From DikuMUD Wiki
Jump to navigation Jump to search
(XML import)
(manual index generated from the checked keyword pages)
 
Line 1: Line 1:
−
<span id="fields"></span>
+
A field is a value stored in a unit, an extra description, a zone or a command, read with a dot: <code>self.name</code>, <code>activator.hp</code>, <code>self.outside.title</code>. Fields can be chained, and a field of <code>null</code>, or one the unit doesn't have, fails: the program goes on, but the value counts as false in every comparison.
−
<h3>'''Fields:'''</h3>
 
  
−
The 'extraptr' and 'unitptr' types contain information which is available to
+
A field marked read/write can be assigned: <code>self.hp := 10;</code>. A read-only one can't (vmc says "Illegal lvalue"); many of those are changed with a procedure instead, as the field's page says. Fields that hold a list are indexed: <code>pc.skills[SKI_SEARCH]</code>, <code>room.exit_to[NORTH]</code>.
−
you by using fields. For example (self is a unitptr), self.inside is a
 
−
unitptr to what is inside the 'self' unit. (Hence '.inside' is the field).
 
−
And self.inside.outside is a unitptr to self (assuming that something is
 
−
actually inside self, otherwise self.inside would evaluate to null).
 
−
Some fields may not be changed by DIL programs directly but must be modified
 
−
indirectly using certain procedure calls in DIL. Others may not be changed
 
−
at all. All are readable for DIL programs.
 
  
−
The extraptr structure is used for several things. The primary is
+
The tables are by the kind of unit that has the field. A unit has the fields of "All units" as well; a player or an NPC also has the "Characters" fields. Using a field on a unit that doesn't have it fails, the same as a field of null.
−
extra descriptions for units, and quest data. Keywords in the 'names'
 
−
field and the actual description/data in the 'descr' field.
 
  
−
In the following (RW) means the value may be assigned new values by DIL,
+
__TOC__
−
while (RO) means the the value only can be read. A (RO) value might be
 
−
possible to change through built-in functions/procedures
 
−
---~---~---~---~---~---~---~---~---
 
−
<span id="fields"></span>
 
−
<h3>'''Fields:'''</h3>
 
  
−
The 'extraptr' and 'unitptr' types contain information which is available to
+
== All units ==
−
you by using fields. For example (self is a unitptr), self.inside is a
+
Every unit has these: rooms, objects, NPCs and players.
−
unitptr to what is inside the 'self' unit. (Hence '.inside' is the field).
+
{| class="wikitable"
−
And self.inside.outside is a unitptr to self (assuming that something is
+
! Field !! Type !! Access !! What it holds
−
actually inside self, otherwise self.inside would evaluate to null).
+
|-
−
Some fields may not be changed by DIL programs directly but must be modified
+
| [[Manual:DIL Manual/alignment|alignment]] || integer || read/write || How good or evil the unit is, from -1000 (evil) to 1000 (good).
−
indirectly using certain procedure calls in DIL. Others may not be changed
+
|-
−
at all. All are readable for DIL programs.
+
| [[Manual:DIL Manual/baseweight|baseweight]] || integer || read-only || The weight of the unit itself, in pounds, without anything it carries or contains: an empty bag, a character's body.
 +
|-
 +
| [[Manual:DIL Manual/bright|bright]] || integer || read-only || How much light the unit gives off: positive for a light source (a lit torch), negative for something that swallows light, 0 for most units.
 +
|-
 +
| [[Manual:DIL Manual/capacity|capacity]] || integer || read/write || How much the unit can hold inside it, in pounds: the <code>capacity</code> line in the zone file, 0 when it has none.
 +
|-
 +
| [[Manual:DIL Manual/editing|editing]] || integer || read-only (meaningful for PC) || TRUE while the player is writing in the text editor (a board post, a letter, a [[Manual:DIL Manual/beginedit()|beginedit()]] text), FALSE otherwise.
 +
|-
 +
| [[Manual:DIL Manual/extra|extra]] || extraptr || read-only || The first of the unit's extra descriptions, or null when it has none.
 +
|-
 +
| [[Manual:DIL Manual/flags|flags]] || integer || read/write || The unit flags, a bit set of <code>UNIT_FL_*</code> values from <code>vme.h</code>, shared by all kinds of unit.
 +
|-
 +
| [[Manual:DIL Manual/gnext|gnext]] || unitptr || read-only || The next unit in the game's global list of all units, or null after the last.
 +
|-
 +
| [[Manual:DIL Manual/gprevious|gprevious]] || unitptr || read-only || The unit before <code>u</code> in the game's global list of all units, or null for the first.
 +
|-
 +
| [[Manual:DIL Manual/hasfunc|hasfunc]] || integer || read-only || TRUE when the unit has at least one program attached, a DIL program or one of the server's special functions; FALSE when it has none.
 +
|-
 +
| [[Manual:DIL Manual/height|height]] || integer || read/write || The size of a unit, set with <code>height</code> in the zone file.
 +
|-
 +
| [[Manual:DIL Manual/hp|hp]] || integer || read/write || The unit's current hit points.
 +
|-
 +
| [[Manual:DIL Manual/idx|idx]] || integer || read-only || A number that tells one unit from another with the same [[Manual:DIL Manual/symname|symname]].
 +
|-
 +
| [[Manual:DIL Manual/illum|illum]] || integer || read-only || The part of a unit's [[Manual:DIL Manual/bright|bright]] that comes from what is inside it.
 +
|-
 +
| [[Manual:DIL Manual/inside|inside]] || unitptr || read-only || The first unit inside <code>u</code>, or null when it is empty.
 +
|-
 +
| [[Manual:DIL Manual/inside descr|inside_descr]] || string || read/write || What is seen from inside the unit.
 +
|-
 +
| [[Manual:DIL Manual/key|key]] || string || read/write (used on objects) || The key that locks and unlocks the unit, as <code>"keyname@zone"</code>, set with <code>key</code> in the zone file.
 +
|-
 +
| [[Manual:DIL Manual/light|light]] || integer || read-only || The light level inside the unit.
 +
|-
 +
| [[Manual:DIL Manual/loadcount|loadcount]] || integer || read-only || How many units made from the same definition (the same <code>nameidx@zoneidx</code>) are in the game right now, this one included.
 +
|-
 +
| [[Manual:DIL Manual/manipulate|manipulate]] || integer || read/write (used on objects) || What players can do with the unit, a bit set of <code>MANIPULATE_*</code> values from <code>vme.h</code>.
 +
|-
 +
| [[Manual:DIL Manual/max hp|max_hp]] || integer || read/write ¹ || The unit's maximum hit points; [[Manual:DIL Manual/hp|hp]] holds the current ones.
 +
|-
 +
| [[Manual:DIL Manual/minv|minv]] || integer || read/write || The unit's wizard invisibility level.
 +
|-
 +
| [[Manual:DIL Manual/name|name]] || string || read-only || The unit's first name (the first of its <code>names</code>); for a player, the player's name.
 +
|-
 +
| [[Manual:DIL Manual/nameidx|nameidx]] || string || read-only || The unit's name in its zone file: <code>"cityguard"</code> for <code>cityguard@midgaard</code>.
 +
|-
 +
| [[Manual:DIL Manual/names|names]] || stringlist || read/write || The names players use for the unit; the first is its name.
 +
|-
 +
| [[Manual:DIL Manual/next|next]] || unitptr || read-only || The next element of the list the value is in, or null after the last one.
 +
|-
 +
| [[Manual:DIL Manual/opendiff|opendiff]] || integer || read/write (used on containers) || How hard the unit's lock is to pick.
 +
|-
 +
| [[Manual:DIL Manual/openflags|openflags]] || integer || read/write (used on containers and other units that open) || Whether the unit opens, and whether it is closed or locked: a bit set of <code>EX_*</code> values from <code>vme.h</code>.
 +
|-
 +
| [[Manual:DIL Manual/outside|outside]] || unitptr || read-only || The unit that <code>u</code> is in.
 +
|-
 +
| [[Manual:DIL Manual/outside descr|outside_descr]] || string || read/write || The line a unit shows when it is seen from outside.
 +
|-
 +
| [[Manual:DIL Manual/spells|spells]] || integer || read/write ¹ || A character's skill in spell <code>i</code>; for an object or a room, its magic resistance.
 +
|-
 +
| [[Manual:DIL Manual/symname|symname]] || string || read-only || The unit's symbolic name, <code>"nameidx@zoneidx"</code>: <code>"corpse@death"</code>, or <code>"papi@_players"</code> for a player.
 +
|-
 +
| [[Manual:DIL Manual/title|title]] || string || read/write || The unit's title: for an object or an NPC, the short name the game's messages use.
 +
|-
 +
| [[Manual:DIL Manual/type|type]] || integer || read-only || What kind of unit it is: a <code>UNIT_ST_*</code> constant.
 +
|-
 +
| [[Manual:DIL Manual/weight|weight]] || integer || read-only || The total weight of the unit in pounds: its own weight ([[Manual:DIL Manual/baseweight|baseweight]]) plus everything inside it.
 +
|-
 +
| [[Manual:DIL Manual/zone|zone]] || string || read-only || The name of the zone the unit is in now: the zone of the room at the top of whatever holds it.
 +
|-
 +
| [[Manual:DIL Manual/zoneidx|zoneidx]] || string || read-only || The name of the zone the unit's definition comes from: <code>"midgaard"</code> for <code>cityguard@midgaard</code>.
 +
|}
  
−
The extraptr structure is used for several things. The primary is
+
== Characters ==
−
extra descriptions for units, and quest data. Keywords in the 'names'
+
NPCs and players (<code>UNIT_ST_NPC</code>, <code>UNIT_ST_PC</code>).
−
field and the actual description/data in the 'descr' field.
+
{| class="wikitable"
 +
! Field !! Type !! Access !! What it holds
 +
|-
 +
| [[Manual:DIL Manual/abilities|abilities]] || integer || read/write ¹ || One of the character's abilities.
 +
|-
 +
| [[Manual:DIL Manual/attack type|attack_type]] || integer || read/write || The weapon type a character fights with when not wielding a weapon.
 +
|-
 +
| [[Manual:DIL Manual/charflags|charflags]] || integer || read/write || The character flags: a bit field of <code>CHAR_*</code> values, defined in vme.h.
 +
|-
 +
| [[Manual:DIL Manual/defensive|defensive]] || integer || read/write || A flat bonus (or, below 0, penalty) to the character's defence.
 +
|-
 +
| [[Manual:DIL Manual/endurance|endurance]] || integer || read/write || A character's current endurance: the points that moving, fighting and some skills use up.
 +
|-
 +
| [[Manual:DIL Manual/exp|exp]] || integer || read/write ¹ || On a player, the experience points gained in total; on an NPC, the experience it is worth.
 +
|-
 +
| [[Manual:DIL Manual/fighting|fighting]] || unitptr || read-only || The character this character is hitting in melee: its current opponent. null when it is not fighting.
 +
|-
 +
| [[Manual:DIL Manual/follower|follower]] || unitptr || read-only || The first character that follows <code>ch</code>, or null when no one does.
 +
|-
 +
| [[Manual:DIL Manual/followercount|followercount]] || integer || read-only || How many characters follow this one directly: not their own followers. 0 when none.
 +
|-
 +
| [[Manual:DIL Manual/level|level]] || integer || read/write ¹ || The character's level.
 +
|-
 +
| [[Manual:DIL Manual/mana|mana]] || integer || read/write || A character's current mana: the points that spells cost.
 +
|-
 +
| [[Manual:DIL Manual/master|master]] || unitptr || read-only || The character that <code>ch</code> follows, or null when it follows no one.
 +
|-
 +
| [[Manual:DIL Manual/max endurance|max_endurance]] || integer || read-only || The most endurance the character can have.
 +
|-
 +
| [[Manual:DIL Manual/max mana|max_mana]] || integer || read-only || The character's maximum mana; [[Manual:DIL Manual/mana|mana]] holds the current amount.
 +
|-
 +
| [[Manual:DIL Manual/natural armour|natural_armour]] || integer || read/write || The armour type of a character's own skin, used where no worn armour covers the spot that is hit.
 +
|-
 +
| [[Manual:DIL Manual/offensive|offensive]] || integer || read/write || A flat bonus (or, below 0, penalty) to the character's attacks.
 +
|-
 +
| [[Manual:DIL Manual/opponentcount|opponentcount]] || integer || read-only || How many characters this one is in combat with.
 +
|-
 +
| [[Manual:DIL Manual/position|position]] || integer || read/write || The character's position, a <code>POSITION_*</code> constant from vme.h.
 +
|-
 +
| [[Manual:DIL Manual/race|race]] || integer || read/write || The character's race, a <code>RACE_</code> constant from values.h.
 +
|-
 +
| [[Manual:DIL Manual/sex|sex]] || integer || read/write || The character's sex: <code>SEX_NEUTRAL</code> (0), <code>SEX_MALE</code> (1) or <code>SEX_FEMALE</code> (2), from vme.h.
 +
|-
 +
| [[Manual:DIL Manual/speed|speed]] || integer || read-only || The character's combat speed: lower is faster.
 +
|-
 +
| [[Manual:DIL Manual/switched|switched]] || unitptr || read-only || Who is controlled through a <code>switch</code>.
 +
|-
 +
| [[Manual:DIL Manual/weapons|weapons]] || integer || read/write ¹ || A character's skill, in percent, with a weapon.
 +
|}
  
−
In the following (RW) means the value may be assigned new values by DIL,
+
== Players ==
−
while (RO) means the the value only can be read. A (RO) value might be
+
Players only (<code>UNIT_ST_PC</code>), besides the character fields.
−
possible to change through built-in functions/procedures
+
{| class="wikitable"
−
---~---~---~---~---~---~---~---~---
+
! Field !! Type !! Access !! What it holds
 +
|-
 +
| [[Manual:DIL Manual/ability costs|ability_costs]] || integer || read-only || The player's racial modifier for training ability <code>i</code>.
 +
|-
 +
| [[Manual:DIL Manual/ability levels|ability_levels]] || integer || read/write ¹ || How many times the player has trained ability <code>i</code> since the last level gained.
 +
|-
 +
| [[Manual:DIL Manual/ability points|ability_points]] || integer || read/write || The player's unspent ability points: training an ability (strength, dexterity, ...) at a teacher costs them.
 +
|-
 +
| [[Manual:DIL Manual/acc balance|acc_balance]] || integer || read-only || The credit left on the player's account, in coin units, when the game runs with accounting.
 +
|-
 +
| [[Manual:DIL Manual/acc total|acc_total]] || integer || read-only || The total credit paid in to the player's account to date, in coin units, when the game runs with accounting.
 +
|-
 +
| [[Manual:DIL Manual/birth|birth]] || integer || read/write || When the player was born, in real seconds since 1970 like [[Manual:DIL Manual/realtime|realtime]].
 +
|-
 +
| [[Manual:DIL Manual/crimes|crimes]] || integer || read/write || A count of the crimes the player has been charged with, saved with the player.
 +
|-
 +
| [[Manual:DIL Manual/drunk|drunk]] || integer || read/write || How drunk the player is: 0 is sober.
 +
|-
 +
| [[Manual:DIL Manual/exptol|exptol]] || integer || read-only || The experience a player still needs for the next level.
 +
|-
 +
| [[Manual:DIL Manual/full|full]] || integer || read/write || How well fed the player is.
 +
|-
 +
| [[Manual:DIL Manual/guild|guild]] || string || read/write || The name of the player's main (default) guild, e.g. <code>"Udgaard Fighter"</code>.
 +
|-
 +
| [[Manual:DIL Manual/hometown|hometown]] || string || read/write || The symbolic name of the player's home room, such as <code>"temple@udgaard"</code>.
 +
|-
 +
| [[Manual:DIL Manual/info|info]] || extraptr || read-only || A player's administrative extra descriptions.
 +
|-
 +
| [[Manual:DIL Manual/lastroom|lastroom]] || unitptr || read-only || Meant to give the room the server will put the player back in: the room the player was in when last saved, or when the connection was lost.
 +
|-
 +
| [[Manual:DIL Manual/lifespan|lifespan]] || integer || read/write ¹ || How old, in mud years, the player can grow.
 +
|-
 +
| [[Manual:DIL Manual/pcflags|pcflags]] || integer || read/write || A player's option and status bits.
 +
|-
 +
| [[Manual:DIL Manual/playtime|playtime]] || integer || read-only || How long the player has been logged in, in total, in real seconds.
 +
|-
 +
| [[Manual:DIL Manual/profession|profession]] || integer || read/write ¹ || The player's profession: a <code>PROFESSION_</code> constant from values.h, <code>PROFESSION_FIGHTER</code> to <code>PROFESSION_BARBARIAN</code>.
 +
|-
 +
| [[Manual:DIL Manual/prompt|prompt]] || string || read/write || The player's prompt template, as set with the <code>prompt</code> command.
 +
|-
 +
| [[Manual:DIL Manual/quests|quests]] || extraptr || read-only || The player's quest list: a list of extras, like <code>.extra</code>, saved with the player.
 +
|-
 +
| [[Manual:DIL Manual/skill costs|skill_costs]] || integer || read-only || Despite the name, not a price: the player's racial modifier for the skill with that index, from -3 to +3.
 +
|-
 +
| [[Manual:DIL Manual/skill levels|skill_levels]] || integer || read/write ¹ || How many times the player has trained the skill with that index since gaining the current level.
 +
|-
 +
| [[Manual:DIL Manual/skill points|skill_points]] || integer || read/write || The player's unspent skill points.
 +
|-
 +
| [[Manual:DIL Manual/skills|skills]] || integer || read/write ¹ || A player's skill, in percent, in the skill with that index.
 +
|-
 +
| [[Manual:DIL Manual/spell costs|spell_costs]] || integer || read-only || How easy spell <code>i</code> is for the player's race to learn.
 +
|-
 +
| [[Manual:DIL Manual/spell levels|spell_levels]] || integer || read/write ¹ || How many times the player has practised spell <code>i</code> since the last level gained.
 +
|-
 +
| [[Manual:DIL Manual/thirst|thirst]] || integer || read/write || How well watered the player is.
 +
|-
 +
| [[Manual:DIL Manual/vlevel|vlevel]] || integer || read/write ¹ || The player's virtual level.
 +
|-
 +
| [[Manual:DIL Manual/weapon costs|weapon_costs]] || integer || read-only at run time || The player's race modifier for the weapon <code>idx</code>, from the <code>race &lt;name&gt; = N</code> lines in <code>vme/etc/weapons.def</code>.
 +
|-
 +
| [[Manual:DIL Manual/weapon levels|weapon_levels]] || integer || read/write ¹ || How many times the player has trained the weapon <code>idx</code> since gaining the current level.
 +
|}
 +
 
 +
== NPCs ==
 +
NPCs only (<code>UNIT_ST_NPC</code>), besides the character fields.
 +
{| class="wikitable"
 +
! Field !! Type !! Access !! What it holds
 +
|-
 +
| [[Manual:DIL Manual/defaultpos|defaultpos]] || integer || read/write || An NPC's default position, a <code>POSITION_*</code> constant from vme.h.
 +
|-
 +
| [[Manual:DIL Manual/npcflags|npcflags]] || integer || read/write || An NPC's NPC flags, a bit field set in the zone file with <code>npcflags {...}</code> in the mobile.
 +
|}
 +
 
 +
== Objects ==
 +
Objects only (<code>UNIT_ST_OBJ</code>).
 +
{| class="wikitable"
 +
! Field !! Type !! Access !! What it holds
 +
|-
 +
| [[Manual:DIL Manual/cost|cost]] || integer || read/write || What the object is worth, in the money's base unit (an iron piece is <code>IRON_MULT</code>, 10; a gold piece <code>GOLD_MULT</code>; vme.h).
 +
|-
 +
| [[Manual:DIL Manual/equip|equip]] || integer || read-only || Where the object is worn or held.
 +
|-
 +
| [[Manual:DIL Manual/objectflags|objectflags]] || integer || read/write || The object's flags, set with <code>romflags</code> in the object's zone definition (<code>flags</code> there sets the unit flags).
 +
|-
 +
| [[Manual:DIL Manual/objecttype|objecttype]] || integer || read/write || What kind of object it is: one of the <code>ITEM_*</code> constants in vme.h.
 +
|-
 +
| [[Manual:DIL Manual/rent|rent]] || integer || read/write || What the object costs its owner to keep, per real day, in the money's base unit (as [[Manual:DIL Manual/cost|cost]]).
 +
|-
 +
| [[Manual:DIL Manual/value|value]] || integer || read/write || The object's five numbers, <code>value[0]</code> to <code>value[4]</code>, set with <code>value[i]</code> lines in the zone file.
 +
|}
 +
 
 +
== Rooms ==
 +
Rooms only (<code>UNIT_ST_ROOM</code>).
 +
{| class="wikitable"
 +
! Field !! Type !! Access !! What it holds
 +
|-
 +
| [[Manual:DIL Manual/exit diff|exit_diff]] || integer || read/write || The difficulty of the room's exit in direction <code>dir</code>, set with <code>difficulty</code> on the exit in the zone file (0 to 250).
 +
|-
 +
| [[Manual:DIL Manual/exit info|exit_info]] || integer || read/write || The flags of the exit in direction <code>dir</code>: whether it has a door and what state it is in.
 +
|-
 +
| [[Manual:DIL Manual/exit key|exit_key]] || string || read/write || The key that locks and unlocks the room's exit in direction <code>dir</code>, as <code>"keyname@zone"</code> in lower case, set with <code>key</code> on the exit in the zone file.
 +
|-
 +
| [[Manual:DIL Manual/exit names|exit_names]] || stringlist || read/write || The names of the door or opening in direction <code>dir</code>: what a player types to open, close, lock or unlock it.
 +
|-
 +
| [[Manual:DIL Manual/exit to|exit_to]] || unitptr || read-only || The room that the exit in direction <code>dir</code> leads to, or null when the room has no exit that way.
 +
|-
 +
| [[Manual:DIL Manual/mapx|mapx]] || integer || read-only || The room's X coordinate on the graphical map, set with <code>gmap(x, y)</code> in the zone file; -1 when the room has none.
 +
|-
 +
| [[Manual:DIL Manual/mapy|mapy]] || integer || read-only || The room's Y coordinate on the graphical map, set with <code>gmap(x, y)</code> in the zone file; -1 when the room has none.
 +
|-
 +
| [[Manual:DIL Manual/movement|movement]] || integer || read/write || The room's terrain, set with <code>movement</code> in the zone file.
 +
|-
 +
| [[Manual:DIL Manual/roomflags|roomflags]] || integer || read/write || Bit flags of a room, set with <code>romflags</code> in the zone file.
 +
|}
 +
 
 +
== extraptr ==
 +
Fields of an extra description (an extraptr).
 +
{| class="wikitable"
 +
! Field !! Type !! Access !! What it holds
 +
|-
 +
| [[Manual:DIL Manual/descr|descr]] || string || read/write || The text of an extra description: what a player sees on <code>look at</code> the extra's name.
 +
|-
 +
| [[Manual:DIL Manual/name|name]] || string || read-only || The extra description's first name (keyword).
 +
|-
 +
| [[Manual:DIL Manual/names|names]] || stringlist || read/write || The keywords the extra description answers to.
 +
|-
 +
| [[Manual:DIL Manual/next|next]] || extraptr || read-only || The next element of the list the value is in, or null after the last one.
 +
|-
 +
| [[Manual:DIL Manual/vals|vals]] || intlist || read/write || The list of integers kept with an extra description.
 +
|}
 +
 
 +
== zoneptr ==
 +
Fields of a zone.
 +
{| class="wikitable"
 +
! Field !! Type !! Access !! What it holds
 +
|-
 +
| [[Manual:DIL Manual/access|access]] || integer || read-only || The zone's access level: the fourth column of <code>vme/etc/zonelist</code>, 0 to 255, where 0 is the most trusted.
 +
|-
 +
| [[Manual:DIL Manual/creators|creators]] || stringlist || read/write || The names of the zone's creators.
 +
|-
 +
| [[Manual:DIL Manual/fname|fname]] || string || read-only || The zone's name, the same as [[Manual:DIL Manual/name|name]] on a zoneptr: <code>"midgaard"</code>.
 +
|-
 +
| [[Manual:DIL Manual/help|help]] || string || read-only in practice || The zone's help text for players: the <code>help</code> text in the zone file's <code>%zone</code> header.
 +
|-
 +
| [[Manual:DIL Manual/loadlevel|loadlevel]] || integer || read-only || The level a god needs to <code>load</code> objects and NPCs from the zone, unless the god's name is in the zone's [[Manual:DIL Manual/creators|creators]].
 +
|-
 +
| [[Manual:DIL Manual/name|name]] || string || read-only || The zone's name, as in <code>sym@zone</code>.
 +
|-
 +
| [[Manual:DIL Manual/next|next]] || zoneptr || read-only || The next element of the list the value is in, or null after the last one.
 +
|-
 +
| [[Manual:DIL Manual/notes|notes]] || string || read-only in practice || The zone's notes from its creators: the <code>notes</code> text in the zone file's <code>%zone</code> header.
 +
|-
 +
| [[Manual:DIL Manual/npccount|npccount]] || integer || read-only || Meant to be the number of NPCs the zone defines, but the server never counts them: it is always 0.
 +
|-
 +
| [[Manual:DIL Manual/npcs|npcs]] || unitptr || read-only || A copy, in the game, of the zone's NPC whose symbolic name sorts first.
 +
|-
 +
| [[Manual:DIL Manual/objcount|objcount]] || integer || read-only || Meant to be the number of objects the zone defines, but the server never counts them: it is always 0.
 +
|-
 +
| [[Manual:DIL Manual/objs|objs]] || unitptr || read-only || A copy, in the game, of the zone's object whose symbolic name sorts first.
 +
|-
 +
| [[Manual:DIL Manual/payonly|payonly]] || integer || read-only || Whether the zone is only for paying players: the sixth column of <code>vme/etc/zonelist</code> (0 when missing).
 +
|-
 +
| [[Manual:DIL Manual/resetmode|resetmode]] || integer || read-only || How the zone resets, as set with <code>reset</code> in the zone file's <code>%zone</code> header.
 +
|-
 +
| [[Manual:DIL Manual/resettime|resettime]] || integer || read-only || The minutes between two resets of the zone.
 +
|-
 +
| [[Manual:DIL Manual/roomcount|roomcount]] || integer || read-only || The number of rooms the zone defines: the rooms read from its <code>.data</code> file at boot.
 +
|-
 +
| [[Manual:DIL Manual/rooms|rooms]] || unitptr || read-only || One room of the zone: the one whose symbolic name sorts first.
 +
|-
 +
| [[Manual:DIL Manual/title|title]] || string || read-only in practice || The zone's title, from <code>title</code> in its <code>%zone</code> header.
 +
|}
 +
 
 +
== cmdptr ==
 +
Fields of a command from the game's command table.
 +
{| class="wikitable"
 +
! Field !! Type !! Access !! What it holds
 +
|-
 +
| [[Manual:DIL Manual/level|level]] || integer || read-only in practice || The lowest level that may use the command.
 +
|-
 +
| [[Manual:DIL Manual/loglevel|loglevel]] || integer || read-only || The <code>loglevel</code> a command has in <code>vme/etc/commands.def</code>.
 +
|-
 +
| [[Manual:DIL Manual/name|name]] || string || read-only || The command's full name, such as <code>"wiz"</code>.
 +
|-
 +
| [[Manual:DIL Manual/next|next]] || cmdptr || read-only || The next element of the list the value is in, or null after the last one.
 +
|-
 +
| [[Manual:DIL Manual/position|position]] || integer || read/write || The lowest position in which the command can be used.
 +
|-
 +
| [[Manual:DIL Manual/speed|speed]] || integer || read-only || The command's combat speed, from <code>turns</code> in commands.def.
 +
|-
 +
| [[Manual:DIL Manual/type|type]] || integer || read-only || The command's type: <code>TYPE_SOCIAL</code>, <code>TYPE_SKILL</code> or 0 for an ordinary command.
 +
|}
 +
 
 +
== ¹ Fields only zones with access level 0 can assign ==
 +
Some fields that decide a player's strength can be assigned only by a program in a zone with access level 0 (the fourth column of <code>vme/etc/zonelist</code>, as for basis.zon). What counts is the zone of the program running on the unit, not that of a function it calls. In other zones vmc accepts the assignment, but at run time the program logs "DIL SERIOUS: ... Type error in lvalue assignemt" and stops. Reading works in every zone.
 +
 
 +
* On players only (NPCs can be changed from any zone): [[Manual:DIL Manual/abilities|abilities]], [[Manual:DIL Manual/level|level]], [[Manual:DIL Manual/max hp|max_hp]], [[Manual:DIL Manual/spells|spells]], [[Manual:DIL Manual/weapons|weapons]].
 +
* On players and NPCs alike, wherever the field exists: [[Manual:DIL Manual/ability levels|ability_levels]], [[Manual:DIL Manual/exp|exp]], [[Manual:DIL Manual/lifespan|lifespan]], [[Manual:DIL Manual/profession|profession]], [[Manual:DIL Manual/skill levels|skill_levels]], [[Manual:DIL Manual/skills|skills]], [[Manual:DIL Manual/spell levels|spell_levels]], [[Manual:DIL Manual/vlevel|vlevel]], [[Manual:DIL Manual/weapon levels|weapon_levels]].
 +
 
 +
Money in a player's account ([[Manual:DIL Manual/acc balance|acc_balance]], [[Manual:DIL Manual/acc total|acc_total]]) can't be assigned at all; [[Manual:DIL Manual/acc modify()|acc_modify()]] changes it, again only from a zone with access level 0.
 +
 
 +
== See also ==
 +
* [[Manual:DIL Manual/Data Types|Data Types]]
 +
* [[Manual:DIL Manual/unitptr|unitptr]], [[Manual:DIL Manual/extraptr|extraptr]], [[Manual:DIL Manual/zoneptr|zoneptr]], [[Manual:DIL Manual/cmdptr|cmdptr]]
 +
* [[Manual:DIL Manual/Built-In Procedures|Built-In Procedures]], for changing what a field can't

Latest revision as of 23:40, 14 November 2026

A field is a value stored in a unit, an extra description, a zone or a command, read with a dot: self.name, activator.hp, self.outside.title. Fields can be chained, and a field of null, or one the unit doesn't have, fails: the program goes on, but the value counts as false in every comparison.

A field marked read/write can be assigned: self.hp := 10;. A read-only one can't (vmc says "Illegal lvalue"); many of those are changed with a procedure instead, as the field's page says. Fields that hold a list are indexed: pc.skills[SKI_SEARCH], room.exit_to[NORTH].

The tables are by the kind of unit that has the field. A unit has the fields of "All units" as well; a player or an NPC also has the "Characters" fields. Using a field on a unit that doesn't have it fails, the same as a field of null.

All units

Every unit has these: rooms, objects, NPCs and players.

Field Type Access What it holds
alignment integer read/write How good or evil the unit is, from -1000 (evil) to 1000 (good).
baseweight integer read-only The weight of the unit itself, in pounds, without anything it carries or contains: an empty bag, a character's body.
bright integer read-only How much light the unit gives off: positive for a light source (a lit torch), negative for something that swallows light, 0 for most units.
capacity integer read/write How much the unit can hold inside it, in pounds: the capacity line in the zone file, 0 when it has none.
editing integer read-only (meaningful for PC) TRUE while the player is writing in the text editor (a board post, a letter, a beginedit() text), FALSE otherwise.
extra extraptr read-only The first of the unit's extra descriptions, or null when it has none.
flags integer read/write The unit flags, a bit set of UNIT_FL_* values from vme.h, shared by all kinds of unit.
gnext unitptr read-only The next unit in the game's global list of all units, or null after the last.
gprevious unitptr read-only The unit before u in the game's global list of all units, or null for the first.
hasfunc integer read-only TRUE when the unit has at least one program attached, a DIL program or one of the server's special functions; FALSE when it has none.
height integer read/write The size of a unit, set with height in the zone file.
hp integer read/write The unit's current hit points.
idx integer read-only A number that tells one unit from another with the same symname.
illum integer read-only The part of a unit's bright that comes from what is inside it.
inside unitptr read-only The first unit inside u, or null when it is empty.
inside_descr string read/write What is seen from inside the unit.
key string read/write (used on objects) The key that locks and unlocks the unit, as "keyname@zone", set with key in the zone file.
light integer read-only The light level inside the unit.
loadcount integer read-only How many units made from the same definition (the same nameidx@zoneidx) are in the game right now, this one included.
manipulate integer read/write (used on objects) What players can do with the unit, a bit set of MANIPULATE_* values from vme.h.
max_hp integer read/write ¹ The unit's maximum hit points; hp holds the current ones.
minv integer read/write The unit's wizard invisibility level.
name string read-only The unit's first name (the first of its names); for a player, the player's name.
nameidx string read-only The unit's name in its zone file: "cityguard" for cityguard@midgaard.
names stringlist read/write The names players use for the unit; the first is its name.
next unitptr read-only The next element of the list the value is in, or null after the last one.
opendiff integer read/write (used on containers) How hard the unit's lock is to pick.
openflags integer read/write (used on containers and other units that open) Whether the unit opens, and whether it is closed or locked: a bit set of EX_* values from vme.h.
outside unitptr read-only The unit that u is in.
outside_descr string read/write The line a unit shows when it is seen from outside.
spells integer read/write ¹ A character's skill in spell i; for an object or a room, its magic resistance.
symname string read-only The unit's symbolic name, "nameidx@zoneidx": "corpse@death", or "papi@_players" for a player.
title string read/write The unit's title: for an object or an NPC, the short name the game's messages use.
type integer read-only What kind of unit it is: a UNIT_ST_* constant.
weight integer read-only The total weight of the unit in pounds: its own weight (baseweight) plus everything inside it.
zone string read-only The name of the zone the unit is in now: the zone of the room at the top of whatever holds it.
zoneidx string read-only The name of the zone the unit's definition comes from: "midgaard" for cityguard@midgaard.

Characters

NPCs and players (UNIT_ST_NPC, UNIT_ST_PC).

Field Type Access What it holds
abilities integer read/write ¹ One of the character's abilities.
attack_type integer read/write The weapon type a character fights with when not wielding a weapon.
charflags integer read/write The character flags: a bit field of CHAR_* values, defined in vme.h.
defensive integer read/write A flat bonus (or, below 0, penalty) to the character's defence.
endurance integer read/write A character's current endurance: the points that moving, fighting and some skills use up.
exp integer read/write ¹ On a player, the experience points gained in total; on an NPC, the experience it is worth.
fighting unitptr read-only The character this character is hitting in melee: its current opponent. null when it is not fighting.
follower unitptr read-only The first character that follows ch, or null when no one does.
followercount integer read-only How many characters follow this one directly: not their own followers. 0 when none.
level integer read/write ¹ The character's level.
mana integer read/write A character's current mana: the points that spells cost.
master unitptr read-only The character that ch follows, or null when it follows no one.
max_endurance integer read-only The most endurance the character can have.
max_mana integer read-only The character's maximum mana; mana holds the current amount.
natural_armour integer read/write The armour type of a character's own skin, used where no worn armour covers the spot that is hit.
offensive integer read/write A flat bonus (or, below 0, penalty) to the character's attacks.
opponentcount integer read-only How many characters this one is in combat with.
position integer read/write The character's position, a POSITION_* constant from vme.h.
race integer read/write The character's race, a RACE_ constant from values.h.
sex integer read/write The character's sex: SEX_NEUTRAL (0), SEX_MALE (1) or SEX_FEMALE (2), from vme.h.
speed integer read-only The character's combat speed: lower is faster.
switched unitptr read-only Who is controlled through a switch.
weapons integer read/write ¹ A character's skill, in percent, with a weapon.

Players

Players only (UNIT_ST_PC), besides the character fields.

Field Type Access What it holds
ability_costs integer read-only The player's racial modifier for training ability i.
ability_levels integer read/write ¹ How many times the player has trained ability i since the last level gained.
ability_points integer read/write The player's unspent ability points: training an ability (strength, dexterity, ...) at a teacher costs them.
acc_balance integer read-only The credit left on the player's account, in coin units, when the game runs with accounting.
acc_total integer read-only The total credit paid in to the player's account to date, in coin units, when the game runs with accounting.
birth integer read/write When the player was born, in real seconds since 1970 like realtime.
crimes integer read/write A count of the crimes the player has been charged with, saved with the player.
drunk integer read/write How drunk the player is: 0 is sober.
exptol integer read-only The experience a player still needs for the next level.
full integer read/write How well fed the player is.
guild string read/write The name of the player's main (default) guild, e.g. "Udgaard Fighter".
hometown string read/write The symbolic name of the player's home room, such as "temple@udgaard".
info extraptr read-only A player's administrative extra descriptions.
lastroom unitptr read-only Meant to give the room the server will put the player back in: the room the player was in when last saved, or when the connection was lost.
lifespan integer read/write ¹ How old, in mud years, the player can grow.
pcflags integer read/write A player's option and status bits.
playtime integer read-only How long the player has been logged in, in total, in real seconds.
profession integer read/write ¹ The player's profession: a PROFESSION_ constant from values.h, PROFESSION_FIGHTER to PROFESSION_BARBARIAN.
prompt string read/write The player's prompt template, as set with the prompt command.
quests extraptr read-only The player's quest list: a list of extras, like .extra, saved with the player.
skill_costs integer read-only Despite the name, not a price: the player's racial modifier for the skill with that index, from -3 to +3.
skill_levels integer read/write ¹ How many times the player has trained the skill with that index since gaining the current level.
skill_points integer read/write The player's unspent skill points.
skills integer read/write ¹ A player's skill, in percent, in the skill with that index.
spell_costs integer read-only How easy spell i is for the player's race to learn.
spell_levels integer read/write ¹ How many times the player has practised spell i since the last level gained.
thirst integer read/write How well watered the player is.
vlevel integer read/write ¹ The player's virtual level.
weapon_costs integer read-only at run time The player's race modifier for the weapon idx, from the race <name> = N lines in vme/etc/weapons.def.
weapon_levels integer read/write ¹ How many times the player has trained the weapon idx since gaining the current level.

NPCs

NPCs only (UNIT_ST_NPC), besides the character fields.

Field Type Access What it holds
defaultpos integer read/write An NPC's default position, a POSITION_* constant from vme.h.
npcflags integer read/write An NPC's NPC flags, a bit field set in the zone file with npcflags {...} in the mobile.

Objects

Objects only (UNIT_ST_OBJ).

Field Type Access What it holds
cost integer read/write What the object is worth, in the money's base unit (an iron piece is IRON_MULT, 10; a gold piece GOLD_MULT; vme.h).
equip integer read-only Where the object is worn or held.
objectflags integer read/write The object's flags, set with romflags in the object's zone definition (flags there sets the unit flags).
objecttype integer read/write What kind of object it is: one of the ITEM_* constants in vme.h.
rent integer read/write What the object costs its owner to keep, per real day, in the money's base unit (as cost).
value integer read/write The object's five numbers, value[0] to value[4], set with value[i] lines in the zone file.

Rooms

Rooms only (UNIT_ST_ROOM).

Field Type Access What it holds
exit_diff integer read/write The difficulty of the room's exit in direction dir, set with difficulty on the exit in the zone file (0 to 250).
exit_info integer read/write The flags of the exit in direction dir: whether it has a door and what state it is in.
exit_key string read/write The key that locks and unlocks the room's exit in direction dir, as "keyname@zone" in lower case, set with key on the exit in the zone file.
exit_names stringlist read/write The names of the door or opening in direction dir: what a player types to open, close, lock or unlock it.
exit_to unitptr read-only The room that the exit in direction dir leads to, or null when the room has no exit that way.
mapx integer read-only The room's X coordinate on the graphical map, set with gmap(x, y) in the zone file; -1 when the room has none.
mapy integer read-only The room's Y coordinate on the graphical map, set with gmap(x, y) in the zone file; -1 when the room has none.
movement integer read/write The room's terrain, set with movement in the zone file.
roomflags integer read/write Bit flags of a room, set with romflags in the zone file.

extraptr

Fields of an extra description (an extraptr).

Field Type Access What it holds
descr string read/write The text of an extra description: what a player sees on look at the extra's name.
name string read-only The extra description's first name (keyword).
names stringlist read/write The keywords the extra description answers to.
next extraptr read-only The next element of the list the value is in, or null after the last one.
vals intlist read/write The list of integers kept with an extra description.

zoneptr

Fields of a zone.

Field Type Access What it holds
access integer read-only The zone's access level: the fourth column of vme/etc/zonelist, 0 to 255, where 0 is the most trusted.
creators stringlist read/write The names of the zone's creators.
fname string read-only The zone's name, the same as name on a zoneptr: "midgaard".
help string read-only in practice The zone's help text for players: the help text in the zone file's %zone header.
loadlevel integer read-only The level a god needs to load objects and NPCs from the zone, unless the god's name is in the zone's creators.
name string read-only The zone's name, as in sym@zone.
next zoneptr read-only The next element of the list the value is in, or null after the last one.
notes string read-only in practice The zone's notes from its creators: the notes text in the zone file's %zone header.
npccount integer read-only Meant to be the number of NPCs the zone defines, but the server never counts them: it is always 0.
npcs unitptr read-only A copy, in the game, of the zone's NPC whose symbolic name sorts first.
objcount integer read-only Meant to be the number of objects the zone defines, but the server never counts them: it is always 0.
objs unitptr read-only A copy, in the game, of the zone's object whose symbolic name sorts first.
payonly integer read-only Whether the zone is only for paying players: the sixth column of vme/etc/zonelist (0 when missing).
resetmode integer read-only How the zone resets, as set with reset in the zone file's %zone header.
resettime integer read-only The minutes between two resets of the zone.
roomcount integer read-only The number of rooms the zone defines: the rooms read from its .data file at boot.
rooms unitptr read-only One room of the zone: the one whose symbolic name sorts first.
title string read-only in practice The zone's title, from title in its %zone header.

cmdptr

Fields of a command from the game's command table.

Field Type Access What it holds
level integer read-only in practice The lowest level that may use the command.
loglevel integer read-only The loglevel a command has in vme/etc/commands.def.
name string read-only The command's full name, such as "wiz".
next cmdptr read-only The next element of the list the value is in, or null after the last one.
position integer read/write The lowest position in which the command can be used.
speed integer read-only The command's combat speed, from turns in commands.def.
type integer read-only The command's type: TYPE_SOCIAL, TYPE_SKILL or 0 for an ordinary command.

¹ Fields only zones with access level 0 can assign

Some fields that decide a player's strength can be assigned only by a program in a zone with access level 0 (the fourth column of vme/etc/zonelist, as for basis.zon). What counts is the zone of the program running on the unit, not that of a function it calls. In other zones vmc accepts the assignment, but at run time the program logs "DIL SERIOUS: ... Type error in lvalue assignemt" and stops. Reading works in every zone.

Money in a player's account (acc_balance, acc_total) can't be assigned at all; acc_modify() changes it, again only from a zone with access level 0.

See also