Manual:DIL Manual/level

From DikuMUD Wiki
Jump to navigation Jump to search

level

Field (integer, read/write; units: characters; also on a cmdptr).

ch.level : integer
c.level : integer

On a character: the level. A player's level stops at MORTAL_MAX_LEVEL (50); after that only vlevel goes up. Gods are IMMORTAL_LEVEL (200) and up, to ULTIMATE_LEVEL (255); the constants are in vme.h. A zone file sets it with level in an NPC.

On a cmdptr: the lowest level that may use the command, from vme/etc/commands.def. The command interpreter compares it with the player's level.

Notes

  • On an object, a room or null it fails.
  • On an NPC any program can assign it. On a player only a program in a zone with access level 0 (the fourth column of vme/etc/zonelist) can; 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 8-bit number: values outside 0 to 255 wrap around. Assigning sets the number and nothing else.
  • On a cmdptr it is read-only in practice: vmc accepts an assignment, but at run time it stops the program with the same type error.
  • (u != null) and (u.level > 5) still reads u.level when u is null (no short-circuit); the failed value is false in any comparison.

Example

dilbegin integer may_use(pc : unitptr, cmdname : string);
var
   c : cmdptr;
code
{
   c := getcmd(cmdname);
   if (c == null)
      return (FALSE);
   return ((pc.level >= c.level) and (pc.position >= c.position));
}
dilend

Tells whether a character's level and position allow a command, the two checks the command interpreter makes.

See also