Manual:DIL Manual/npccount

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

npccount

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

z.npccount : integer

Meant to be the number of NPCs the zone defines, but the server never counts them: it is always 0. To count the copies of one NPC in the game, use loadcount.

Notes

  • It can't be assigned (vmc: "Illegal lvalue").
  • On a null zoneptr it fails.
  • roomcount does count the zone's rooms.

Example

dilbegin string zone_npcs(z : zoneptr);
code
{
   if (z == null)
      return ("");
   return (z.name + ": " + itoa(z.npccount) + " NPCs.");
}
dilend

Tells how many NPCs a zone has; it shows 0 until the server counts them.

See also