CODE: Abbreviations

From: Mike Levine UK(UTC 00:00) (
Date: 01/10/97

 Mike Levine                                               
 January 10, 1997 (UK)                                                          

 PURPOSE: Allows the use of abbreviations for all PC, NPC names.                
 Original code from Jurgen Zigge Sigvardsson (               

 This update is more compact and works first time on Circle 3.0                 
 patch 11.                                                                      

 Instead of typing 'kill mobwithaverylongandcomplicatedname' you                
 can type 'kill mob' instead. It is VERY appreciated by players.                

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

 As an alternative - a call to the function 'strsep' could be used              
 in place of 'strtok' as it is more dynamic and has no bugs. Yet                
 for portability reasons use strtok.                                            

 Replace isname() in handler.c around line 57 with the following.               

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

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

  for(curtok = strtok(newlist, " \t"); curtok; (curtok = strtok(NULL," \t")))   
     if(curtok && is_abbrev(str, curtok))                                       
        return 1;                                                               
  return 0;                                                                     

Mike Levine - Information Technology - Europe & South America                   
DIALNET: 734-2682  FAX: 734-2681  EMAIL:                   

| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   |

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