Difference between revisions of "Manual:DIL Manual"
(manual index generated from the checked keyword pages) |
(string ordering ignores case too; DIL Examples link text) |
||
| Line 32: | Line 32: | ||
# [[Manual:DIL Manual/Fields|Fields]]: the values in units, extras, zones and commands, by unit type. | # [[Manual:DIL Manual/Fields|Fields]]: the values in units, extras, zones and commands, by unit type. | ||
# [[Manual:DIL Manual/Ending Notes|Ending Notes]]. | # [[Manual:DIL Manual/Ending Notes|Ending Notes]]. | ||
| − | # [[Manual:DIL Examples|DIL Examples]]: | + | # [[Manual:DIL Examples|DIL Examples]]: complete, working programs from the public zones. |
== Every keyword == | == Every keyword == | ||
Latest revision as of 23:55, 14 November 2026
DIL (DikuMUD Interpreted Language) is the scripting language of DikuMUD3. Almost everything in the game that reacts or changes is a DIL program: monsters that talk, fight or wander, doors that lock themselves, quests, spells and skills, and many of the commands players type.
A program is written in a zone file (.zon) between dilbegin and dilend, and compiled with the rest of the zone by vmc, the zone compiler. The game server runs it on a unit: a room, an object, an NPC or a player, which the program calls self. Most programs wait for an event (a command typed nearby, a message from another program, time passing) and then act on it.
A small example
dilbegin greeter();
code
{
:start:
wait(SFB_DONE, command(CMD_AUTO_ENTER) and (activator.type == UNIT_ST_PC));
exec("say Welcome, " + activator.name + "!", self);
goto start;
}
dilend
Put on an NPC, this waits until a player has walked into the room, makes the NPC say hello, and waits again. wait() sleeps until an event of the given kind (here SFB_DONE, something has happened) makes the condition true; activator is the character who caused it; exec() makes the NPC type a command.
Chapters
Read in this order to learn the language:
- Making a Program: the parts of a program and how it runs.
- Data Types: integer, string, stringlist, intlist, unitptr, extraptr, zoneptr, cmdptr.
- Assignment: giving variables and fields values.
- Expressions: values and how they are combined.
- Operators: arithmetic, comparison,
and,or,not,in. - DIL Constructs:
if,while,foreach,gotoand the other statements. - Messages: events, and how programs wait for them and talk to each other.
- Functions: writing your own functions and procedures, and calling them from other zones.
- Built-In Functions: the functions DIL provides, by purpose.
- Built-In Procedures: the procedures DIL provides, by purpose.
- Built-In Variables:
self,activatorand the others the server sets. - Fields: the values in units, extras, zones and commands, by unit type.
- Ending Notes.
- DIL Examples: complete, working programs from the public zones.
Every keyword
The Full Listing has every keyword of the language on one page, by kind, with a line on what each does. Each keyword's own page gives its arguments, what it returns, notes from the server's code and an example.