Manual:DIL Manual/exit to
Jump to navigation
Jump to search
Contents
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
diris outside 0 toMAX_EXIT. A failed value is false in anif, soif (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].movementworks. - To move an NPC through an exit, use
exec("north", self)(an ordinary move, with its messages and checks) rather thanlink(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).