Manual:DIL Manual/mudyear

From DikuMUD Wiki
Jump to navigation Jump to search

mudyear

Variable (integer, read-only).

mudyear : integer

The mud year: the number of mud years since 11 August 1990, about 1261 in November 2026. A mud year is 9 mud months, 10.5 real days.

Notes

  • It only counts up, so it suits charges by the year: commands.zon's storage stores itoa(mudyear) in an extra on the item and charges for the years passed when it is fetched.
  • A player's age is not counted from mudyear but from real time: (realtime - pc.birth) / SECS_PER_MUD_YEAR, as youth.zon does.
  • The calendar (vme.h): an hour is 5 real minutes (SECS_PER_MUD_HOUR), a day 24 hours (2 real hours), a month 14 days (MUD_MONTH; the comment beside it in vme.h still says 21), a year 9 months (MUD_YEAR, 10.5 real days). The count starts on 11 August 1990.
  • The mud clock is the real clock at boot plus the game ticks since (mud_date in weather.cpp). Normally it keeps pace with real time; with vme -w, or after a god's wtimewarp, it runs ahead, so code that waits for a time of day can be tried quickly.
  • Written without brackets: mudyear() doesn't compile. It can't be assigned.

Example

dilbegin integer storage_fee(item : unitptr);
var
   e     : extraptr;
   years : integer;
code
{
   e := "$stored" in item.extra;
   if (e == null)
      return (0);
   years := mudyear - atoi(e.descr);
   if (years < 1)
      years := 1;
   if (years > 10)
      years := 10;
   return (years * GOLD_MULT);
}
dilend

The fee for an item stored with addextra(item.extra, {"$stored"}, itoa(mudyear)): one gold piece a year, at least one and at most ten, as in commands.zon.

See also