Manual:Zone Manual/The Room Section/A more complex set of rooms

From DikuMUD Wiki
< Manual:Zone Manual‎ | The Room Section
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

A more complex set of rooms

In the last sections you made a basic room. Now we build on that: doors, locked and hidden doors, rooms inside other rooms, and two of the room DIL templates from DIL functions for rooms at work. The next page puts all the rooms together into one zone you can compile and play with.

All the rooms of the station are indoors and lit, so each gets the same three lines:

movement SECT_INSIDE
ALWAYS_LIGHT
flags {UNIT_FL_NO_WEATHER, UNIT_FL_INDOORS}

Exits with doors

A door is an exit with a keyword and the open flags. Here are two rooms joined by a door: the hallway east of the chamber, and the office beyond it.

hallway
title "Module tunnel"
descr
"The hallway is about 50 metres long and around 100 metres from side to
side and top to bottom. It seems to be dust free. The walls and the
floor are made of the same sterile metal-plastic that all space
agencies use. Large plate glass windows open up into space. The
hallway is filled with a dim light that seems to come from everywhere
and nowhere at once. You notice a glimmer of bright light coming from
the windows. To the east you see an air lock and to the west the
hallway opens up into a larger room."

extra {"windows", "window"}
"Your eyes are drawn to a large ship lit up with running lights,
sitting about a kilometre from the station."

extra {"floor", "walls", "wall"}
"Well, what can be said? It looks to be in perfect condition."

extra {"large ship", "ship"}
"The ship looks really big and is shaped like a dragon. The scales
sparkle and seem to be many colours."

movement SECT_INSIDE
ALWAYS_LIGHT
flags {UNIT_FL_NO_WEATHER, UNIT_FL_INDOORS}

west to chamber descr
"The hallway opens up into a chamber.";

east to office descr
"You see what looks to be an office."
keyword {"air lock door", "air lock", "door"}
open {EX_OPEN_CLOSE, EX_CLOSED};
end


office
title "The station office"
descr
"Large paintings fill the walls of this part of the station. The room
is as large as the other rooms, big enough for dragons to lounge in,
while a desk in one corner is small enough for a humanoid. The floor
along the north wall is lined with some kind of fabric and seems very
soft to walk on; judging by how large an area it covers, it may be a
dragon lounge. There is a passage to the west."

extra {"paintings", "painting"}
"The paintings show many dragons and riders at all kinds of tasks, from
combat to lookout. All the figures seem to be staring at a staff held
by a wizard painted on the south wall."

extra {"wizard", "staff"}
"The wizard has his hand stretched out, and it seems there is a place
where you could almost grab the staff. Maybe if you searched the staff
you would find something."

extra {"desk"}
"It's a desk all right, but it has no drawers and it is totally empty."

extra {"fabric"}
"Wussshhhhh! You bound across the comfortable floor. Wasn't that fun?"

movement SECT_INSIDE
ALWAYS_LIGHT
flags {UNIT_FL_NO_WEATHER, UNIT_FL_INDOORS}

west to hallway descr
"You see what looks to be a hallway."
keyword {"air lock door", "air lock", "door"}
open {EX_OPEN_CLOSE, EX_CLOSED};
end

The keywords are what players type to work the door: open door, close air lock, open east door. Make sure the description or an extra tells the player what the door is called. The first keyword names the door in messages such as "You see a closed air lock door."

A door is two exits, one in each room: an east exit in the hallway and a west exit in the office. Give both the same flags and keywords; opening or closing one side changes the other side too. An exit with no exit back is a one-way passage.

EX_CLOSED only sets how the door is when the zone boots. After that it stays as players leave it, until a door command in the %reset section closes it again, one line per side. The reset section explains them; for this door they are:

door hallway EAST {EX_OPEN_CLOSE, EX_CLOSED}
door office WEST {EX_OPEN_CLOSE, EX_CLOSED}

Locked exits

A door that can be opened by anyone may not be safe enough. EX_LOCKED locks it, and key names the object that unlocks it. The office gets a second door, to the south, leading to the room with the portal:

