Manual:DIL Manual/weather

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

weather

Variable (integer, read-only).

weather : integer

The sky over the zone the program's unit is in: SKY_CLOUDLESS 0, SKY_CLOUDY 1, SKY_RAINING 2 or SKY_LIGHTNING 3 (vme.h).

Every zone has its own weather. It follows the zone's air pressure, which changes every mud hour around the base pressure given by the weather line of the zone's header (weather 1040) and the season (see mudmonth).

Notes

  • The zone is that of the room the unit is in, through whatever holds it: an object in a backpack has the weather of the room its carrier stands in.
  • It is the zone's weather, indoors too. Test UNIT_FL_INDOORS and UNIT_FL_NO_WEATHER yourself, on the room and what is around it, as spells.zon does before its weather spells.
  • The unit must be in a room. A player taken to the menu with gamestate() is in none, and reading weather in a program on them crashes the server.
  • It can't be assigned.

Example

dilbegin string sky_report();
var
   u : unitptr;
code
{
   u := self.outside;
   while (u)
   {
      if (isset(u.flags, UNIT_FL_NO_WEATHER | UNIT_FL_INDOORS))
         return ("You can't see the sky from here.");
      u := u.outside;
   }
   if (weather == SKY_CLOUDLESS)
      return ("The sky is clear.");
   if (weather == SKY_CLOUDY)
      return ("Clouds cover the sky.");
   if (weather == SKY_RAINING)
      return ("It is raining.");
   return ("Lightning flashes across the sky.");
}
dilend

Describes the sky, or says it can't be seen from inside, with the indoors test from spells.zon.

See also