Manual:DIL Manual/command head()

From DikuMUD Wiki
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