Help Index Command [by Angus Mezick]
Snippet Posted Wednesday, August 12th @ 11:28:20 PM, by George Greer in the Utils dept.
Added Jul 6, 1998. Click the link below to read it or download it.

From: Angus Mezick <angus@EDGIL.CCMAIL.COMPUSERVE.COM>
Subject: As earlier promised, the index command:

This is a great way to do an inventory on your help system.  I would also
suggest adding a little code to do_help that logs what someone tried to
get help on when they don't succeed in getting anything.

1) I am leaving the interpreter.c stuff up to you
2) Stick this into act.informative.c near do_help
3) just give me a little credit.
* Warning: this uses George's buffer patch. if you don't have it, *
* get rid of the lines with &'s *

ACMD(do_index)
{
   int i;
   int row=0;
   int minlen;
&  char *buf;

   if(!ch->desc)
      return;

   skip_spaces(&argument);

   if(!*argument)
      {
      send_to_char("USAGE: index <letter|phrase>\r\n",ch);
      return;
      }

   minlen=strlen(argument);
&  buf=get_buffer(8192);

   for(i=0;i<top_of_helpt;i++)
      {
      if(!strn_cmp(argument,help_table[i].keyword,minlen))
    {
    row++;
    sprintf(buf+strlen(buf),"|%-23.23s |",help_table[i].keyword);
    if((row%3)==0)
       strcat(buf,"\r\n");
    }

      }
   if(ch->desc)
      page_string(ch->desc,buf,1);
&  release_buffer(buf);
}

stick this into do_help: (yup, use the logf patch)
 if (bot > top)
    {
    send_to_char("There is no help on that word.\r\n", ch);
++  log("HELP: %s Could not find help on %s",GET_NAME(ch),argument);
    return;
    }


--Angus


<< Help entry levels [by DOOMer] | Reply | View as text | Threaded | Help Topic Missing! [by Samedi] >>

 


Related Links
  download
Related Articles
More by greerga
 
 

CircleMUD Snippets
 
Note: Not all of these snippets will work perfectly with your version of code, so be prepared to fix one or two bugs that may arise, and please let me know what you needed to do to fix it. Sending a corrected version is always welcome.
Finally, if you wish to use any of the snippets from this page, you are more than welcome, just mention the authors in your credits. If you wish to release any of these snippets to the public on another site, contact me FIRST.