Difference between revisions of "Manual:DIL Manual/weather"

From DikuMUD Wiki
Jump to navigation Jump to search
(XML import)
(checked against the compiler and the interpreter; example compiles)
 
Line 1: Line 1:
−
<span id="weather"></span>
+
= weather =
−
'weather'
+
'''Variable''' (integer, read-only).
−
    This is the state of the mud-weather. It will equal one of the
 
−
    SKY_XXX values in values.h and/or vme.h.
 
  
−
  ---~---~---~---~---~---~---~---~---
+
  weather : integer
−
<span id="weather"></span>
 
−
'weather'
 
−
    This is the state of the mud-weather. It will equal one of the
 
−
    SKY_XXX values in values.h and/or vme.h.
 
  
−
---~---~---~---~---~---~---~---~---
+
The sky over the zone the program's unit is in: <code>SKY_CLOUDLESS</code> 0, <code>SKY_CLOUDY</code> 1, <code>SKY_RAINING</code> 2 or <code>SKY_LIGHTNING</code> 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 <code>weather</code> line of the zone's header (<code>weather 1040</code>) 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 <code>UNIT_FL_INDOORS</code> and <code>UNIT_FL_NO_WEATHER</code> 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 <code>weather</code> in a program on them crashes the server.
 +
* It can't be assigned.
 +
 
 +
== Example ==
 +
<pre>
 +
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
 +
</pre>
 +
Describes the sky, or says it can't be seen from inside, with the indoors test from spells.zon.
 +
 
 +
== See also ==
 +
* [[Manual:DIL Manual/mudhour|mudhour]]
 +
* [[Manual:DIL Manual/mudmonth|mudmonth]]
 +
* [[Manual:DIL Manual/flags|flags]]
 +
* [[Manual:DIL Manual/isset()|isset()]]

Latest revision as of 23:19, 14 November 2026

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