Manual:DIL Manual/skill name()

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 name()

Function (string). Gives the name of a skill from its number.

skill_name(i : integer)

The skill numbers are the SKI_ constants in vme/include/values.h, for example SKI_PICK_POCKETS (31). The names come from the name lines of the skills in vme/etc/commands.def, in lower case: skill_name(SKI_PICK_POCKETS) is "pick pockets".

Parameters

Name Type Meaning
i integer The skill number.

Returns

The skill's name, or "" when the number has no skill or is outside 0 to 299 (SKI_TREE_MAX - 1).

Notes

  • The skills are numbered without gaps from 0, so a loop can go on until the name is "", as the skills list in commands.zon does.
  • weapon name() does the same for weapons, but gives null, not "", outside its range.

Example

dilbegin skill_list(pc : unitptr);
var
   i : integer;
code
{
   i := 0;
   while (skill_name(i) != "")
   {
      if (pc.skills[i] > 0)
         sendtext(itoa(pc.skills[i]) + "% " + skill_name(i) + "<br/>", pc);
      i := i + 1;
   }
}
dilend

Shows a player the skills they have learnt, as the skills command in commands.zon does.

See also