Manual:DIL Manual/skill levels

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

skill_levels

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

pc.skill_levels[index] : integer

How many times the player has trained the skill with that index since gaining the current level. Each training in the same level costs more (teach.cpp), and every level gained sets all of them back to 0. The indexes are the SKI_* constants in vme/include/values.h, from 0 to SKI_TREE_MAX - 1.

Notes

  • Players only. On an NPC, an object, a room or null the field fails; so does an index outside 0 to SKI_TREE_MAX - 1.
  • Training a skill can also count up its parent groups in the skill tree.
  • Only a program in a zone with access level 0 (the fourth column of vme/etc/zonelist) can assign it. 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_lvl(pc : unitptr);
var
   i : integer;
   s : string;
code
{
   s := "";
   if (pc.type != UNIT_ST_PC)
      return (s);
   i := 0;
   while (i < SKI_TREE_MAX)
   {
      if (pc.skill_levels[i] > 0)
         s := s + skill_name(i) + ": " + itoa(pc.skill_levels[i]) + "<br/>";
      i := i + 1;
   }
   return (s);
}
dilend

Lists the skills a player has trained since the last level, and how often.

See also