Manual:DIL Manual/rooms

From DikuMUD Wiki
< Manual:DIL Manual
Revision as of 23:08, 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

rooms

Field (unitptr, read-only; on a zoneptr).

z.rooms : unitptr

One room of the zone: the one whose symbolic name sorts first. It is a way to get some room in a zone, as the goto command in commands.zon does when given a zone name.

It is not the start of a list of the zone's rooms: next on the room gives the next unit in the same place, not the next room of the zone. To reach a particular room, use findroom("name@zone").

Notes

  • It fails on a null zoneptr and on a zone without rooms. A failed value isn't assigned: after u := z.rooms; on such a zone, u still holds what it held before, so set it to null first.
  • It can't be assigned (vmc: "Illegal lvalue").
  • Like every field name, rooms is a reserved word: no variable can have that name.

Example

dilbegin goto_zone(pc : unitptr, zonename : string);
var
   z : zoneptr;
   room : unitptr;
code
{
   z := findzone(zonename);
   if (z == null)
      return;
   room := null;
   room := z.rooms;
   if (room == null)
      return;
   link(pc, room);
}
dilend

Takes a god to a room in the named zone, as goto does in commands.zon.

See also