________ ___ ___ ___ _________ _________ _________ _________ / _____/ / / / / / | /__ ___/ /__ ___/ / ______/ / ___ / / /____ / /__/ / / . | / / / / / /__ / /__/ / /____ / / ___ / / /| | / / / / / ___/ / ___ / _____/ / / / / / / -- | / / MUD / / / /_____ / / | | /_______/ /__/ /__/ /__/ |__| /__/ /__/ /________/ /__/ |__| coming soon Code Master: Robert J. Masten III aka: Diablo / Jeror / Paddle This is (I think) new and better approach to using abbreviated mob names. It allows for matches through out the mob's aliases, not just the first letters of one of the mob's aliases. Example: If a mob is named: mobnamedreallytolongtobeginwith 'look mob' works... but so does 'look nam', 'look olon', 'look with', etc. My code was written for CircleMUD, version 3.00 beta patchlevel 17, but should work on other versions as well. It's a little messy (just started coding again) so if you can clean it up, please do so and let me know where and how. First you need to add Jvrgen's snippet (see credits at bottom of the page): --------------------------- IN hander.c add: #define WHITESPACE " \t" AND replace isname with: 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_apart(str, curtok)) /* was if(curtok && is_abbrev(str, curtok)) in Jvrgen's code */ free(newlist); return 1; } free(newlist); return 0; } ------------------------------------------------ Now my code: What you need to add and where: --------------------------- IN interpreter.h add: int is_apart(const char *arg1, const char *arg2); below: int is_abbrev(const char *arg1, const char *arg2); --------------------------- IN interpreter.c add: /* Is ARG1 anywhere in ARG2 */ int is_apart(const char *arg1, const char *arg2) { int matchnum = 0; /* how many letters have we matched */ if (!*arg1 || !*arg2) return (0); while (*arg1 && *arg2) { if (LOWER(*arg1) != LOWER(*arg2)) { if (matchnum == 0) arg2++; else { while (matchnum > 0) { /* need to backup and try again */ if (matchnum != 1) arg2--; arg1--; matchnum--; } } } else { matchnum++; arg1++; arg2++; } } if (!*arg1 && !*arg2) return (1); else { if (!*arg2) return (0); else return (1); } } This snippet is orginal code by me, added to the mob abbreviation snippet by Jvrgen Zigge Sigvardsson and loosely based on the orginal is_abbrev code. If used, please credit Diablo from ShatterMud, Jvrgen didn't include credit preference with his snippet so I guess credit him too if you want. I will be happy to answer any questions regarding MY and only MY code. Diablo Diablo@DeathWalker.net