/
roa/
roa/lib/boards/
roa/lib/config/
roa/lib/edits/
roa/lib/help/
roa/lib/misc/
roa/lib/plrobjs/
roa/lib/quests/
roa/lib/socials/
roa/lib/www/
roa/lib/www/LEDSign/
roa/lib/www/LEDSign/fonts/
roa/lib/www/LEDSign/scripts/
roa/src/s_inc/
roa/src/sclient/
roa/src/sclient/binary/
roa/src/sclient/text/
roa/src/util/
/************************************************************************
	Realms of Aurealis 		James Rhone aka Vall of RoA

interpreter.c			Command interpreter, interface control
				for players.  Handles command parsing,
				command routing.

		******** Heavily modified and expanded ********
		*** BE AWARE OF ALL RIGHTS AND RESERVATIONS ***
		******** Heavily modified and expanded ********
		        All rights reserved henceforth. 

    Please note that no guarantees are associated with any code from
Realms of Aurealis.  All code which has been released to the general
public has been done so with an 'as is' pretense.  RoA is based on both
Diku and CircleMUD and ALL licenses from both *MUST* be adhered to as well
as the RoA license.   *** Read, Learn, Understand, Improve ***
*************************************************************************/
#include "conf.h"
#include "sysdep.h"

#include "structures.h"
#include "comm.h"
#include "interpreter.h"
#include "acmd.h"
#include "db.h"
#include "utils.h"
#include "mudlimits.h"
#include "magic.h"
#include "handler.h"
#include "mail.h"
#include "screen.h"
#include "objsave.h"
#include "quest.h"
#include "lists.h"
#include "fight.h"
#include "global.h"
#include "htown.h"
#include "affect.h"
#include "darkenelf.h"

/* external functions */
int	special(chdata *ch, int cmd, char *arg);
int     check_reaction(chdata *ch, char *str);
int     check_rtrigs(chdata *ch, char *str);

// fill words, one_argument ignores these
char	*fill[] = 
{
   "in",
   "from",
   "with",
   "the",
   "on",
   "at",
   "to",
   "\n"
};

// Reserved words. 03/22/98 -callahan
char *reserved[] =
{
  "self",
  "me",
  "all",
  "room",
  "someone",
  "something",
  "\n"
};

int	search_block(char *arg, char **list, BOOL exact)
{
   register int	i, l;

   /* Make into lower case, and get length of string */
   for (l = 0; *(arg + l); l++)
      *(arg + l) = LOWER(*(arg + l));

   if (exact) {
      for (i = 0; **(list + i) != '\n'; i++)
	 if (!str_cmp(arg, *(list + i)))
	    return(i);
   } else {
      if (!l)
	 l = 1; /* Avoid "" to match the first available string */
      for (i = 0; **(list + i) != '\n'; i++)
	 if (!strncmp(arg, *(list + i), l))
	    return(i);
   }

   return(-1);
}

// tried command, but in improper position
void send_wrong_pos_mesg(chdata *ch)
{
  switch (GET_POS(ch)) {
  case POS_DEAD:
     send_to_char("Lie still; you are DEAD!!! :-( \n\r", ch);
     break;
  case POS_INCAP:
  case POS_MORTALLYW:
     send_to_char("You are in a pretty bad shape, unable to do anything!\n\r", ch);
     break;
  case POS_STUNNED:
     if (GET_HIT(ch) > 0) 
       update_pos(ch);
     else
       send_to_char("All you can do right now is think about the stars!\n\r", ch);
     break;
  case POS_SLEEPING:
     send_to_char("You'd have to be awake to do that.\n\r", ch);
     break;
  case POS_RESTING:
     send_to_char("Nah... You feel too relaxed to do that..\n\r", ch);
     break;
  case POS_SITTING:
     send_to_char("Maybe you should get on your feet first?\n\r", ch);
     break;
  case POS_FIGHTING:
     send_to_char("No way!  You're fighting for your life!\n\r", ch);
     break;
  }
}

int is_number(char *str)
{
   int	look_at;

   if (*str == '\0')
      return(0);

   for (look_at = 0; *(str + look_at) != '\0'; look_at++)
      if ((*(str + look_at) < '0') || (*(str + look_at) > '9'))
	 return(0);
   return(1);
}


/* same as one_argument except that it doesn't ignore fill words */
char *any_one_arg(char *argument, char *first_arg)
{
  skip_spaces(&argument);

  while (*argument && !isspace(*argument)) {
    *(first_arg++) = LOWER(*argument);
    argument++;
  }

  *first_arg = '\0';

  return argument;
}

/* find the first sub-argument of a string, return pointer to first char in
   primary argument, following the sub-arg */
char	*one_argument(char *argument, char *first_arg)
{
   int	found, begin, look_at;

   found = begin = 0;

   do {
      /* Find first non blank */
      for ( ; isspace(*(argument + begin)); begin++)
	 ;

      /* Find length of first word */
      for (look_at = 0; *(argument + begin + look_at) > ' ' ; look_at++)

	 /* Make all letters lower case, && copy them to first_arg */
	 *(first_arg + look_at) = LOWER(*(argument + begin + look_at));

      *(first_arg + look_at) = '\0';
      begin += look_at;
   } while (fill_word(first_arg));

   return(argument + begin);
}

int fill_word(char *argument)
{
   return (search_block(argument, fill, TRUE) >= 0);
}

int reserved_word(char *argument)	// 03/22/98 -callahan
{
  return (search_block(argument, reserved, TRUE) >= 0);
}

/* determine if a given string is an abbreviation of another */
int	is_abbrev(char *arg1, char *arg2)
{
  if (!*arg1)
    return(FALSE);

  for (; *arg1; arg1++, arg2++)
  {
    if ((!isalpha(*arg1) || !isalpha(*arg2)) && *arg1 != *arg2)
      return (FALSE);
    else
    if (LOWER(*arg1) != LOWER(*arg2))
      return(FALSE);
  }

  return(TRUE);
}

// Same as one_argument except that it takes two args and returns the rest
char *two_arguments(char *argument, char *first_arg, char *second_arg)
{
  return one_argument(one_argument(argument, first_arg), second_arg); /* :-) */
}

/* return first 'word' plus trailing substring of input string */
void	half_chop(char *string, char *arg1, char *arg2)
{
  for (; isspace(*string); string++)
     ;

  for (; !isspace(*arg1 = *string) && *string; string++, arg1++)
     ;
 
  *arg1 = '\0';

  for (; isspace(*string); string++)
     ;

  for (; (*arg2 = *string); string++, arg2++)
     ;
  
  return;
}

int special(chdata *ch, int cmd, char *arg)
{
   register obdata *i;
   register chdata *k;
   extern int postmaster(chdata *ch, chdata *k, int cmd, char *arg);

   if (IN_NOWHERE(ch))
     return(0);

   /* special in equipment list? 
   for (j = 0; j < MAX_WEAR; j++)
      if (EQ(ch, j) && EQ(ch, j)->item_number >= 0)
	 if (obj_index[EQ(ch, j)->item_number].func)
	    if ((*obj_index[EQ(ch, j)->item_number].func) (ch, cmd, arg))
	       return(1);
   */

   /* special in inventory? 
   for (i = ch->carrying; i; i = i->next_content)
      if (i->item_number >= 0)
	 if (obj_index[i->item_number].func)
	    if ((*obj_index[i->item_number].func)(ch, cmd, arg))
	       return(1);
   */

   /* special in mobile present? added mobflag postmaster RoA*/
    for (k = world[ch->in_room].people; k; k = k->next_in_room)
      if (IS_MOB(k))
      {
	if (SPC_FLAGGED(k, SPC_MAILMAN))
	  if (postmaster(ch, k, cmd, arg))
	    return (1);

	 if (mob_index[k->nr].func)
	    if ((*mob_index[k->nr].func)(ch, cmd, arg))
	       return(1);
      }

   /* special in object present? */
    for (i = world[ch->in_room].contents; i; i = i->next_content)
      if (GET_OBJ_RNUM(i) >= 0)
	 if (obj_index[GET_OBJ_RNUM(i)].func)
	    if ((*obj_index[GET_OBJ_RNUM(i)].func)(ch, cmd, arg))
	       return(1);

   return(0);
}

