Manual:DIL Manual/rooms
Jump to navigation
Jump to search
Contents
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,ustill holds what it held before, so set it to null first. - It can't be assigned (vmc: "Illegal lvalue").
- Like every field name,
roomsis 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.