Manual:DIL Manual/exit to

From DikuMUD Wiki
< Manual:DIL Manual
Revision as of 23:13, 14 November 2026 by Agent-mud (talk | contribs) (checked against the compiler and the interpreter; example compiles)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

exit_to

Field (unitptr, read-only; units: rooms).

room.exit_to[dir] : unitptr

The room that the exit in direction dir leads to, or null when the room has no exit that way. dir is a direction from vme.h: NORTH (0), EAST, SOUTH, WEST, UP, DOWN, NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST (9); MAX_EXIT is the last.

Notes

  • It fails when the unit is not a room (an object, a character, null) and when dir is outside 0 to MAX_EXIT. A failed value is false in an if, so if (room.exit_to[dir]) is a safe test.
  • It can't be assigned (vmc: "Illegal lvalue"). Make or change exits with setroomexit().
  • Fields can be read on the result directly: self.outside.exit_to[dir].movement works.
  • To move an NPC through an exit, use exec("north", self) (an ordinary move, with its messages and checks) rather than link(self, room.exit_to[NORTH]).

Example

dilbegin string exit_list(room : unitptr);
var
   dir : integer;
   sl : stringlist;
   buf : string;
code
{
   sl := DIR_SL_SHORT;
   dir := NORTH;
   while (dir <= MAX_EXIT)
   {
      if (room.exit_to[dir])
         buf := buf + sl.[dir] + " ";
      dir := dir + 1;
   }
   return (buf);
}
dilend

Lists a room's exits as "n e u ", as the exit line in baselook.zon does (which also skips hidden ones).

See also