Manual:DIL Manual (Full Listing)

From DikuMUD Wiki
Revision as of 23:39, 14 November 2026 by Agent-mud (talk | contribs) (manual index generated from the checked keyword pages)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Every page of the DIL manual on one page, by kind; each line gives what the keyword does in a sentence. The chapters that explain the language as a whole are listed on the front page. For the built-in functions, procedures and variables with their arguments, see Built-In Functions, Built-In Procedures and Built-In Variables; for fields in tables by unit type, Fields.

Program structure

The parts of a template. See Making a Program.

  • dilbegin – Starts a DIL program, called a template.
  • var – Starts the variable declarations of a template.
  • code – Starts the statements of a template.
  • external – Declares the other templates a template calls.
  • dilend – Ends a template.
  • recall – Option of dilbegin: a saved program goes on where it stopped.
  • aware – Option of dilbegin: the program also hears what its own unit does.
  • unique – Option of dilbegin: a unit has at most one copy of the program.
  • fnpri – Option of dilbegin: where the program goes in its unit's list of programs.
  • global – Makes a variable shared by every program that names the same key.

Types

See Data Types.

  • integer – A whole number, signed, 32 bits.
  • string – A piece of text.
  • stringlist – An ordered list of strings.
  • intlist – An ordered list of integers.
  • unitptr – A pointer to a unit: a room, an object, an NPC or a player.
  • extraptr – A pointer to an extra description.
  • zoneptr – A pointer to a zone.
  • cmdptr – A pointer to one of the game's commands.
  • null – The empty value: no unit, no extra, no zone, no command, no string, an empty list.

Built-in variables

See Built-In Variables.

  • self – The unit the program runs on.
  • activator – The unit that caused the event that woke the program.
  • medium – The unit used in the event that woke the program, when the event has one; otherwise null.
  • target – The unit an action in the event was aimed at, when the event has one; otherwise null.
  • power – A number that comes with SFB_PRE and SFB_DONE events.
  • argument – The text that came with the event that woke the program.
  • cmdstr – The full name of the command in the event that woke the program, as commands.def names it, even when the player typed an abbreviation.
  • excmdstr – The first word of the line the player typed, in lower case, not expanded.
  • excmdstr_case – The first word of the line the player typed, exactly as typed: Mellon stays "Mellon".
  • heartbeat – How often the program's tick comes, in quarter seconds: PULSE_SEC (4, vme.h) is one second.
  • realtime – The real time, in seconds since 1 January 1970 UTC: what time(NULL) gives in C.
  • mudhour, mudday, mudmonth, mudyear – The game's clock and calendar.
  • mudhour – The hour of the mud day, 0 to 23: 0 is midnight, 12 noon.
  • mudday – The day of the mud month, 0 to 13.
  • mudmonth – The month of the mud year, 0 to 8.
  • mudyear – The mud year: the number of mud years since 11 August 1990, about 1261 in November 2026.
  • weather – The sky over the zone the program's unit is in.

Control flow

See DIL Constructs.

  • if() – Runs a statement only when a condition holds, with an optional else.
  • else() – The second branch of an if.
  • while() – Repeats a statement as long as a condition is true.
  • foreach() – Runs a statement once for each unit of some types around the program's unit.
  • break – Leaves the loop it is in.
  • continue – Skips the rest of the loop's statement and starts its next round.
  • goto – Jumps to a label.
  • on() – Jumps to one of several labels, picked by a number.
  • skip – Takes the place of a label in an interrupt or an on ... goto, and means "don't jump".
  • return() – Leaves a procedure, or a function with its value.
  • return – Ends the template that is running and goes back to the one that called it, which carries on after the call.
  • waitnoop – Steps out of the current event for a moment.

Functions

