Manual:DIL Manual/exptol

From DikuMUD Wiki
Jump to navigation Jump to search

exptol

Field (integer, read-only; units: PC).

pc.exptol : integer

The experience a player still needs for the next level: the experience required for vlevel + 1 minus exp. At 0 or below the player can use the level command.

Notes

  • Use it on players only. On an NPC it crashes the server: the code takes any character and then reads the player-only virtual level (dilfld.cpp, DILF_EXPTOL). Test u.type == UNIT_ST_PC first.
  • On an object, a room or null it fails.
  • It can't be assigned (vmc: "Illegal lvalue"). It changes when exp or vlevel does.
  • The experience a level needs is also available as getinteger(DIL_GINT_REQXP, null, level).

Example

dilbegin string level_status(pc : unitptr);
code
{
   if (pc.type != UNIT_ST_PC)
      return ("");
   if (pc.exptol <= 0)
      return ("You can now advance a level - congratulations!");
   return ("You need " + itoa(pc.exptol) + " experience points to the next level.");
}
dilend

Tells a player how far the next level is, as score does in commands.zon.

See also