Difference between revisions of "Manual:DIL Manual/mud(day,month,..)"

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="mmmm"></span>
+
= mudhour, mudday, mudmonth, mudyear =
−
'mudday'
+
'''Variables''' (integer, read only).
−
'mudhour'
+
 
−
'mudmonth'
+
mudhour : integer
−
'mudyear'
+
mudday : integer
−
    These variables lets your program keep track of the time in the mud.
+
mudmonth : integer
−
    They all have integer types.
+
mudyear : integer
−
<span id="mmmm"></span>
+
 
−
'mudday'
+
The game's clock and calendar. Each has its own page; this page shows them together.
−
'mudhour'
+
 
−
'mudmonth'
+
{| class="wikitable"
−
'mudyear'
+
! Variable !! Range !! Length
−
    These variables lets your program keep track of the time in the mud.
+
|-
−
    They all have integer types.
+
| [[Manual:DIL Manual/mudhour()|mudhour]] || 0 to 23 || one mud hour is 5 real minutes (<code>SECS_PER_MUD_HOUR</code>)
 +
|-
 +
| [[Manual:DIL Manual/mudday()|mudday]] || 0 to 13: the day of the month || one mud day is 24 mud hours, 2 real hours
 +
|-
 +
| [[Manual:DIL Manual/mudmonth()|mudmonth]] || 0 to 8 || a month is 14 days (<code>MUD_MONTH</code>)
 +
|-
 +
| [[Manual:DIL Manual/mudyear()|mudyear]] || 0 and up || a year is 9 months (<code>MUD_YEAR</code>)
 +
|}
 +
 
 +
== Notes ==
 +
* They are variables, not functions: write <code>mudhour</code>, not <code>mudhour()</code>.
 +
* The clock runs on the game's ticks, so a god's <code>wtimewarp</code> moves it forward too.
 +
* The constants are in vme.h. The comments there that say "21 mud days per mud month" are out of date: <code>MUD_MONTH</code> is 14.
 +
 
 +
== Example ==
 +
<pre>
 +
dilbegin nightwatch();
 +
code
 +
{
 +
  heartbeat := PULSE_SEC * 60;
 +
 
 +
  :start:
 +
  wait(SFB_TICK, (mudhour >= 22) or (mudhour < 6));
 +
 
 +
  exec("emote lights a lantern.", self);
 +
  wait(SFB_TICK, (mudhour >= 6) and (mudhour < 22));
 +
 
 +
  exec("emote puts out the lantern.", self);
 +
  goto start;
 +
}
 +
dilend
 +
</pre>
 +
A watchman who lights his lantern at night.
 +
 
 +
== See also ==
 +
* [[Manual:DIL Manual/mudhour()|mudhour]]
 +
* [[Manual:DIL Manual/mudday()|mudday]]
 +
* [[Manual:DIL Manual/mudmonth()|mudmonth]]
 +
* [[Manual:DIL Manual/mudyear()|mudyear]]
 +
* [[Manual:DIL Manual/realtime|realtime]]
 +
* [[Manual:DIL Manual/weather|weather]]

Revision as of 23:25, 14 November 2026

mudhour, mudday, mudmonth, mudyear

Variables (integer, read only).

mudhour : integer
mudday : integer
mudmonth : integer
mudyear : integer

The game's clock and calendar. Each has its own page; this page shows them together.

Variable Range Length
mudhour 0 to 23 one mud hour is 5 real minutes (SECS_PER_MUD_HOUR)
mudday 0 to 13: the day of the month one mud day is 24 mud hours, 2 real hours
mudmonth 0 to 8 a month is 14 days (MUD_MONTH)
mudyear 0 and up a year is 9 months (MUD_YEAR)

Notes

  • They are variables, not functions: write mudhour, not mudhour().
  • The clock runs on the game's ticks, so a god's wtimewarp moves it forward too.
  • The constants are in vme.h. The comments there that say "21 mud days per mud month" are out of date: MUD_MONTH is 14.

Example

dilbegin nightwatch();
code
{
   heartbeat := PULSE_SEC * 60;

   :start:
   wait(SFB_TICK, (mudhour >= 22) or (mudhour < 6));

   exec("emote lights a lantern.", self);
   wait(SFB_TICK, (mudhour >= 6) and (mudhour < 22));

   exec("emote puts out the lantern.", self);
   goto start;
}
dilend

A watchman who lights his lantern at night.

See also