Return a value. By purpose, with arguments: Built-In Functions.

  • addcolor() – Gives a player their own colour for a colour name.
  • asctime() – Writes a time in seconds as a date, such as "Mon Nov 18 18:49:08 1996".
  • atoi() – The number written at the start of a string.
  • attack_spell() – Hits a target with an offensive spell and returns the damage.
  • can_carry() – Tells whether a character can carry more of something, and if not, why.
  • cast_spell() – Casts a spell without mana or the caster's own casting.
  • changecolor() – Changes one of a player's own colours.
  • chead() – The first command in the game's command table.
  • check_password() – Tells whether a password is a player's password.
  • clone() – Makes a copy of an existing NPC or object.
  • command_head() – Another name for chead(): the first command in the game's command table.
  • command() – Tells whether the event that woke the program is a given command.
  • delcolor() – Removes one of a player's own colours.
  • delstr() – Deletes a string file.
  • delunit() – Deletes a unit file.
  • dilcall() – Calls a DIL function whose name is only known when the program runs.
  • dildestroy() – Stops a DIL program on a unit and removes it.
  • dilfind() – Tells whether a unit runs a DIL program from a given template.
  • equipment() – The object a character wears or wields in a given position.
  • findrndunit() – Picks a random unit of the wanted kinds in one place.
  • findroom() – Finds a room by its symbolic name.
  • findsymbolic() – Finds a unit by its symbolic name, the name@zone it was defined with.
  • findunit() – Finds a unit by name, the way commands find what a player names.
  • findzone() – Finds a zone by its name.
  • fits() – Tells whether an object is the right size for a character.
  • flog() – Writes a string to a file of its own in the server's log directory.
  • getaffects() – Lists the affects on a unit, one string of numbers each.
  • getcmd() – Finds a command from its name or an abbreviation.
  • getcolor() – Returns the HTML tag that starts text in a named colour.
  • getfollower() – Gets one of a character's followers by its place in the list.
  • getinteger() – Gets one of several numbers that the server computes, chosen by an index.
  • getopponent() – Gets one of a character's opponents by its place in the list.
  • getword() – Takes the first word off a string.
  • getwords() – Splits a string into its words.
  • ghead() – The first unit in the game's global unit list.
  • global_head() – Another name for ghead(): the first unit in the game's global unit list.
  • interrupt() – Sets up a jump to a label when a certain event wakes the program, whatever it is waiting for.
  • isaff() – Tells whether a unit carries an affect with a given id.
  • islight() – Tells whether there is light in a room.
  • isplayer() – Tells whether a player character of that name exists.
  • isset() – Tells whether any of some bits are set in an integer.
  • itoa() – An integer written as text.
  • left() – Returns the first characters of a string.
  • length() – The length of a string, or the number of entries in a list.
  • load() – Makes a new NPC or object from its zone definition.
  • loadstr() – Reads a whole file into a string variable.
  • meleeattack() – Makes a character attack another once in melee, starting a fight.
  • meleedamage() – Makes a character strike another once, without first putting it into combat.
  • mid() – Returns the characters from one position to another.
  • moneystring() – Writes an amount of money out in coins.
  • npc_head() – The first NPC in the game's global unit list.
  • obj_head() – The first object in the game's global unit list.
  • on_activation() – Sets a check that runs every time the program is woken, by any event, before the event reaches the program's wait() or pause.
  • openroll() – Rolls an open-ended die: high rolls add another roll, low rolls subtract one.
  • opponent() – Tells whether two characters are fighting each other.
  • pathto() – Gives the first step of the shortest way from one unit's room to another's.
  • paycheck() – Tells whether a player's account allows them into the zone of a unit.
  • pc_head() – The first player in the game's global unit list.
  • purse() – Counts the coins of one kind that a unit carries.
  • replace() – Replaces every occurrence of one text in a string with another.
  • restore() – Loads units saved with store() back into the game.
  • right() – Returns the last characters of a string.
  • rnd() – A random whole number in a range.
  • room_head() – The first room in the game's global unit list.
  • sact() – Gives the text an act() would show, instead of sending it.
  • savestr() – Writes a string to a file, to read back later with loadstr().
  • send_pre() – Asks the programs around a character whether a command may go ahead.
  • shell() – Starts a program from the server's allow directory.
  • skill_name() – Gives the name of a skill from its number.
  • spellindex() – Finds a spell's number from its name or an abbreviation of it.
  • spellinfo() – Returns a spell's name and puts its properties in seven integer variables.
  • split() – Cuts a string into pieces at a separator.
  • strcmp() – Compares two strings, minding upper and lower case.
  • strdir() – Lists the string files that DIL has saved, by a pattern.
  • strncmp() – Compares the first characters of two strings, minding upper and lower case.
  • textformat() – Turns the escapes \n and \r in a text into real line breaks.
  • tolower() – Returns a string in lower case.
  • toupper() – Returns a string in upper case.
  • transfermoney() – Moves money from one character to another, or creates or destroys it.
  • unitdir() – Lists the unit files that DIL has stored, by a pattern.
  • visible() – Tells whether a character can see a unit.
  • weapon_info() – The figures etc/weapons.def gives a weapon type.
  • weapon_name() – Gives the name of a weapon type from its number.
  • zhead() – The first zone in the game.
  • zone_head() – Another name for zhead(): the first zone in the game.

