Manual:DIL Manual/followercount

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

followercount

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

ch.followercount : integer

How many characters follow this one directly: not their own followers. 0 when none. getfollower(ch, i) gives each of them, i from 0 to followercount - 1; a follower's master is this character.

Notes

  • Read-only: vmc refuses an assignment ("Illegal lvalue").
  • Followers are not all in the group: test CHAR_GROUP in their charflags.
  • On an object, a room or null it fails.

Example

dilbegin group_hp(ch : unitptr);
var
   i : integer;
   u : unitptr;
code
{
   i := 0;
   while (i < ch.followercount)
   {
      u := getfollower(ch, i);
      if (isset(u.charflags, CHAR_GROUP))
         sendtext(u.name + ": " + itoa(u.hp) + "/" + itoa(u.max_hp) + " hit points<br/>", ch);
      i := i + 1;
   }
   return;
}
dilend

Shows a leader the hit points of each group member, as the group command in commands.zon.

See also