Manual:DIL Manual/zonereset()

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

zonereset()

Procedure. Resets a zone now.

zonereset(z : zoneptr)

Runs the zone's %reset section at once, as a timed reset would: what is missing is loaded again, within the limits the reset commands set. It ignores the zone's reset mode (it runs even for RESET_NOT and with players in a RESET_IFEMPTY zone) and doesn't change when the next timed reset comes.

It works from any zone and on any zone. Each call is written to the zone log: "DIL '...' programatically resetting zone ...".

Parameters

Name Type Meaning
z zoneptr The zone, usually from findzone().

Notes

  • A zone variable holding null is logged ("tried to call zonereset() with a null pointer") and nothing happens. But zonereset(findzone(name)) with a name that isn't a zone stops the program with "Type error in zonereset": put the zone in a variable and test it first.

Example

dilbegin cmd_reset(arg : string);
var
   z : zoneptr;
   u : unitptr;
code
{
   if (arg == "")
   {
      u := self.outside;
      while (u.type != UNIT_ST_ROOM)
         u := u.outside;
      z := findzone(u.zone);
   }
   else
      z := findzone(arg);

   if (z == null)
   {
      sendtext("Could not find a zone named " + arg + ".<br/>", self);
      quit;
   }
   sendtext("Resetting zone " + z.name + ".<br/>", self);
   zonereset(z);
   quit;
}
dilend

A god command that resets the zone named, or the zone the god is in, as cmd_reset in commands.zon does.

See also