Procedures

Return nothing. By purpose, with arguments: Built-In Procedures.

  • acc_modify() – Pays money into a player's account or takes it out.
  • act() – Shows a message to the characters around someone, worded for each of them.
  • addaff() – Adds an affect to a unit.
  • addequip() – Puts an object a character carries on, at a given position.
  • addextra() – Adds an extra description to a unit's extras, quests or info.
  • addstring() – Adds a string to the end of a stringlist.
  • beginedit() – Lets a player type several lines of text, which the program then gets.
  • block – Stops the event that woke the program from going any further.
  • change_speed() – Delays a fighting character's next attacks.
  • clear() – Removes an interrupt set up with interrupt().
  • delete_player() – Deletes a player character for good.
  • destroy() – Removes a unit from the game.
  • dilcopy() – Starts a copy of a DIL template on a unit.
  • dispatch() – Sends a line to programs outside the game, such as the Discord bot.
  • exec() – Makes a character carry out a command, as if they had typed it.
  • experience() – Gives a player experience points, or takes them away.
  • follow() – Makes one character follow another, or stop following.
  • gamestate() – Takes a player out of the game to the menu, back into the game, or out altogether.
  • insert() – Puts a new entry into a stringlist or an intlist at a given position.
  • killedit – Takes a player out of the text editor.
  • link() – Moves a unit into another unit, with no checks and no messages.
  • log() – Writes a line to the server log.
  • logcrime() – Reports a crime to the justice system: who did it, to whom, and what.
  • nopriority – Ends the priority set by this program.
  • pagestring() – Sends a long text to a player, to be shown a page at a time.
  • position_update() – Sets a character's position from its hit points, and kills it at -11 or below.
  • priority – Keeps the unit's later programs from getting any event until nopriority.
  • quit – Ends the program for good.
  • reboot – Shuts the game server down.
  • remove() – Takes the entry at a given position out of a stringlist or an intlist.
  • reset_level() – Sets a mortal player's level back to 1.
  • reset_race() – Rolls a player's body again from the race's values: weight, height, lifespan and age.
  • reset_vlevel() – Sets a mortal player's virtual level back to 1.
  • secure() – Keeps a unit in a variable across waits, and names where to go when it leaves.
  • send_done() – Tells the programs around that a command has been carried out.
  • send() – Sends a message to the DIL programs around the unit.
  • sendtext() – Sends a text to one character's screen, exactly as it is.
  • sendto() – Sends a message to the DIL programs on one unit.
  • sendtoall() – Sends a message to every copy of a unit in the game.
  • sendtoalldil() – Sends a message to every running copy of a DIL template.
  • set_fighting() – Starts a fight between two characters.
  • set_password() – Sets a player's password.
  • set_weight – Sets a unit's total weight.
  • set_weight_base – Sets a unit's own weight.
  • set() – Turns bits on in an integer variable or field.
  • setbright() – Sets how much light a unit gives.
  • setroomexit() – Points a room's exit in one direction at another room, making the exit if the room has none that way.
  • stop_fighting() – Ends a character's fight with one opponent, or with all.
  • store() – Saves a unit, or what is inside it, to a file.
  • subaff() – Removes an affect from a unit.
  • subextra() – Removes an extra description by name.
  • substring() – Removes a string from a stringlist.
  • unequip() – Takes off an object a character is wearing.
  • unsecure() – Ends the secure on a unit.
  • unset() – Turns bits off in an integer variable or field.
  • wait() – Stops the program until an event of the given kinds comes, for which a condition holds.
  • zonereset() – Resets a zone now.

