Manual:DIL Manual/ability levels

From DikuMUD Wiki
Jump to navigation Jump to search

ability_levels

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

pc.ability_levels[i] : integer

How many times the player has trained ability i since the last level gained. Each session costs half as much again as the one before it (teach.cpp); a second session in a level needs a total race and profession modifier above 0, a third one at least 3. The practice lists show the count as stars. Every level gained sets all the counts back to 0. i is an ABIL_ constant from vme.h, ABIL_MAG (0) to ABIL_HP (7).

Notes

  • Players only. On an NPC, an object, a room or null it fails, and also when i is outside 0 to 7.
  • 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 8-bit number: values outside 0 to 255 wrap around.

Example

dilbegin string trained_stars(pc : unitptr, i : integer);
var
   n : integer;
   s : string;
code
{
   n := pc.ability_levels[i];
   while (n > 0)
   {
      s := s + "*";
      n := n - 1;
   }
   return (s);
}
dilend

Shows how often a player has trained an ability this level, as stars like the practice list.

See also