// add a command to the command list, and increment the top_of_cmds
void addcommand( char *comm, int min_pos, 
                 void (*pointer) (struct char_data *ch, char * argument, int cmd, int subcmd),
                 int min_level, int subc, int bitv, int gbitv, int glev)

{
  if (top_of_cmds >= MAX_CMD_LIST)
  {
    mudlog("SYSWAR: Out of room in command array.", NRM, LEV_GOD, TRUE);
    return;
  }

  cmd_info[(top_of_cmds)].slot = (top_of_cmds);
  strcpy(cmd_info[(top_of_cmds)].comm, comm);
  cmd_info[(top_of_cmds)].cmd_ptr = (pointer);
  cmd_info[(top_of_cmds)].minimum_position = (min_pos);
  cmd_info[(top_of_cmds)].minimum_level = (min_level);
  cmd_info[(top_of_cmds)].subcmd = (subc);
  cmd_info[(top_of_cmds)].bitvector = (bitv);
  cmd_info[(top_of_cmds)].gbitvector = (gbitv);
  cmd_info[(top_of_cmds)].glevel = (glev);

  top_of_cmds++;
}

// return the command slot, if its there, if not, -1  4/9/98 -jtrhone
int get_command(char *arg)
{
  char comm[MAX_INPUT_LENGTH];
  int i;

  any_one_arg(arg, comm);
  for (i = 1; i < top_of_cmds; i++)
    if (is_abbrev(comm, cmd_info[i].comm))
      return i;

  return -1;
}