Fields

By unit type; a field several types have is under each. With type and access: Fields.

All units

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

Characters

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

Players

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

NPCs

  • defaultpos – An NPC's default position, a POSITION_* constant from vme.h.
  • npcflags – An NPC's NPC flags, a bit field set in the zone file with npcflags {...} in the mobile.

Objects

  • cost – 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 – Where the object is worn or held.
  • objectflags – The object's flags, set with romflags in the object's zone definition (flags there sets the unit flags).
  • objecttype – What kind of object it is: one of the ITEM_* constants in vme.h.
  • rent – What the object costs its owner to keep, per real day, in the money's base unit (as cost).
  • value – The object's five numbers, value[0] to value[4], set with value[i] lines in the zone file.

Rooms

  • exit_diff – 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 – The flags of the exit in direction dir: whether it has a door and what state it is in.
  • exit_key – 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 – The names of the door or opening in direction dir: what a player types to open, close, lock or unlock it.
  • exit_to – The room that the exit in direction dir leads to, or null when the room has no exit that way.
  • mapx – 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 – 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 – The room's terrain, set with movement in the zone file.
  • roomflags – Bit flags of a room, set with romflags in the zone file.

extraptr

  • descr – The text of an extra description: what a player sees on look at the extra's name.
  • name – The extra description's first name (keyword).
  • names – The keywords the extra description answers to.
  • next – The next element of the list the value is in, or null after the last one.
  • vals – The list of integers kept with an extra description.

zoneptr

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

cmdptr

  • level – The lowest level that may use the command.
  • loglevel – The loglevel a command has in vme/etc/commands.def.
  • name – The command's full name, such as "wiz".
  • next – The next element of the list the value is in, or null after the last one.
  • position – The lowest position in which the command can be used.
  • speed – The command's combat speed, from turns in commands.def.
  • type – The command's type: TYPE_SOCIAL, TYPE_SKILL or 0 for an ordinary command.

Events (SFB_*)

What wait() and interrupt() wait for. See Messages.

  • SFB_CMD – The command event.
  • SFB_PRE – The "about to happen" event.
  • SFB_DONE – The "it has happened" event.
  • SFB_TICK – The timer event.
  • SFB_COM – The combat event.
  • SFB_DEAD – The death event.
  • SFB_MSG – The message event: how DIL programs talk to each other.

Unit types (UNIT_ST_*)

Values of a unit's type field.

Operators

The others (and, or, not, arithmetic and comparison) are in Operators.

  • in – Looks for a string in a string, a stringlist or a list of extras.
  • string in string – TRUE (1) when the text s1 appears anywhere in s2, FALSE (0) when it doesn't.
  • string in stringlist – Looks for the string s in the stringlist sl and gives its position plus one.
  • string in extraptr – Finds the extra description whose names include s, in a list of extras such as u.extra or pc.quests, and gives that extra.

Old names

Pages for names that DIL no longer has, never had, or that don't work, and what to use instead.