Manual:DIL Manual/zone

From DikuMUD Wiki
Jump to navigation Jump to search

zone

Field (string, read-only; units: all).

u.zone : string

The name of the zone the unit is in now: the zone of the room at the top of whatever holds it. A sword carried by a player from Midgaard into the arena gives "arena". The zone a unit was defined in is zoneidx instead.

Notes

  • Read-only: vmc refuses an assignment ("Illegal lvalue").
  • For a room it is the room's own zone, unless the room is inside another unit: then it is the zone at the top.
  • findzone() turns the name into a zoneptr, e.g. zonereset(findzone(self.zone)) as in function.zon.
  • On null it fails.

Example

dilbegin zone_shout(msg : string);
var
   pc : unitptr;
code
{
   pc := ghead();
   while (pc.type == UNIT_ST_PC)
   {
      if ((pc.zone == self.zone) and (pc.position > POSITION_SLEEPING))
         sendtext(msg + "<br/>", pc);
      pc := pc.gnext;
   }
   return;
}
dilend

Sends a message to every player awake in the zone the NPC is in, as an NPC's shout in comm.zon.

See also