south to portal_room descr
"You see what looks to be a portal room."
keyword {"air lock door", "air lock", "staff", "door"}
key nokey
open {EX_OPEN_CLOSE, EX_CLOSED, EX_LOCKED}
difficulty 10;

and the portal room has the other side, with the same flags and key:

portal_room
title "Green field room"
descr
"Like the other rooms on the station this one is large enough for
dragons to fit in comfortably. The strange thing about this room is
that it is totally empty except for a green field right in the centre.
A door leads to another room to the north."

extra {"green field", "field"}
"The field looks to be a green fog, shifting and churning as you watch.
If you are nuts you could probably enter it."

movement SECT_INSIDE
ALWAYS_LIGHT
flags {UNIT_FL_NO_WEATHER, UNIT_FL_INDOORS}

north to office descr
"You see what looks to be an office."
keyword {"air lock door", "air lock", "door"}
key nokey
open {EX_OPEN_CLOSE, EX_CLOSED, EX_LOCKED}
difficulty 10;
end

You may wonder about key nokey. The key is the symbol of an object; unlocking looks for an object with that symbol in the player's inventory. There is no object called nokey, so nobody can unlock this door with a key, but it has a keyhole: a thief can pick it. How it can be opened depends on the key:

  • key names a real key object: with the key, by picking the lock, or with the unlock spell.
  • key names an object that doesn't exist: by picking the lock or with the spell.
  • No key at all: the door has no keyhole. Only the unlock spell (or DIL) opens it.
  • EX_PICKPROOF stops picking. The spell still works, unless the room's spell resistance is higher than the spell's power.

difficulty (0 to 250) makes the lock harder to pick: picking is a skill check of the thief's pick lock skill against it (see Skills). The same number makes a hidden door harder to find, as the next section shows. Locked doors need door resets too, to lock them again.

Hidden exits

Sometimes you want a door that players have to find first. EX_HIDDEN hides a closed door: it isn't listed among the exits, and players can't open, unlock or walk through it until they find it with the search command. Searching is a skill check against the exit's difficulty. Players search for a direction (search south) or for one of the door's keywords, so the keywords need to be something the player can work out. Here the office's paintings stare at a staff, the extra on the staff suggests searching it, and the door has staff among its keywords.

The south exit of the office becomes:

south to portal_room descr
"You see what looks to be a portal room."
keyword {"air lock door", "air lock", "staff", "door"}
key nokey
open {EX_OPEN_CLOSE, EX_CLOSED, EX_LOCKED, EX_HIDDEN}
difficulty 10;

A player who succeeds sees "As you search you discover an air lock door." and from then on the door is visible to that player, until the game restarts. The north side, in the portal room, is not hidden: from there the door is plain to see.

Hiding only works on a closed door. An open hidden exit is shown and can be used by anyone, which is another reason to close it again with a door reset.

Rooms inside of rooms

Now something different. Say you want a barrel in a room that players can climb into, or, in my case, a transporter field in the room that is itself a room. You could use an object for the field, but a room is much easier to deal with.

A room goes inside another room with the in field and the symbol of the outer room, with no ; after it:

in portal_room

Here is the green field, inside the portal room:

room_port
names {"green field", "field"}
title "Green field"
descr
"Green mist swirls about you."

movement SECT_INSIDE
ALWAYS_LIGHT
flags {UNIT_FL_NO_WEATHER, UNIT_FL_INDOORS}

in portal_room
end

A player in the portal room types enter field to get in and leave to get out again. enter matches the inner room's names, so they matter here.

A room inside a room isn't shown in the outer room unless you give it an outside_descr. Either give it one, or mention it in the outer room's description, as we did with the green field in the portal room's descr and its extra. A room inside a room can have exits, doors and DIL like any other room.

A room using force move

Sometimes you want to help players along: a river that carries a raft downstream, quicksand that sucks the player into another room, or here a transporter. The force move template from function.zon moves everything in a room to another room every so many ticks. We put it on the green field, so that whoever enters it is taken to the dragon ship:

room_port
names {"green field", "field"}
title "Green field"
descr
"Green mist swirls about you."

movement SECT_INSIDE
ALWAYS_LIGHT
flags {UNIT_FL_NO_WEATHER, UNIT_FL_INDOORS}

