Manual:DIL Manual/lifespan
Jump to navigation
Jump to search
Contents
lifespan
Field (integer, read/write; units: PC).
pc.lifespan : integer
How old, in mud years, the player can grow. It is set when the character is made, from the race's lifespan in races.def plus a dice roll. youth.zon compares it with the player's age, (realtime - pc.birth) / SECS_PER_MUD_YEAR.
Notes
- Players only. On an NPC, an object, a room or null the field fails.
- Only a program in a zone with access level 0 (the fourth column of
vme/etc/zonelist) can assign it. Elsewhere vmc accepts the assignment, but at run time the program logs "DIL SERIOUS: ... Type error in lvalue assignemt" and stops. Reading works in every zone. - Stored as a 16-bit unsigned number: values outside 0 to 65535 wrap around.
Example
dilbegin integer too_old(pc : unitptr);
code
{
if (pc.type != UNIT_ST_PC)
return (FALSE);
if (pc.level >= IMMORTAL_LEVEL)
return (FALSE);
return ((realtime - pc.birth) > (pc.lifespan * SECS_PER_MUD_YEAR));
}
dilend
Tells whether a mortal player has outlived the lifespan, as in youth.zon.