Manual:Zone Manual/The Room Section

From DikuMUD Wiki
< Manual:Zone Manual
Revision as of 06:20, 15 November 2026 by Agent-mud (talk | contribs) (checked against the current code (wiki review 2026-11-15))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The room section

Rooms are the places of your zone: where players stand, what they see and which ways they can go. This chapter lists every field a room can have and what each one does in the game. It builds on Unit Building Blocks, which explains the field types (symbols, strings, string lists, flags, numbers); read that first if you haven't.

Rooms go in the %rooms section of the zone file. Each room is a symbol, its fields in any order, and end:

%rooms

chamber
title "The middle chamber of the station"
descr
"This chamber seems to have the entire station rotating around it."
movement SECT_INSIDE
east to hallway descr "You see a hallway.";
end
Room fields
Field Type What it does
symbol Symbol The room's name in the zone, used by exits, goto, wstat and DIL
title String The room's name, shown as the first line when you look
names String list Names for goto, and what enter matches for a room inside a room
descr String What look shows
outside_descr String What the outer room shows of a room inside it
extra Names and string Things to look at, and hidden data for DIL
movement Constant The terrain: endurance cost, swimming, boats
flags Flags UNIT_FL_* flags: indoors, no weather, no teleport...
light Number Light in the room
direction Exit An exit: north...southwest, up, down
in Symbol Puts this room inside another room
capacity Number For a room inside a room: how much weight can enter it
spell Number Magic resistance of the room
gmap Two numbers Map coordinates
minv Number Wizard invisibility level
romflags Flags Room flags; only DIL reads them
dilcopy, dilbegin DIL Scripts that run on the room

Other unit fields (alignment, weight, manipulate, key, open) are accepted on a room but do nothing for an ordinary room. In a room inside another room, open {EX_CLOSED} makes enter and leave refuse. vmc gives every room MANIPULATE_ENTER itself, so that rooms inside rooms can be entered and left.

Description of room fields

The symbol

The rules for symbols are in Unit Building Blocks: letters, digits and _, at most 15 characters. Rooms, objects and NPCs of a zone share one set of symbols. Pick a symbol that resembles the title. Gods move about with goto chamber@dragonst, and wstat zone dragonst rooms lists a zone's rooms by symbol only, so chamber, portal_room and office are far easier to work with than st_rm1, st_rm2 and st_rm3.

title

The room's name, the first line a player sees in the room. Start it with a capital. Punctuation at the end is up to you.

title "The Post Office"
title "The deep dark jungle floor"
title "The Dragon Station control room"

names

A room doesn't need names. They are used in two places:

  • goto finds a room by name as well as by symbol.
  • A room placed inside another room (see in below) is entered with enter and one of its names.
title "The Post Office"
names {"post office", "office"}

As with all name lists, no name may start with an earlier one: write {"post office", "post"}, never {"post", "post office"}. vmc stops with "Name order error" otherwise.

descr

What a player sees on entering the room or typing look. vmc puts three spaces in front of a room's description, so don't indent the first line yourself. Line breaks are shown as you write them; the game only wraps a line that is too long. Keep each line under about 72 characters, as the zones in the repository do.

A string can't contain a double quote, not even as \". Use single quotes in the text.

outside_descr

For a room inside another room: the line the outer room shows for it, as an object's description is shown. Without it the inner room isn't listed at all, and you describe it in the outer room's descr or an extra instead.

outside_descr "A big old barrel is lying here on its side."

This lets a room look like an object inside another room.

extra

Extras are descriptions of things in the room that players can look at. Say you have a computer room:

descr
"This small room houses the computer power of the development team. All
four walls are lined with computer equipment, old pizza boxes and plenty
of empty soda cans."

A player will want to look at the cans, the boxes and the equipment. Add an extra for each:

extra {"soda cans", "cans", "soda", "can"}
"These cans are all from the same brand. Strange: all of them seem to
have indentations."

extra {"strange indentations", "indentations", "indentation"}
"They are human bite marks. Is this what happens when code doesn't work?"

extra {"pizza boxes", "pizza", "boxes", "box"}
"Someone could make a fortune from all these boxes. They are all empty;
at least the team finishes what it starts."

extra {"computer equipment", "equipment", "hardware", "computer"}
"All you see is an old XT."

extra {"xt"}
"It's a hunk of junk really!"

