Manual:DIL Manual/command head()

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

command_head()

Function (cmdptr). Another name for chead(): the first command in the game's command table.

command_head()

Exactly the same as chead(): vmc compiles both to the same call. It returns the first command loaded from vme/etc/commands.dat; each command's next is the one after it, and null after the last.

Returns

Cmdptr: the first command.

Notes

  • The public zones use chead(); see that page for the details.

Example

dilbegin integer wiz_cmd_count();
var
   cmd : cmdptr;
   n : integer;
code
{
   cmd := command_head();
   while (cmd)
   {
      if (cmd.level >= IMMORTAL_LEVEL)
         n := n + 1;
      cmd := cmd.next;
   }
   return (n);
}
dilend

Counts the commands meant for gods (level 200 and up).

See also