Manual:DIL Manual/position

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

position

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

ch.position : integer
c.position : integer

On a character: the position, a POSITION_ constant from vme.h: POSITION_DEAD (0), POSITION_MORTALLYW, POSITION_INCAP, POSITION_STUNNED, POSITION_SLEEPING, POSITION_RESTING, POSITION_SITTING, POSITION_FIGHTING, POSITION_STANDING (8). Each is more awake than the one before, so ch.position >= POSITION_RESTING means awake and able to act.

On a cmdptr: the lowest position in which the command can be used, from vme/etc/commands.def. The command interpreter compares it with the character's position.

Notes

  • On an object, a room or null it fails.
  • No access level is needed to assign it. Assigning sets the number and nothing else: it does not start or stop a fight, and nothing checks the value. position_update() sets it from the hit points: stunned, incapacitated, mortally wounded or dead at 0 hit points or less, and standing again for a character with hit points who was stunned or worse.
  • Assigning it on a cmdptr changes the command for everybody until the next reboot.
  • Stored as an 8-bit number.

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