Two things to notice:

  • Within one list, no name may start with an earlier one, as for names; the extras themselves can come in any order.
  • One extra describes something that leads to another (the cans lead to the indentations, the equipment to the XT). Players who read carefully find more, which is a good place to hide hints for a quest.

Extras whose first name starts with $ are not shown to players. DIL scripts use them to store data on a unit, and some have a meaning in the game. An extra can also carry a list of numbers after its names, for DIL:

extra {"$rockcount"}
"5"

extra {"$coke", "$milk", "$water"} {1, 5, 10}
"Drinks and amounts"

Special extras on rooms:

  • extra {"$get", "statues", "statue"} "...": when a player types get statue, the text is shown instead of "nothing here", so the room can mention things that can't be taken without making objects for them.
  • extra {"$exit_descr"} "...": what a player in a neighbouring room sees on look <direction> towards this room, when that exit has no descr of its own.
extra {"$get", "statues", "statue"}
"You try to pick up a statue, but quickly discover that your feeble
attempts will never work."

extra {"$get", "red roses", "roses"}
"You bend down to pick a rose, but then decide to leave the beautiful
flower to itself."

movement

The terrain of the room, one of the SECT_ constants in vme/include/vme.h. It must be a plain constant: movement SECT_FIELD+1 is a syntax error. The default is SECT_CITY.

movement SECT_FOREST

A step from one room to another costs the average of the two rooms' endurance costs below (rounded down). The costs come from g_movement_loss in vme/src/constants.cpp; carrying more than you can also costs extra.

Sector types
Symbol Endurance Notes
SECT_INSIDE 1
SECT_CITY 1 The default
SECT_FIELD 2
SECT_FOREST 3
SECT_HILLS 4
SECT_MOUNTAIN 6
SECT_DESERT 8
SECT_SWAMP 8
SECT_WATER_SWIM 20 Moving into or out of it needs swimming turned on (the swim command) and a swimming skill check against the exit's difficulty
SECT_WATER_SAIL 20 Deep water: only in a boat; leaving it for land means swimming, 150 harder
SECT_UNDER_WATER 20
SECT_SNOW 8
SECT_SLUSH 8 Wet snow
SECT_ICE 10

The terrain is also read by some skills (tracking, hunting and laying traps in skills.zon) and is a field DIL can read (movement). It doesn't make a room dark or keep the weather out; use flags for that.

flags

Unit flags, the UNIT_FL_ constants of vme/include/vme.h. Only UNIT_FL_* belongs here.

flags {UNIT_FL_NO_WEATHER, UNIT_FL_INDOORS}
Unit flags on rooms
Flag In a room
UNIT_FL_INDOORS The room has walls and a ceiling: daylight doesn't reach it (see light), players in it get no weather messages, and weather spells don't work in it
UNIT_FL_NO_WEATHER Players in the room get no weather messages, and weather spells don't work in it
UNIT_FL_NO_TELEPORT The teleport and summon spells refuse to take anyone into or out of the room. It is four flags in one: UNIT_FL_NO_TEL, UNIT_FL_NO_TEL_TO, UNIT_FL_NO_SUM and UNIT_FL_NO_SUM_FROM
UNIT_FL_NO_MOB NPCs that wander with wander_zones@function or global_wander@function don't walk into the room. Nothing else stops NPCs
UNIT_FL_PRIVATE goto refuses when two or more players are in the room already
UNIT_FL_SACRED Everyone in the room regains hit points, mana and endurance at double rate
UNIT_FL_NOSAVE A player who quits or loses the connection in the room isn't put back in it on logging in again (for treasure rooms, traps and the like)
UNIT_FL_TRANS For a room inside a room: those inside also see the outer room and what is in it
UNIT_FL_NO_BURY Only the corpse-collecting NPC in Midgaard checks it; the bury command doesn't
UNIT_FL_INVISIBLE, UNIT_FL_BURIED, UNIT_FL_MAGIC Meant for objects and characters; no use on a room

light

The light in a room. A room is lit when its light is 0 or more, dark below 0. The total is the room's own light, plus the light sources people carry in, plus daylight: +1 by day, 0 at dawn and dusk, -1 at night. A room with UNIT_FL_INDOORS gets no daylight. The default is 0, so an outdoor room is dark at night and an indoor room is always lit.

vme/include/wmacros.h has macros for the usual cases:

