Manual:DIL Manual/birth

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

birth

Field (integer, read/write; units: PC).

pc.birth : integer

When the player was born, in real seconds since 1970 like realtime. It is set to the moment the character is made. The player's age in mud years is (realtime - pc.birth) / SECS_PER_MUD_YEAR, as score in commands.zon and youth.zon work it out.

Assigning it changes the player's age: youth.zon sets pc.birth := realtime - (newage * SECS_PER_MUD_YEAR).

Notes

  • Players only. On an NPC, an object, a room or null the field fails.
  • Assignable from any zone.
  • youth.zon and update.zon compare the age with lifespan.

Example

dilbegin set_age(pc : unitptr, newage : integer);
code
{
   if (pc.type != UNIT_ST_PC)
      return;
   pc.birth := realtime - (newage * SECS_PER_MUD_YEAR);
   sendtext("You are now " + itoa((realtime - pc.birth) / SECS_PER_MUD_YEAR) +
            " years old.<br/>", pc);
   return;
}
dilend

Sets a player's age in mud years, as youth.zon does.

See also