Re: [CODE] Globally Handle Abbreviations

From: Francis Hotchkiss (fhotch@buffnet.net)
Date: 02/11/99


> From: Nephanor of the Fraal <nephanor@usa.net>
>
> That's what I was looking for, the original one on Alex's site.  However,
> it doesn't seem to be there at this moment.  If you could point me to it,
> or at least tell me what to change it to, I would be most appreciative.
Here it is.  Sorry it took so long, I missed your first post, and this was
on one of my backups, and i didn't know which one.  Anyways here it is.

-Astaroth


From: Jvrgen Zigge Sigvardsson <di4sig@cse.hks.se>
Subject: Abbreviations for objects, mobs and players.

If anyone is interested here is a piece of code that will allow
everything to be abbreviated. Instead of typing 'kill
mobwithaverylongandcomplicatedname' you could type 'kill mob'.
It is VERY appreciated by players.

In 'handler.c', change isname() to this:

#define WHITESPACE " \t"

int isname(char *str, char *namelist)
{
  char *newlist;
  char *curtok;

  newlist = strdup(namelist); /* make a copy since strtok 'modifies'
strings */

  for(curtok = strtok(newlist, WHITESPACE); curtok; curtok = strtok(NULL,
                WHITESPACE))
     if(curtok && is_abbrev(str, curtok))
     {
        free(newlist);
        return 1;
     }
  free(newlist);
  return 0;
}

This will check for an abbreviation on every word in the namelist.


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST