Manual:DIL Manual/vlevel

From DikuMUD Wiki
Jump to navigation Jump to search

vlevel

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

pc.vlevel : integer

The player's virtual level. It goes up by one with every level raised, also past MORTAL_MAX_LEVEL (50), where level stops. The experience needed for the next level, and so exptol, is computed from it.

Notes

  • Players only. On an NPC, an object, a room or null it fails.
  • Only a program in a zone with access level 0 (the fourth column of vme/etc/zonelist) can assign it; what counts is the zone of the program running on the unit, not that of a function it calls. 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 an unsigned 16-bit number: values outside 0 to 65535 wrap around. Assigning sets the number and nothing else.

Example

dilbegin integer may_enter(pc : unitptr, minlvl : integer, maxlvl : integer);
code
{
   if (pc.type != UNIT_ST_PC)
      return (FALSE);
   return ((pc.vlevel >= minlvl) and (pc.vlevel <= maxlvl));
}
dilend

Checks a player against a level range, as the competitions in competition.zon do.

See also