Manual:DIL Manual/Fields
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.
Contents
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.
- On players only (NPCs can be changed from any zone): abilities, level, max_hp, spells, weapons.
- On players and NPCs alike, wherever the field exists: ability_levels, exp, lifespan, profession, skill_levels, skills, spell_levels, vlevel, weapon_levels.
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
- Data Types
- unitptr, extraptr, zoneptr, cmdptr
- Built-In Procedures, for changing what a field can't