in portal_room

dilcopy force_move@function(
   // ticks between moves: 12 is 3 seconds
   12,
   // the room to move to, then '!' and the message
   "ship@dragonst!You feel your body dissolving.<br/>You appear on the deck of a ship.",
   // FALSE: move at a steady rate
   FALSE);
end

The ship has a green field of its own that leads back to the station. The two rooms are linked only by these transporters:

ship
title "War dragon"
descr
"Blue light softly glows from conduits that line the walls of this
ship. The floors beside the east and west walls have what looks to be
soft fabric covering. Small controls along the south wall seem to be
made for humanoids, with two small chairs that look to be pilot seats.
View ports are about 50 metres up the sides of the ship on the west
and east walls, and some kind of electronic screen covers the south
wall. The ship seems to be a one-room ship, but there is a green field
by the north wall."

extra {"view ports", "view port", "ports", "port"}
"Sorry, you're not 50 metres tall. Maybe they are made for a dragon?"

extra {"view screen", "screen"}
"It seems to be the pilot's view screen, but you can't see a way to
turn it on."

extra {"controls", "control"}
"The controls are in some weird language, and you're afraid that if you
start pushing buttons you might rocket into the station or, worse, slam
into a planet."

extra {"soft fabric", "fabric"}
"It looks to be a dragon lounge area."

extra {"green field", "field"}
"The field looks to be a green fog, shifting and churning as you watch."

movement SECT_INSIDE
ALWAYS_LIGHT
flags {UNIT_FL_NO_WEATHER, UNIT_FL_INDOORS}

// ship_port is inside this room: the green field
end


ship_port
names {"green field", "field"}
title "Green field"
descr
"Green mist swirls about you."

movement SECT_INSIDE
ALWAYS_LIGHT
flags {UNIT_FL_NO_WEATHER, UNIT_FL_INDOORS}

in ship

dilcopy force_move@function(12,
   "portal_room@dragonst!You feel your body dissolving.<br/>You appear in the station.",
   FALSE);
end

The destination is written as symbol@zone, even for a room in the same zone. Times are in ticks of a quarter of a second, and force move waits at least 12 ticks (3 seconds) whatever you give it.

A death room

As a final touch, a room that kills. West of the chamber is the disposal room, with a red field in it. The red field force-moves players into open space, and open space has the death room template on it: 400 hit points of damage every 3 seconds is enough to kill anyone who isn't a god.

disposal_room
title "Red field room"
descr
"Like the other rooms on the station this one is large enough for
dragons to fit in comfortably. The strange thing about this room is
that it is totally empty except for a red field right in the centre.
A passage leads back to the east."

extra {"red field", "field"}
"The field looks to be a red fog, shifting and churning as you watch.
If you are nuts you could probably enter it."

movement SECT_INSIDE
ALWAYS_LIGHT
flags {UNIT_FL_NO_WEATHER, UNIT_FL_INDOORS}

east to chamber descr
"You see the main chamber.";

// dis_port is inside this room: the red field
end


dis_port
names {"red field", "field"}
title "Red field"
descr
"Red mist swirls about you."

movement SECT_INSIDE
ALWAYS_LIGHT
flags {UNIT_FL_NO_WEATHER, UNIT_FL_INDOORS}

in disposal_room

dilcopy force_move@function(12,
   "deathspace@dragonst!You feel your body dissolving.",
   FALSE);
end


deathspace
title "Open space"
descr
"You see the ship and the station far off in the distance, and you are
in space!"

movement SECT_INSIDE
ALWAYS_LIGHT
flags {UNIT_FL_NO_WEATHER, UNIT_FL_INDOORS, UNIT_FL_NOSAVE}

dilcopy death_room@function(
   // ticks between hits: 12 is 3 seconds, the shortest it allows
   12,
   // hit points of damage per hit
   400,
   // the message for each hit
   "Too late you realise that was the rubbish disposal. Your lungs explode!");
end

UNIT_FL_NOSAVE makes sure that a player who quits in open space doesn't come back there on logging in.

Previous: DIL functions for rooms
Next: Putting the rooms together