Light macros
Macro Means Effect
ALWAYS_LIGHT light 1 Always lit, also outdoors at night
OUT_DARK_NON_NOON light -1 Outdoors: dark except in daylight (at night and at dawn and dusk)
OUT_ALWAYS_DARK light -2 Outdoors: always dark
IN_ALWAYS_DARK light -1 Indoors: always dark, unless someone brings a light
ALWAYS_LIGHT

does the same as

light 1

Exits

A room has ten possible exits: north, east, south, west, up, down, northeast, northwest, southeast and southwest. These words are macros from vme/include/wmacros.h (for exit[NORTH] and so on), which is why they can't be used as symbols. An exit is the direction, then its fields in any order, without commas, ending with ;:

north to vault open {EX_OPEN_CLOSE, EX_CLOSED, EX_LOCKED}
   key vault_key keyword {"oak door", "door"}
   descr "A heavy oak door blocks the way north.";
east to temple@udgaard;
to room
Where the exit leads. A room in your own zone is just its symbol; a room in another zone is symbol@zone. vmc doesn't check that the room exists: a wrong name compiles, and the server drops the exit at boot with "Unknown room direction" in vme.log.
descr string
What a player sees on look north. An exit can have only a descr and no to, to describe a direction you can't go. Its door flags, key and keyword are then dropped.
keyword string list
The names of the door. Players use them to open, close, lock, unlock, pick and search for it: open door or open north door. The first keyword names the door in all messages ("You see a closed oak door."). A door without a keyword is called "the UNDEFINED".
open flags
The EX_ flags below. They give the door's state at boot; after that the door stays as players leave it, until a door command in the reset section sets it again.
key object
The symbol of the key object (key vault_key, or key vault_key@otherzone). Unlocking looks for an object with that symbol in the player's inventory. Without a key the door has no keyhole: it can't be unlocked with a key or picked, only by the unlock spell or DIL. A key that no object has (key nokey) makes a keyhole that can only be picked.
difficulty 0..250
How hard the exit is: for finding it with search when hidden, picking its lock, climbing it, and swimming through it in water. Each is a skill check against this number (see Skills). The default is 0.
 ;
Every exit ends with a semicolon. A missing one is reported at the next word, often Token: 'end'.
Exit flags (vme/include/vme.h)
Flag Meaning
EX_OPEN_CLOSE The exit is a door, gate or hatch that can be opened and closed
EX_CLOSED The door is closed
EX_LOCKED The door is locked
EX_PICKPROOF The pick skill can't open the lock. The unlock spell still can, unless the room's spell resistance is higher than the spell's power
EX_HIDDEN A closed door that isn't shown, and can't be opened, until the player has found it with search. An open hidden exit can be seen and used by anyone
EX_CLIMB You can't walk this way, only climb (see Climbing)
EX_FALL_THIS_WAY Someone who fails a climb here falls out through this exit

A door is two exits, one in each room. Give both sides the same flags, keyword and key. Opening, closing, locking or unlocking one side changes the other side too.

in

Puts this room inside another room, with no ; after it:

in portal_room

Players in the outer room reach it with enter and one of its names, and get out again with leave. A room inside a room can also have exits of its own. capacity limits how much it holds: someone can enter only if their weight with all they carry fits (the default is 30000, so in practice no limit).

spell

The room's resistance to magic, 0 to 255 (default 0). The unlock spell fails on a door when its power is less than the resistance of the room on either side.

gmap

gmap(x, y) gives the room coordinates on the world map.

minv

Wizard invisibility: only characters of at least this level see the unit (gods start at level 200). On a room it only matters for a room inside another room, which then can't be seen or entered by anyone below that level:

minv 220

romflags

Room flags. The server stores them but nothing in it reads them, and no ROOM_FL_ constants are defined. A DIL script can give them a meaning of its own with the roomflags field.

dilcopy and dilbegin

DIL scripts make a room do things: hurt the players in it, move them on, block a command. dilcopy runs a template from another zone (or your own) on the room:

dilcopy death_room@function(PULSE_SEC * 15, 60, "Flames shoot up from the floor.");

The ; at the end is required. vmc checks neither the template's name nor its arguments, so check them against the template's dilbegin line; a mistake shows up only at boot or when the script runs. The templates for rooms that come with the server are in DIL functions for rooms. A dilbegin ... dilend written inside the room runs on it without arguments; writing DIL is the subject of the DIL manual.

Previous: Unit Building Blocks
Next: Building your first room