// revamped, order is mostly unimportant now...
// 4/9/98 -jtrhone
// added ooc and question/answer channels if so chosen to be used by
// administrator via config file and useglobals variable 4/11/98 -jtrhone
// assemview now LEV_IMM  5/23/98 -jtrhone
// asssemload now LEV_CIMP  5/23/98 -jtrhone
void assign_command_pointers (void)
{
  top_of_cmds = 0;

  // need an offset for command 0
  addcommand("OFFSET", POS_DEAD, do_move,LEV_IMPL,0,CMD_NONE, NOGRANTS,0);

  // the directions ARE order dependant, don't move these
  ////////////////////////////////////////////////////////////////////
  // directions
  ////////////////////////////////////////////////////////////////////
  addcommand("north", POS_STANDING, do_move, 0, 0, CMD_NONE, NOGRANTS, 0);
  addcommand("east",  POS_STANDING, do_move, 0, 0, CMD_NONE, NOGRANTS, 0);
  addcommand("south", POS_STANDING, do_move, 0, 0, CMD_NONE, NOGRANTS, 0);
  addcommand("west",  POS_STANDING, do_move, 0, 0, CMD_NONE, NOGRANTS, 0);
  addcommand("up",    POS_STANDING, do_move, 0, 0, CMD_NONE, NOGRANTS, 0);
  addcommand("down" , POS_STANDING, do_move, 0, 0, CMD_NONE, NOGRANTS, 0);
  addcommand("neast", POS_STANDING, do_move, 0, 0, CMD_NONE, NOGRANTS, 0);
  addcommand("seast", POS_STANDING, do_move, 0, 0, CMD_NONE, NOGRANTS, 0);
  addcommand("swest", POS_STANDING, do_move, 0, 0, CMD_NONE, NOGRANTS, 0);
  addcommand("nwest", POS_STANDING, do_move, 0, 0, CMD_NONE, NOGRANTS, 0);


  ////////////////////////////////////////////////////////////////////
  // preventions come RIGHT after dirs to catch them early
  ////////////////////////////////////////////////////////////////////
  addcommand("qui",    POS_DEAD, do_quit, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("shutdow", POS_DEAD, do_shutdown, LEV_IMPL, 0,CMD_NONE, NOGRANTS, 0);


  ////////////////////////////////////////////////////////////////////
  // Primaries   (those which should come first, common commands) 
  ////////////////////////////////////////////////////////////////////
  addcommand("affects", POS_DEAD, do_affects, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("afk", POS_SLEEPING, do_afk, 1, 0,CMD_NONE, NOGRANTS,0);;
  addcommand("alias", POS_SLEEPING, do_alias, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("assist", POS_FIGHTING, do_assist, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("assemble", POS_STANDING, do_assemble, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("assassinate", POS_STANDING, do_assassinate, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("ban", POS_DEAD, do_ban, LEV_CIMP, 0,CMD_NONE, GRNT_BAN, LEV_CIMP);
  addcommand("bank", POS_SLEEPING, do_gold, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("balance", POS_STANDING, do_bank, 1, SCMD_BALANCE,CMD_NONE, NOGRANTS,0);
  addcommand("bladedance", POS_FIGHTING, do_bladedance, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("blindstrike", POS_FIGHTING, do_blindstrike, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("brew", POS_STANDING, do_brew, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("bug", POS_DEAD, do_gen_write, 0, SCMD_BUG,CMD_NONE, NOGRANTS,0);
  addcommand("cast",   POS_SITTING, do_cast, 1, 0,CMD_TRUSTED, NOGRANTS,0);
  addcommand("check", POS_STANDING, do_not_here, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("consider", POS_RESTING, do_consider, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("clientopt", POS_SLEEPING, do_client_options, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("darttrap", POS_STANDING, do_darttrap, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("deposit", POS_STANDING, do_bank, 1, SCMD_DEPOSIT,CMD_NONE, NOGRANTS,0);
  addcommand("detect", POS_STANDING, do_detect, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("disembowel", POS_FIGHTING, do_disembowel, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("doorbash", POS_STANDING, do_doorbash, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("drink", POS_RESTING, do_drink, 0, SCMD_DRINK,CMD_NONE, NOGRANTS,0);
  addcommand("eat",   POS_RESTING, do_eat, 0, SCMD_EAT,CMD_NONE, NOGRANTS,0);
  addcommand("eavesdrop", POS_RESTING, do_eavesdrop, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("equipment", POS_SLEEPING, do_equipment, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("extinguish", POS_RESTING, do_extinguish, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("firetrap", POS_STANDING, do_firetrap, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("flee", POS_FIGHTING, do_flee, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("get",   POS_RESTING, do_get, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("hamstring", POS_FIGHTING, do_hamstring, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("help",   POS_DEAD, do_help, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("inventory", POS_DEAD, do_inventory, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("idea", POS_DEAD, do_gen_write, 0, SCMD_IDEA,CMD_NONE, NOGRANTS,0);
  addcommand("jamlock", POS_STANDING, do_jamlock, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("kill",  POS_FIGHTING, do_kill, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("look",  POS_RESTING, do_look, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("light", POS_RESTING, do_light	, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("lighttrap", POS_STANDING, do_lightningtrap, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("lowstrike",  POS_FIGHTING, do_lowstrike, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("mail", POS_STANDING, do_not_here, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("obscure",  POS_STANDING, do_obscure, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("play", POS_SITTING, do_play, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("poison", POS_STANDING, do_poison, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("poisonblade", POS_RESTING, do_poisonblade, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("poisontrap", POS_STANDING, do_poisontrap, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("recite", POS_RESTING, do_recite, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("receive", POS_STANDING, do_not_here, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("remove", POS_STANDING, do_remove, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("score", POS_DEAD, do_score, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("seal",  POS_STANDING, do_seal, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("search",  POS_STANDING, do_search, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("shadowwalk",  POS_STANDING, do_shadowwalk, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("sidestep",  POS_FIGHTING, do_sidestep, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("sleep",  POS_SLEEPING, do_sleep, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("snareset",  POS_STANDING, do_snareset, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("tell",  POS_DEAD, do_tell, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("tumble",  POS_FIGHTING, do_tumble, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("typo", POS_DEAD, do_gen_write, 0, SCMD_TYPO,CMD_NONE, NOGRANTS,0);
  addcommand("unequip", POS_RESTING, do_unequip, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("use", POS_SITTING, do_use, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("wa",     POS_RESTING, do_wa, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("wear",  POS_RESTING, do_wear, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("who",    POS_DEAD, do_who, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("wield", POS_RESTING, do_wield, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("withdraw", POS_STANDING, do_bank, 1, SCMD_WITHDRAW,CMD_NONE, NOGRANTS,0);
  addcommand("wizlist", POS_DEAD, do_gen_ps, 0, SCMD_WIZLIST,CMD_NONE, NOGRANTS,0);


  ////////////////////////////////////////////////////////////////////
  // movement related
  ////////////////////////////////////////////////////////////////////
  addcommand("enter", POS_STANDING, do_enter, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("exits", POS_RESTING, do_exits, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("stand",  POS_RESTING, do_stand, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("sit",    POS_RESTING, do_sit, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("rest",   POS_RESTING, do_rest, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("follow", POS_RESTING, do_follow, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("open", POS_SITTING, do_open, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("close", POS_SITTING, do_close, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("lock", POS_SITTING, do_lock, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("unlock", POS_SITTING, do_unlock, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("leave", POS_STANDING, do_leave, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("sneak", POS_STANDING, do_sneak, 1, 0,CMD_NONE, NOGRANTS,0);


  ////////////////////////////////////////////////////////////////////
  // communication
  ////////////////////////////////////////////////////////////////////
  addcommand("\"", POS_RESTING, do_commune, 0, SCMD_SAYTO,CMD_NONE, NOGRANTS,0);
  addcommand("ask", POS_RESTING, do_commune, 0, SCMD_ASK, CMD_NONE, NOGRANTS,0);
  addcommand("bellow",POS_RESTING, do_gen_com, 0, SCMD_BELLOW, CMD_NONE, NOGRANTS,0);
  addcommand("chat", POS_SLEEPING, do_chat, 1, 0, CMD_NONE, NOGRANTS,0);
  addcommand("csay", POS_SLEEPING, do_clan_say, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("echo",   POS_STANDING, do_echo, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("emote",  POS_RESTING, do_emote, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("newbie", POS_SLEEPING, do_gen_com, 0, SCMD_NEWBIE, CMD_NONE, NOGRANTS,0);
  addcommand("lsay", POS_RESTING, do_lsay, 1, 0,CMD_NONE, NOGRANTS,0) ;
  addcommand("reply", POS_SLEEPING, do_reply, 0,0,CMD_NONE, NOGRANTS,0);
  addcommand("gtell", POS_SLEEPING, do_gsay, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("gsay", POS_SLEEPING, do_gsay, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("order", POS_RESTING, do_order, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("pray",POS_RESTING, do_gen_com, 2, SCMD_PRAYER, CMD_NONE, NOGRANTS,0);
  addcommand("say",   POS_RESTING, do_say, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("sayto", POS_RESTING, do_commune, 0, SCMD_SAYTO, CMD_NONE, NOGRANTS,0);
  addcommand("speak", POS_SLEEPING, do_speak, 1, 0,CMD_NONE, NOGRANTS,0) ;
  addcommand("whisper", POS_RESTING, do_commune, 0, SCMD_WHISPER,CMD_NONE, NOGRANTS,0);
  addcommand("yell", POS_RESTING, do_gen_com, 1, SCMD_YELL, CMD_NONE, NOGRANTS,0);

  if (useglobals)
  {
    addcommand("ooc", POS_SLEEPING, do_gen_com, 1, SCMD_OOC, CMD_NONE, NOGRANTS,0);
    addcommand("noooc", POS_SLEEPING, do_gen_tog, 1, SCMD_NOOOC, CMD_NONE, NOGRANTS,0);

/*  Ok, we don't want these, i guess *boggle* 4/14/98 -jtrhone
    addcommand("question", POS_SLEEPING, do_gen_com, 1, SCMD_QUESTION, CMD_NONE, NOGRANTS,0);
    addcommand("answer", POS_SLEEPING, do_gen_com, 1, SCMD_ANSWER, CMD_NONE, NOGRANTS,0);
    addcommand("noqa", POS_SLEEPING, do_gen_tog, 1, SCMD_NOQA, CMD_NONE, NOGRANTS,0);
*/
  }

  ////////////////////////////////////////////////////////////////////
  // RoAOLC related / Immortal
  ////////////////////////////////////////////////////////////////////
  addcommand("slotupdate", POS_SLEEPING, do_slotupdate, LEV_IMPL, 0,CMD_NONE, NOGRANTS,0);
  addcommand("olist", POS_SLEEPING, do_olist, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);
  addcommand("mlist", POS_SLEEPING, do_mlist, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);
  addcommand("rlist", POS_SLEEPING, do_rlist, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);
  addcommand("redit", POS_DEAD, do_redit, LEV_IMM, 0,CMD_NONE, GRNT_ROOMEDIT, LEV_CIMP);
  addcommand("hedit", POS_SLEEPING, do_hedit, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("oquery", POS_SLEEPING, do_oquery, LEV_AIMP, 0,CMD_NONE, NOGRANTS,0);
  addcommand("map", POS_SLEEPING, do_map, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);;
  addcommand("voidlist", POS_SLEEPING, do_voidlist, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);;
  addcommand("helpedit", POS_RESTING, do_help_edit, LEV_AIMP, 0,CMD_NONE, GRNT_HELPED, LEV_CIMP);
  addcommand("helpdel", POS_RESTING, do_remove_help_entry, LEV_AIMP, 0,CMD_NONE, GRNT_HELPED, LEV_CIMP);
  addcommand("wizcomm", POS_SLEEPING, do_commands, LEV_IMM, SCMD_WIZCOMM,CMD_NONE, NOGRANTS,0);
  addcommand("wizhelp", POS_RESTING, do_wizhelp, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);
  addcommand("wizhelpedit", POS_RESTING, do_wizhelp_edit, LEV_AIMP, 0,CMD_NONE, GRNT_HELPED, LEV_CIMP);
  addcommand("rterrain", POS_RESTING, do_room_terrain, LEV_AIMP, 0,CMD_NONE, NOGRANTS,0);
  addcommand("zterrain", POS_RESTING, do_zone_terrain, LEV_AIMP, 0,CMD_NONE, NOGRANTS,0);
  addcommand("pledit", POS_SLEEPING, do_plshopedit,   LEV_AIMP, 0, CMD_NONE, NOGRANTS,0);
  addcommand("plcreate", POS_SLEEPING, do_plshopcreate, LEV_AIMP, 0, CMD_NONE, NOGRANTS,0);
  addcommand("pldelete", POS_SLEEPING, do_plshopdelete, LEV_AIMP, 0, CMD_NONE, NOGRANTS,0);
  addcommand("plsave", POS_SLEEPING, do_plshopsave,   LEV_AIMP, 0, CMD_NONE, NOGRANTS,0);
  addcommand("pllist", POS_SLEEPING, do_plshoplist,   LEV_GOD, 0, CMD_NONE, NOGRANTS,0);
  addcommand("plstat", POS_SLEEPING, do_plshopstat,   LEV_GOD, 0, CMD_NONE, NOGRANTS,0);
  addcommand("bsave", POS_SLEEPING, do_save_boards,  LEV_AIMP, 0, CMD_NONE, NOGRANTS,0);
  addcommand("blist", POS_SLEEPING, do_blist,  LEV_GOD, 0, CMD_NONE, NOGRANTS,0);
  addcommand("badd", POS_SLEEPING, do_badd,   LEV_IMPL,0, CMD_NONE, NOGRANTS,0);
  addcommand("htlist", POS_SLEEPING, do_htlist, LEV_GOD, 0, CMD_NONE, NOGRANTS,0);
  addcommand("htstat", POS_SLEEPING, do_htstat, LEV_GOD, 0, CMD_NONE, NOGRANTS,0);
  addcommand("htsave", POS_SLEEPING, do_htsave, LEV_AIMP, 0, CMD_NONE, NOGRANTS,0);
  addcommand("htcreate", POS_SLEEPING, do_htcreate, LEV_IMPL, 0, CMD_NONE, NOGRANTS,0);
  addcommand("htedit", POS_SLEEPING, do_htedit, LEV_IMPL, 0, CMD_NONE, NOGRANTS,0);
  addcommand("mprocshow", POS_SLEEPING, do_mobproc_show, LEV_IMM, 0, CMD_NONE, NOGRANTS,0);
  addcommand("rprocshow", POS_SLEEPING, do_roomproc_show, LEV_IMM, 0, CMD_NONE, NOGRANTS,0);
  addcommand("rpcommand", POS_SLEEPING, do_rpcom, LEV_IMM, 0, CMD_NONE, NOGRANTS,0);
  addcommand("load",   POS_DEAD, do_load, LEV_GOD, 0,CMD_NONE, GRNT_LOAD, LEV_CIMP);
  addcommand("stat",   POS_DEAD, do_stat, LEV_IMM, 0,CMD_TRUSTED, NOGRANTS,0);
  addcommand("olc", POS_DEAD, do_olc, LEV_IMM, 0,CMD_NONE, GRNT_OLC, LEV_CIMP);
  addcommand("vnum", POS_DEAD, do_vnum, LEV_IMM, 0,CMD_TRUSTED, GRNT_VNUM, LEV_CIMP);
  addcommand("zreset", POS_DEAD, do_zreset, LEV_CIMP, 0,CMD_NONE, NOGRANTS,0);
  addcommand("roomflags", POS_DEAD, do_gen_tog, LEV_IMM, SCMD_ROOMFLAGS,CMD_NONE, NOGRANTS,0);
  addcommand("vstat", POS_DEAD, do_vstat, LEV_IMM, 0,CMD_TRUSTED, GRNT_VSTAT, LEV_CIMP);
  addcommand("fremove", POS_RESTING, do_low_force, LEV_IMM, SCMD_FREMOVE,CMD_NONE, NOGRANTS,0);
  addcommand("medit", POS_DEAD, do_medit, LEV_IMM, 0,CMD_NONE, GRNT_MOBEDIT, LEV_CIMP);
  addcommand("oedit", POS_DEAD, do_oedit, LEV_IMM, 0,CMD_NONE, GRNT_OBJEDIT, LEV_CIMP);
  addcommand("zlock", POS_SLEEPING, do_zlock, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);
  addcommand("zunlock", POS_SLEEPING, do_zunlock, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);
  addcommand("zlist", POS_SLEEPING, do_zlist, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);
  addcommand("zedit", POS_RESTING, do_zedit, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);
  addcommand("socedit", POS_SLEEPING, do_sedit, LEV_CIMP, 0,CMD_NONE, GRNT_SOCEDIT, LEV_CIMP);
  addcommand("zcreate", POS_SLEEPING, do_zcreate, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);
  addcommand("mobsave", POS_DEAD, do_mobsave, LEV_AIMP, 1,CMD_NONE, GRNT_MOWSAVE,LEV_IMPL);
  addcommand("objsave", POS_DEAD, do_objsave, LEV_AIMP, 1,CMD_NONE, GRNT_MOWSAVE,LEV_IMPL);
  addcommand("wldsave", POS_DEAD, do_wldsave, LEV_AIMP, 1,CMD_NONE, GRNT_MOWSAVE,LEV_IMPL);
  addcommand("zclose", POS_DEAD, do_zclose, LEV_CIMP, 0,CMD_NONE, GRNT_ZOPCLO, LEV_CIMP);
  addcommand("zopen", POS_DEAD, do_zopen, LEV_CIMP, 0,CMD_NONE, GRNT_ZOPCLO, LEV_CIMP);
  addcommand("fget", POS_RESTING, do_low_force, LEV_IMM, SCMD_FGET,CMD_NONE, NOGRANTS,0);
  addcommand("fgrab", POS_RESTING, do_low_force, LEV_IMM, SCMD_FGRAB,CMD_NONE, NOGRANTS,0);
  addcommand("fwear", POS_RESTING, do_low_force, LEV_IMM, SCMD_FWEAR,CMD_NONE, NOGRANTS,0);
  addcommand("fwield", POS_RESTING, do_low_force, LEV_IMM, SCMD_FWIELD,CMD_NONE, NOGRANTS,0);
  addcommand("zimmort", POS_RESTING, do_zimmort, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);
  addcommand("ztest", POS_RESTING, do_ztest, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);
  addcommand("chart", POS_SLEEPING, do_chart, LEV_IMM, 0,CMD_NONE, NOGRANTS,0) ;
  addcommand("adjust", POS_SLEEPING, do_adjust, LEV_IMM, 0,CMD_NONE, NOGRANTS,0) ;
  addcommand("zoneadjust", POS_SLEEPING, do_adjust_zone, LEV_IMM, 0,CMD_NONE, NOGRANTS,0) ;
  addcommand("average", POS_SLEEPING, do_calc_zones, LEV_IMM, 0,CMD_NONE, NOGRANTS,0) ;
  addcommand("helpconv", POS_RESTING, do_help_conversion, LEV_IMPL+1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("wizhelpdel", POS_RESTING, do_remove_wizhelp_entry, LEV_AIMP,0,CMD_NONE, GRNT_HELPED, LEV_CIMP);
  addcommand("socdelete", POS_RESTING, do_socdelete, LEV_CIMP,0,CMD_NONE, GRNT_SOCDEL, LEV_CIMP);
  addcommand("texedit", POS_SLEEPING, do_tedit, LEV_CIMP,0,CMD_NONE, NOGRANTS,0);
  addcommand("waredit", POS_SLEEPING, do_wedit, LEV_IMPL,0,CMD_NONE, GRNT_WAREDIT, LEV_CIMP);
  addcommand("wardelete", POS_SLEEPING, do_wspell_delete, LEV_IMPL,0,CMD_NONE, GRNT_WARDEL, LEV_CIMP);
  addcommand("wldupdate", POS_RESTING, do_wldupdate, LEV_IMPL, 0,CMD_NONE, NOGRANTS,0);
  addcommand("fzone", POS_SLEEPING, do_free_zone, LEV_IMPL, 0,CMD_NONE, NOGRANTS,0);
  addcommand("rbuild", POS_STANDING, do_rbuild, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);
  addcommand("rconnect", POS_STANDING, do_rconnect, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);
  addcommand("exedit", POS_SLEEPING, do_exedit, LEV_IMM, 0,CMD_TRUSTED, NOGRANTS,0);
  addcommand("mfinger", POS_SLEEPING, do_mfinger, 5, 0,CMD_NONE, NOGRANTS,0);
  addcommand("mfingeredit", POS_SLEEPING, do_mfinger_edit, 5, 0,CMD_NONE, NOGRANTS,0);
  addcommand("mfingerdel", POS_SLEEPING, do_mfinger_delete, 5, 0,CMD_NONE, NOGRANTS,0);
  addcommand("hbuild", POS_STANDING, do_hbuild, 10, 0,CMD_NONE, NOGRANTS,0);
  addcommand("comload", POS_RESTING, do_reload_messages, LEV_IMPL, 0,CMD_NONE, NOGRANTS,0);
  addcommand("assemview", POS_RESTING, do_show_assem_table, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);
  addcommand("assemload", POS_RESTING, do_reload_table, LEV_CIMP, 0,CMD_NONE, NOGRANTS,0);
  addcommand("messedit", POS_SLEEPING, do_mess_edit, LEV_IMPL, 0,CMD_NONE, NOGRANTS,0);
  addcommand("messsave", POS_RESTING, do_save_messages, LEV_IMPL, 0,CMD_NONE, NOGRANTS,0);
  addcommand("objchart", POS_SLEEPING, do_object_chart, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);
  addcommand("wiperoom", POS_STANDING, do_wipe_room, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);
  addcommand("qedit", POS_SLEEPING, do_qedit, LEV_GOD, 0,CMD_NONE, NOGRANTS,0);
  addcommand("conceal", POS_SLEEPING, do_conceal, LEV_IMM, 0, CMD_NONE, NOGRANTS,0);
  addcommand("config", POS_SLEEPING, do_config, LEV_IMPL, 0, CMD_NONE, NOGRANTS,0);
  addcommand("convert", POS_RESTING, do_convert, LEV_IMPL,0,CMD_NONE, NOGRANTS,0);
  addcommand("flagtog", POS_SLEEPING, do_flagtog, LEV_AIMP, 0, CMD_NONE, NOGRANTS,0);
  addcommand("shopedit", POS_RESTING , do_mort_plshopedit, 1, 0, CMD_NONE, NOGRANTS,0);
  addcommand("clpidlist", POS_RESTING , do_clpidlist, LEV_IMM, 0, CMD_NONE, NOGRANTS,0);
  addcommand("cliedit", POS_RESTING , do_cliedit, LEV_IMM, 0, CMD_NONE, NOGRANTS,0);
  addcommand("pllink", POS_RESTING , do_relink_plshops, LEV_GOD, 0, CMD_NONE, NOGRANTS,0);
  addcommand("traplevel", POS_SLEEPING, do_traplevel, LEV_IMM, 0, CMD_TRUSTED, NOGRANTS,0);


  ////////////////////////////////////////////////////////////////////
  // Immortal only
  ////////////////////////////////////////////////////////////////////
  addcommand("restartrouter", POS_DEAD, do_restartrouter, LEV_IMPL, 0, CMD_NONE, NOGRANTS, 0);
  addcommand("record", POS_DEAD, do_record, LEV_IMPL, 0, CMD_NONE, NOGRANTS, 0);
  addcommand("playback", POS_DEAD, do_playback, LEV_IMPL, 0, CMD_NONE, NOGRANTS, 0);
  addcommand("at", POS_DEAD, do_at, LEV_IMM, 0,CMD_TRUSTED, GRNT_AT, LEV_CIMP);
  addcommand("force",  POS_SLEEPING, do_force, LEV_GOD, 0,CMD_TRUSTED, NOGRANTS,0);
  addcommand("transfer", POS_SLEEPING, do_trans, LEV_GOD, 0,CMD_TRUSTED, GRNT_TRANS, LEV_CIMP);
  addcommand("goto",   POS_SLEEPING, do_goto, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);
  addcommand("purge",  POS_DEAD, do_purge, LEV_IMM, 0,CMD_NONE, GRNT_PURGE, LEV_CIMP);
  addcommand("shutdown", POS_DEAD, do_shutdown, LEV_IMPL, SCMD_SHUTDOWN, CMD_NONE, GRNT_SHUTDOWN, LEV_IMPL);
  addcommand("snoop", POS_DEAD, do_snoop, LEV_GOD, 0,CMD_TRUSTED, GRNT_SNOOP, LEV_CIMP);
  addcommand("advance", POS_DEAD, do_advance, LEV_IMPL, 0,CMD_NONE, NOGRANTS,0);
  addcommand("restore", POS_DEAD, do_restore, LEV_GOD, 0,CMD_NONE, NOGRANTS,0);
  addcommand("switch", POS_DEAD, do_switch, LEV_CIMP, 0,CMD_TRUSTED, GRNT_SWITCH, LEV_CIMP);
  addcommand("users", POS_DEAD, do_users, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);
  addcommand("poofin", POS_DEAD, do_poofset, LEV_IMM, SCMD_POOFIN,CMD_NONE, NOGRANTS,0);
  addcommand("poofout", POS_DEAD, do_poofset, LEV_IMM, SCMD_POOFOUT,CMD_NONE, NOGRANTS,0);
  addcommand("teleport", POS_DEAD, do_teleport, LEV_AIMP, 0,CMD_TRUSTED, GRNT_TELEPORT, LEV_CIMP);
  addcommand("gecho", POS_DEAD, do_gecho, LEV_CIMP, 0,CMD_NONE, GRNT_GECHO, LEV_CIMP);
  addcommand("wiznet", POS_DEAD, do_wiznet, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);
  addcommand("holylight", POS_DEAD, do_gen_tog, LEV_IMM, SCMD_HOLYLIGHT,CMD_NONE, NOGRANTS,0);
  addcommand("invis", POS_DEAD, do_invis, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);
  addcommand("set", POS_DEAD, do_set, LEV_GOD, 0,CMD_NONE, GRNT_SET, LEV_CIMP);
  addcommand("wizlock", POS_DEAD, do_wizlock, LEV_CIMP, 0,CMD_NONE, NOGRANTS,0);
  addcommand("pardon", POS_DEAD, do_wizutil, LEV_GOD, SCMD_PARDON,CMD_NONE, NOGRANTS,0);
  addcommand(";", POS_DEAD, do_wiznet, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);
  addcommand("freeze", POS_DEAD, do_wizutil, LEV_FREEZE, SCMD_FREEZE,CMD_NONE, GRNT_FREEZE, LEV_CIMP);
  addcommand("dc", POS_DEAD, do_dc, LEV_GOD, 0,CMD_TRUSTED, NOGRANTS,0);
  addcommand("send", POS_SLEEPING, do_send, LEV_GOD, 0,CMD_TRUSTED, NOGRANTS,0);
  addcommand("uptime", POS_DEAD, do_uptime, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);
  addcommand("unban", POS_DEAD, do_unban, LEV_CIMP, 0,CMD_NONE, GRNT_UNBAN, LEV_CIMP);
  addcommand("date", POS_DEAD, do_date, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);
  addcommand("show", POS_DEAD, do_show, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);
  addcommand("handbook", POS_DEAD, do_gen_ps, LEV_IMM, SCMD_HANDBOOK,CMD_NONE, NOGRANTS,0);
  addcommand("nohassle", POS_DEAD, do_gen_tog, LEV_IMM, SCMD_NOHASSLE,CMD_NONE, NOGRANTS,0);
  addcommand("mute", POS_DEAD, do_wizutil, LEV_GOD, SCMD_SQUELCH,CMD_NONE, NOGRANTS,0);
  addcommand("nowiz", POS_DEAD, do_gen_tog, LEV_IMM, SCMD_NOWIZ,CMD_NONE, NOGRANTS,0);
  addcommand("notitle", POS_DEAD, do_wizutil, LEV_GOD, SCMD_NOTITLE,CMD_NONE, NOGRANTS,0);
  addcommand("thaw", POS_DEAD, do_wizutil, LEV_FREEZE, SCMD_THAW,CMD_NONE, GRNT_THAW, LEV_CIMP);
  addcommand("unaffect", POS_DEAD, do_wizutil, LEV_GOD, SCMD_UNAFFECT,CMD_NONE, NOGRANTS,0);
  addcommand("page", POS_DEAD, do_page, LEV_GOD, 0,CMD_NONE, GRNT_PAGE, LEV_IMPL);
  addcommand("reboot", POS_DEAD, do_reboot, LEV_IMPL, 0,CMD_NONE, GRNT_REBOOT, LEV_IMPL);
  addcommand("syslog", POS_DEAD, do_syslog, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);
  addcommand("last", POS_DEAD, do_last, LEV_GOD, 0,CMD_TRUSTED, NOGRANTS,0);
  addcommand("slowns", POS_DEAD, do_gen_tog, LEV_IMPL, SCMD_SLOWNS,CMD_NONE, NOGRANTS,0);
  addcommand("/", POS_DEAD, do_wiznet, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);
  addcommand("mkassassin", POS_SLEEPING, do_wizutil, LEV_GOD, SCMD_ASSASSIN,CMD_NONE, GRNT_ASSASSIN, LEV_CIMP);
  addcommand("grant", POS_DEAD, do_grant, LEV_CIMP, 0,CMD_NONE, NOGRANTS,0);
  addcommand("identd", POS_RESTING, do_identify, LEV_CIMP, 0,CMD_NONE, NOGRANTS,0);
  addcommand("accept", POS_SLEEPING, do_accept, LEV_IMPL, 0,CMD_NONE, NOGRANTS,0);
  addcommand("reimburse", POS_SLEEPING, do_reimb, LEV_GOD, 0,CMD_TRUSTED, NOGRANTS,0);
  addcommand("fdrop", POS_RESTING, do_low_force, LEV_IMM, SCMD_FDROP,CMD_NONE, NOGRANTS,0);
  addcommand("format", POS_SLEEPING, do_format	, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);
  addcommand("delword", POS_SLEEPING, do_delword, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);
  addcommand("insword", POS_SLEEPING, do_insword, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);
  addcommand("view", POS_SLEEPING, do_view	, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);
  addcommand("checksnoop", POS_SLEEPING, do_checksnoop, LEV_GOD, 0,CMD_NONE, NOGRANTS,0);
  addcommand("snooptell", POS_SLEEPING, do_snooptell, LEV_CIMP, 0,CMD_NONE, NOGRANTS,0);
  addcommand("loadset", POS_SLEEPING, do_loadset, LEV_IMM,0,CMD_TRUSTED, NOGRANTS,0);
  addcommand("zarena", POS_RESTING, do_zarena, LEV_IMM, 0,CMD_TRUSTED, NOGRANTS,0);
  addcommand("arena", POS_SLEEPING, do_wizutil,LEV_GOD, SCMD_ARENA,CMD_NONE, NOGRANTS,0);
  addcommand("idle", POS_SLEEPING, do_idle_zone, LEV_IMM, 0,CMD_NONE, NOGRANTS,0) ;
  addcommand("hcontrol", POS_SLEEPING, do_hcontrol, LEV_GOD, 0,CMD_NONE, NOGRANTS,0);
  addcommand("wizhelpconv", POS_RESTING, do_wizhelp_conversion, LEV_IMPL+1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("refresh", POS_RESTING, do_refresh, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);
  addcommand("award", POS_SLEEPING, do_award, LEV_IMPL, 0,CMD_NONE, GRNT_AWARD, LEV_CIMP);
  addcommand("logall", POS_SLEEPING, do_logall, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);
  addcommand("warp", POS_SLEEPING, do_timeshift, LEV_IMPL, 0,CMD_NONE, NOGRANTS,0);
  addcommand("exec", POS_SLEEPING, do_exec, LEV_IMPL, 0,CMD_NONE, NOGRANTS,0);
  addcommand("prename", POS_SLEEPING, do_prename, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);
  addcommand("noemote", POS_DEAD, do_wizutil, LEV_GOD, SCMD_NOEMOTE,CMD_NONE, NOGRANTS,0);
  addcommand("strscan", POS_RESTING, do_pfile_scan, LEV_IMPL, 0,CMD_NONE, NOGRANTS,0);
  addcommand("imotd", POS_SLEEPING, do_gen_ps, LEV_IMM, SCMD_IMOTD,CMD_NONE, NOGRANTS,0);
  addcommand("rsnoop", POS_SLEEPING, do_rsnoop, LEV_IMPL, 0, CMD_NONE, NOGRANTS, 0);
  addcommand("match", POS_DEAD,     do_match, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);
  addcommand("soundsend", POS_DEAD,     do_soundsend, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);
  addcommand("bankset", POS_STANDING, do_bankset, LEV_AIMP, 0,CMD_NONE, NOGRANTS,0);
  addcommand("qcomplete", POS_SLEEPING, do_qcomplete, LEV_AIMP, 0,CMD_NONE, NOGRANTS,0);
  addcommand("minlevfix", POS_SLEEPING, do_minlevelfix, LEV_IMPL, 0, CMD_NONE, NOGRANTS,0);
  addcommand("topshops", POS_SLEEPING, do_topshops, LEV_IMM, 0, CMD_NONE, NOGRANTS,0);
  addcommand("soundlist", POS_RESTING , do_soundlist, LEV_IMM, 0, CMD_NONE, NOGRANTS,0);
  addcommand("piclist", POS_RESTING , do_piclist, LEV_IMM, 0, CMD_NONE, NOGRANTS,0);
  addcommand("csend", POS_RESTING , do_csend, LEV_AIMP, 0, CMD_NONE, NOGRANTS,0);
  addcommand("reveal", POS_SLEEPING, do_reveal, LEV_IMM, 0, CMD_NONE, NOGRANTS,0);
  addcommand("home", POS_RESTING, do_home, LEV_IMM, 0, CMD_NONE, NOGRANTS,0);
  addcommand("goldfix", POS_SLEEPING, do_goldfix, LEV_IMPL, 0, CMD_NONE, NOGRANTS, 0);


  ////////////////////////////////////////////////////////////////////
  // Miscellaneous (unsorted)
  ////////////////////////////////////////////////////////////////////
  addcommand("insult", POS_RESTING, do_insult, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("news",   POS_SLEEPING, do_gen_ps, 0, SCMD_NEWS,CMD_NONE, NOGRANTS,0);
  addcommand("buy",    POS_STANDING, do_buy, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("sell",   POS_STANDING, do_sell, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("value",  POS_STANDING, do_value, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("list",   POS_STANDING, do_list, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("drop",   POS_RESTING, do_drop, 0, SCMD_DROP,CMD_NONE, NOGRANTS,0);
  addcommand("weather", POS_RESTING, do_weather, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("read",   POS_RESTING, do_read, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("pour",   POS_STANDING, do_pour, 0, SCMD_POUR,CMD_NONE, NOGRANTS,0);
  addcommand("grab",   POS_RESTING, do_grab, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("erase", POS_RESTING, do_erase, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("put",    POS_RESTING, do_put, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("save",    POS_SLEEPING, do_save, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("hit",    POS_FIGHTING, do_hit, 0, SCMD_HIT,CMD_NONE, NOGRANTS,0);
  addcommand("give",   POS_RESTING, do_give, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("quit",   POS_DEAD, do_quit, 0, SCMD_QUIT,CMD_NONE, NOGRANTS,0);
  addcommand("time",   POS_DEAD, do_time, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("sip", POS_RESTING, do_drink, 0, SCMD_SIP,CMD_NONE, NOGRANTS,0);
  addcommand("taste", POS_RESTING, do_eat, 0, SCMD_TASTE,CMD_NONE, NOGRANTS,0);
  addcommand("sing", POS_RESTING, do_sing, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("songlist", POS_SLEEPING, do_songlist, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("write", POS_STANDING, do_write, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("hold", POS_RESTING, do_grab, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("hide", POS_RESTING, do_hide, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("backstab", POS_STANDING, do_backstab, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("pick", POS_STANDING, do_pick, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("steal", POS_STANDING, do_steal, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("bash", POS_FIGHTING, do_bash, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("rescue", POS_FIGHTING, do_rescue, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("kick", POS_FIGHTING, do_kick, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("practise", POS_RESTING, do_practice, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("practice", POS_RESTING, do_practice, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("study", POS_RESTING, do_study, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("examine", POS_SITTING, do_examine, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("take", POS_RESTING, do_get, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("info", POS_SLEEPING, do_gen_ps, 0, SCMD_INFO,CMD_NONE, NOGRANTS,0);
  addcommand("'", POS_RESTING, do_say, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("where", POS_DEAD, do_where, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("levels", POS_DEAD, do_levels, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("reroll", POS_RESTING, do_wizutil, 1, SCMD_REROLL,CMD_NONE, NOGRANTS,0);
  addcommand(":", POS_RESTING, do_emote, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("brief", POS_DEAD, do_gen_tog, 0, SCMD_BRIEF,CMD_NONE, NOGRANTS,0);
  addcommand("group", POS_SLEEPING, do_group, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("return", POS_DEAD, do_return, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("quaff", POS_RESTING, do_quaff, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("immlist", POS_DEAD, do_gen_ps, 0, SCMD_IMMLIST,CMD_NONE, NOGRANTS,0);
  addcommand("deaf", POS_SLEEPING, do_gen_tog, 1, SCMD_DEAF,CMD_NONE, NOGRANTS,0);
  addcommand("credits", POS_DEAD, do_gen_ps, 0, SCMD_CREDITS,CMD_NONE, NOGRANTS,0);
  addcommand("compact", POS_DEAD, do_gen_tog, 0, SCMD_COMPACT,CMD_NONE, NOGRANTS,0);
  addcommand("wimpy", POS_DEAD, do_wimpy, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("ungroup", POS_DEAD, do_ungroup, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("notell", POS_DEAD, do_gen_tog, 1, SCMD_NOTELL,CMD_NONE, NOGRANTS,0);
  addcommand("junk", POS_RESTING, do_drop, 0, SCMD_JUNK,CMD_NONE, NOGRANTS,0);
  addcommand("murder", POS_FIGHTING, do_hit, 0, SCMD_MURDER,CMD_NONE, NOGRANTS,0);
  addcommand("title", POS_DEAD, do_title, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("visible", POS_RESTING, do_visible, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("nosummon", POS_DEAD, do_gen_tog, 1, SCMD_NOSUMMON,CMD_NONE, NOGRANTS,0);
  addcommand("split", POS_SITTING, do_split, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("norepeat", POS_DEAD, do_gen_tog, 0, SCMD_NOREPEAT,CMD_NONE, NOGRANTS,0);
  addcommand("toggle", POS_DEAD, do_toggle, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("fill", POS_STANDING, do_pour, 0, SCMD_FILL,CMD_NONE, NOGRANTS,0);
  addcommand("commands", POS_DEAD, do_commands, 0, SCMD_COMMANDS,CMD_NONE, NOGRANTS,0);
  addcommand("socials", POS_DEAD, do_commands, 0, SCMD_SOCIALS,CMD_NONE, NOGRANTS,0);
  addcommand("color", POS_DEAD, do_color, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("prompt", POS_DEAD, do_prompt, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("policy", POS_DEAD, do_gen_ps, 0, SCMD_POLICIES,CMD_NONE, NOGRANTS,0);
  addcommand("noauction", POS_DEAD, do_gen_tog, 0, SCMD_NOAUCTION,CMD_NONE, NOGRANTS,0);
  addcommand("cls", POS_DEAD, do_gen_ps, 0, SCMD_CLEAR,CMD_NONE, NOGRANTS,0);
  addcommand("clear", POS_DEAD, do_gen_ps, 0, SCMD_CLEAR,CMD_NONE, NOGRANTS,0);
  addcommand("version", POS_DEAD, do_gen_ps, 0, SCMD_VERSION,CMD_NONE, NOGRANTS,0);
  addcommand("auction", POS_SLEEPING, do_auction, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("donate", POS_RESTING, do_drop, 0, SCMD_DONATE,CMD_NONE, NOGRANTS,0);
  addcommand("report", POS_SLEEPING, do_report, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("diagnose", POS_RESTING, do_diagnose, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("track", POS_STANDING, do_track, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("whoami", POS_DEAD, do_gen_ps, 0, SCMD_WHOAMI,CMD_NONE, NOGRANTS,0);
  addcommand("autoexits", POS_DEAD, do_gen_tog, 0, SCMD_AUTOX,CMD_NONE, NOGRANTS,0);
  addcommand("incognito", POS_DEAD, do_gen_tog, 0, SCMD_INCOGNITO,CMD_NONE, NOGRANTS,0);
  addcommand("scan", POS_STANDING, do_scan, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("skills", POS_SLEEPING, do_show_skills, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("mortlog", POS_DEAD, do_gen_tog, 0, SCMD_MORTLOG,CMD_NONE, NOGRANTS,0);
  addcommand("motd", POS_SLEEPING, do_gen_ps, 0, SCMD_MOTD,CMD_NONE, NOGRANTS,0);
  addcommand("request", POS_SLEEPING, do_gen_tog, 3, SCMD_REQASS,CMD_NONE, NOGRANTS,0);
  addcommand("races", POS_SLEEPING, do_gen_ps, 0, SCMD_RACES,CMD_NONE, NOGRANTS,0);
  addcommand("float", POS_SITTING, do_float, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("settle", POS_SLEEPING, do_settle, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("walkin", POS_DEAD, do_walkset, 1, SCMD_WALKIN,CMD_NONE, NOGRANTS,0);
  addcommand("walkout", POS_DEAD, do_walkset, 1, SCMD_WALKOUT,CMD_NONE, NOGRANTS,0);
  addcommand("munch", POS_STANDING, do_munch, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("clan", POS_RESTING, do_clan, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("clanname", POS_RESTING, do_clan_name, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("clanjoin", POS_RESTING, do_clan_join, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("clandismiss", POS_RESTING, do_clan_dis, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("clanwho", POS_SLEEPING, do_clan_who, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("autogold", POS_SLEEPING, do_autogold, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("autoloot", POS_SLEEPING, do_autoloot, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("autosplit", POS_SLEEPING, do_autosplit, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("stuntouch", POS_FIGHTING, do_stuntouch, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("mount", POS_STANDING, do_mount, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("dismount", POS_STANDING, do_dismount, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("mforce", POS_FIGHTING, do_mforce, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("hurl", POS_FIGHTING, do_hurl, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("shortx", POS_DEAD, do_gen_tog, 0, SCMD_SHORTX,CMD_NONE, NOGRANTS,0);
  addcommand("armor", POS_SLEEPING, do_armor, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("disarm", POS_FIGHTING, do_disarm, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("flight", POS_RESTING, do_dragon_flight, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("perform", POS_FIGHTING, do_init_rite, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("firstaid", POS_RESTING, do_first_aid, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("arjoin", POS_SLEEPING, do_arjoin, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("vt100", POS_RESTING, do_vt100, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("vtmap", POS_SLEEPING, do_vtmap, LEV_IMM, 0,CMD_NONE, NOGRANTS,0);
  addcommand("asay", POS_SLEEPING, do_asay, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("line", POS_SLEEPING, do_line, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("grapple", POS_FIGHTING, do_grapple, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("circle", POS_FIGHTING, do_circle, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("repair", POS_STANDING, do_repair, 1, 0,CMD_NONE, NOGRANTS,0) ;
  addcommand("cost", POS_STANDING, do_cost, 1, 0,CMD_NONE, NOGRANTS,0) ;
  addcommand("zones", POS_SLEEPING, do_zonehelp, 1, 0,CMD_NONE, NOGRANTS,0) ;
  addcommand("areas", POS_SLEEPING, do_zonehelp, 1, 0,CMD_NONE, NOGRANTS,0) ;
  addcommand("gate", POS_STANDING, do_enter_gate, 1, 0,CMD_NONE, NOGRANTS,0) ;
  addcommand("portal", POS_STANDING, do_enter_gate, 1, 0,CMD_NONE, NOGRANTS,0) ;
  addcommand("house", POS_SLEEPING, do_house, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("forage", POS_STANDING, do_forage, 1, 0,CMD_NONE, NOGRANTS,0);;
  addcommand("filet", POS_STANDING, do_filet, 1, 0,CMD_NONE, NOGRANTS,0);;
  addcommand("skin", POS_STANDING, do_skin, 1, 0,CMD_NONE, NOGRANTS,0);;
  addcommand("divine", POS_STANDING, do_divine, 1, 0,CMD_NONE, NOGRANTS,0);;
  addcommand("silentwalk", POS_STANDING, do_silentwalk, 1, 0,CMD_NONE, NOGRANTS,0);;
  addcommand("befriend", POS_STANDING, do_befriend, 1, 0,CMD_NONE, NOGRANTS,0);;
  addcommand("whirlwind", POS_FIGHTING, do_whirlwind, 1, 0,CMD_NONE, NOGRANTS,0);;
  addcommand("camouflage", POS_STANDING, do_camouflage, 1, 0,CMD_NONE, NOGRANTS,0);;
  addcommand("healwounds", POS_STANDING, do_heal_wounds, 1, 0,CMD_NONE, NOGRANTS,0);;
  addcommand("sweep", POS_FIGHTING, do_sweep, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("craft", POS_SITTING, do_craft, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("finish", POS_RESTING, do_finish, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("bid", POS_RESTING, do_bid	, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("arwho", POS_SLEEPING, do_arwho, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("redirect", POS_FIGHTING, do_redirect, 1,0,CMD_NONE, NOGRANTS,0);
  addcommand("tag", POS_RESTING, do_tag, 1,0,CMD_NONE, NOGRANTS,0);
  addcommand("legend", POS_SLEEPING, do_legend, LEV_IMM-1,0,CMD_NONE, NOGRANTS,0);
  addcommand("wcast", POS_FIGHTING, do_wcast, 1,0,CMD_NONE, NOGRANTS,0);
  addcommand("icount", POS_SLEEPING, do_icount, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("wpractice", POS_STANDING, do_wpractice, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("bars", POS_SLEEPING, do_bars, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("aura", POS_STANDING, do_aura, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("sense", POS_RESTING, do_sense, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("rabbit", POS_FIGHTING, do_roll, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("snarl", POS_FIGHTING, do_snarl, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("razor", POS_FIGHTING, do_razor, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("levitate", POS_STANDING, do_levitate, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("om", POS_RESTING, do_om, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("mok", POS_RESTING, do_mok, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("iron", POS_FIGHTING, do_iron, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("leap", POS_STANDING, do_leap, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("fox", POS_STANDING, do_flip, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("turtle", POS_STANDING, do_turtle, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("wake", POS_SLEEPING, do_wake, 0, 0,CMD_NONE, NOGRANTS,0);
  addcommand("trance", POS_RESTING, do_trance, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("stone", POS_FIGHTING, do_stone, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("fist", POS_FIGHTING, do_fist, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("hasten", POS_FIGHTING, do_hasten, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("cleanse", POS_RESTING, do_cleanse, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("ironhand", POS_RESTING, do_ironhand, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("fortify", POS_RESTING, do_fortify, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("mcast", POS_RESTING, do_mcast, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("vtsize", POS_SLEEPING, do_vtsize, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("infochannel", POS_SLEEPING, do_infochannel, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("bidid", POS_SLEEPING, do_bidid, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("nogive", POS_SLEEPING, do_nogive, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("throw", POS_STANDING, do_throw, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("noarena", POS_SLEEPING, do_arena_flag, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("pagelength", POS_SLEEPING, do_page_length, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("nochannel", POS_SLEEPING, do_nochannel, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("allchannel", POS_SLEEPING, do_allchannel, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("wildcall", POS_STANDING, do_call_wildlife, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("meldspirit", POS_STANDING, do_become, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("presence", POS_SLEEPING, do_presence, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("remort", POS_STANDING, do_remort, 70, 0,CMD_NONE, NOGRANTS,0);
  addcommand("trek", POS_RESTING,  do_trek, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("clanassist", POS_RESTING,  do_clan_ass, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("qbegin", POS_RESTING,  do_qbegin, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("qend", POS_RESTING,  do_qend, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("qlist", POS_SLEEPING, do_qlist, 1, 0,CMD_NONE, NOGRANTS,0);
  addcommand("qdescribe", POS_SLEEPING, do_qdescribe, 1, 0, CMD_NONE, NOGRANTS,0);
  addcommand("qscore", POS_SLEEPING, do_qscore, 1, 0, CMD_NONE, NOGRANTS,0);
  addcommand("cripple", POS_FIGHTING, do_cripple, 1, 0, CMD_NONE, NOGRANTS,0);
  addcommand("findcorpse", POS_RESTING,  do_findcorpse, 1, 0, CMD_NONE, NOGRANTS,0);
  addcommand("recall", POS_RESTING,  do_recall, 1, 0, CMD_NONE, NOGRANTS,0);
  addcommand("subdue", POS_FIGHTING, do_subdue, 1, 0, CMD_NONE, NOGRANTS,0);
  addcommand("notrack", POS_STANDING, do_notrack, 1, 0, CMD_NONE, NOGRANTS,0);
  addcommand("madept", POS_SLEEPING, do_madept, 1, 0, CMD_NONE, NOGRANTS,0);
  addcommand("shopdeposit", POS_STANDING, do_shopdeposit, 1, 0, CMD_NONE, NOGRANTS,0);
  addcommand("shopwithdraw", POS_STANDING, do_shopwithdraw, 1, 0, CMD_NONE, NOGRANTS,0);
  addcommand("shopstats", POS_STANDING, do_shopstats, 1, 0, CMD_NONE, NOGRANTS,0);
  addcommand("shopopen", POS_STANDING, do_shopopen, 1, 0, CMD_NONE, NOGRANTS,0);
  addcommand("shopclose", POS_STANDING, do_shopclose, 1, 0, CMD_NONE, NOGRANTS,0);
  addcommand("shopgive", POS_STANDING, do_shopgive, 1, 0, CMD_NONE, NOGRANTS,0);
  addcommand("shoptake", POS_STANDING, do_shoptake, 1, 0, CMD_NONE, NOGRANTS,0);
  addcommand("train", POS_STANDING, do_train, 1, 0, CMD_NONE, NOGRANTS,0);
  addcommand("ignore", POS_SLEEPING, do_ignore, 1, 0, CMD_NONE, NOGRANTS,0);
  addcommand("listid", POS_STANDING, do_listid, 1, 0, CMD_NONE, NOGRANTS,0);
  addcommand("torch", POS_STANDING, do_create_torch, 1, 0, CMD_NONE, NOGRANTS,0);
  addcommand("trailblaze", POS_STANDING, do_trailblaze, 1, 0, CMD_NONE, NOGRANTS,0);
  addcommand("meditate", POS_RESTING, do_meditate, 1, 0, CMD_NONE, NOGRANTS,0);
}

// actual command interpreter, called if char is in game
// and not at preliminary menus
void	command_interpreter(chdata *ch, char *argument)
{
   int	look_at, cmd, begin;
   char arg_back[MAX_INPUT_LENGTH];
   extern BOOL find_roa_social(char *comm);
   extern void perform_roa_social(chdata *ch, char *comm);
   int get_command(char *comm);

   if (!*argument) return;

   if (IN_NOWHERE(ch))
   {
     sprintf(buf, "SYSERR: NOWHERE executing command,(%s).",GET_NAME(ch));
     mudlog(buf, BRF, LEV_IMM, TRUE);
     return;
   }

   if (PLR_FLAGGED(ch, PLR_FROZEN) && GET_LEVEL(ch) < LEV_IMPL) {
      send_to_char("Mind-numbing cold prevents you from doing anything.\n\r", ch);
      return;
   }

   if (IS_PC(ch) && CHAR_FLAGGED(ch, CH_CHAT))
   {
     do_chatline(ch, argument, 0, 0);
     return;
   }

   // stay hidden if singing particular song
   // also, stay hidden if affected by shadowwalk  4/21/98 -jtrhone
   if ((IS_PC(ch) && (SINGING(ch) != 13) && (PLAYING(ch) != 13) &&
        !affected_by_spell(ch, SKILL_SHADOWWALK)) || IS_NPC(ch))
     REMOVE_BIT(AFF_FLAGS(ch), AFF_HIDE);

   if (IS_AFK(ch))
   {
     REMOVE_BIT(PLR_FLAGS(ch), PLR_AFK);
     send_to_char("You are no longer %BAFK%0.\n\r",ch);
   }

   // if they are not fighting, remove whirlwind to be safe
   // 1/19/98  -jtrhone
   if (IS_PC(ch) && !FIGHTING(ch))
     ch->pc_specials->whirlwind = 0;

   /* Find first non blank */
   for (begin = 0 ; (*(argument + begin) == ' ' ) ; begin++)  
      ;
      
   // do some special cases... (emote, say, etc) -roa
   switch (*(argument + begin)) {
    case ':':
      cmd = get_command("emote"); 	// the emote command
      look_at = 1;
      break;

    case '\'':
      cmd = get_command("say"); 	// the say command
      look_at = 1;
      break;

    case '/':
    case ';':
      cmd = get_command("/"); 	// wiznet command
      look_at = 1;
      break;
    case '\"':		
      cmd = get_command("\"");		// sayto command 05/02/98 -callahan
      look_at = 1;
      break;

    default: 
      for (look_at = 0; *(argument + begin + look_at ) > ' ' ; look_at++)
         *(argument + begin + look_at) = LOWER(*(argument + begin + look_at));

      cmd = get_command(argument+begin);
      break;
   }

   if (!cmd)
      return;
  
   if ((cmd > 0) && (GET_LEVEL(ch) < cmd_info[cmd].minimum_level) && !GRNT_FLAGGED(ch, CMD_GFLAGS(cmd)))
   {
      send_to_char("Huh?!?\n\r", ch);
      return;
   }

   if (cmd > 0 && CMD_FLAGGED(cmd, CMD_TRUSTED) && GET_LEVEL(ch) == LEV_IMM &&
       !PLR_FLAGGED(ch, PLR_TRUSTED))
   {
      send_to_char("You must be trusted to use this command.\n\r",ch);
      return;
   }

   // record/playback support 6/98 -jtrhone
   if (!CMD_IS(cmd, "record") && !CMD_IS(cmd, "playback") && ch->fp && CHAR_FLAGGED(ch, CH_RECORD))
     fprintf(ch->fp, "%s\n", argument);

   if (strlen(argument) < MAX_INPUT_LENGTH -1)
     strcpy (arg_back, argument);

   if (cmd > 0 && cmd_info[cmd].cmd_ptr) 
   {
      if (GET_POS(ch) < cmd_info[cmd].minimum_position)
	send_wrong_pos_mesg(ch);
      else 
      {
	if (special(ch, cmd, argument + begin + look_at))
	  return;

        // actually call the ACMD()
	((*cmd_info[cmd].cmd_ptr) (ch, argument + begin + look_at, cmd, cmd_info[cmd].subcmd));

        if (IS_PC(ch))
          check_reaction(ch, arg_back);

        // all chars can check rtrigs  6/6/98 -jtrhone
        check_rtrigs(ch, arg_back);
      }
      return;
   }

   if (cmd > 0 && !cmd_info[cmd].cmd_ptr)
      send_to_char("Sorry, but that command has yet to be implemented...\n\r", ch);
   else
   if (find_roa_social(arg_back))
   {
     perform_roa_social(ch, arg_back);
     if (IS_PC(ch))
       check_reaction(ch, arg_back);

     // all chars can check rtrigs  6/6/98 -jtrhone
     check_rtrigs(ch, arg_back);
     return;
   }
   else
   if ((IS_PC(ch) && !check_reaction(ch, arg_back)) && !check_rtrigs(ch, arg_back))
      send_to_char("Huh?!?\n\r", ch);
}