Hi... I used a " snippet " to abbreviate the mobs names, players, objects, etc... I followed the intrucoes and I recompiled. During the compilation it appeared the message: handler.c: In function `isname': handler.c:87: warning: implicit declaration of function `single_isname' However, I ignored this mistake and I went to check the result of the alteration, everything works well, less when you try to order a " tell " for a player, if you are not immortal you will have to type the whole name of the player to speak with him. The whole rest of the abbreviations for the mortals works well, less the players' name in the " tell ". For the immortal, it was everything perfect. If somebody knows how to correct this, all the help are welcome. Thank you circle30bp17RS-win98 compiler: cygwin os: win98 - snippet: ###### Improved isname() function and abbrevs support for CircleMUD 3.0 ###### Created: Aug 05, 2000 Last update: Aug 05, 2000 Version: 1.00 Codebase: CircleMUD 3.0 bpl 17 Author: Juliano Ravasi Ferraz <jferraz@linkway.com.br> You don't need to give me credits if you use this snippet, but I will be much happy on having some bytes of your credits file. :-) Send questions or bug reports to <jferraz@linkway.com.br>. Send flames to /dev/null. ############################################################################## /*** * File: config.c * Place: after nameserver_is_slow ***/ /* * Many players appreciates typing only the beginning of the name of things * (mobs, objects, players, descriptions, etc) on the MUD to referencing them. * * If you want this feature enabled on your MUD, set the variable below to YES, * and your players will be able to type commands like "kill cre" in the place * of "kill creppy". If you don't want this feature, leave this variable set to * NO. * * BE AWARE that a lot of mistakes can be caused by setting this to YES. Lazy * people typing only one or two letters of a mob name can, e.g., cast a spell * on another player in the same room. */ int use_abbrevs = YES; /*** * File: handler.c * Place: on external vars section, after MENU ***/ extern int use_abbrevs; /*** * File: handler.c * Place: before the original isname() function ***/ /* * Improved CircleMUD isname() function. * written by Juliano Ravasi Ferraz <jferraz@linkway.com.br>. * * This will allow players to type more than one of the aliases of a mob or an * object to referencing them. For exemple, if there are 3 swords on the floor * (a long sword, a short sword and a tempered sword). If you type "get sword", * your player will get the first one. With this, you can type "get sword,long" * to get the long one. * * Set the following preproc constant to the character that you want as a * keyword-separator for the isname() function. The default is a comma. */ #define MULTINAME_CHAR ',' int isname(const char *str, const char *namelist) { char token[MAX_INPUT_LENGTH], *tokp; if (str == NULL || namelist == NULL) { log("SYSERR: NULL str (%p) or namelist (%p) passed to isname().", str, namelist); return (0); } while (*str) { while (!isalpha(*str) || *str == MULTINAME_CHAR) str++; if (!*str) break; for (tokp = token; *str && *str != MULTINAME_CHAR; str++) *tokp++ = *str; *tokp = '\0'; if (!single_isname(token, namelist)) return (0); } return (1); } /*** * File: handler.c * Do: replace the original isname() function with this ***/ int single_isname(const char *str, const char *namelist) { const char *curname, *curstr; curname = namelist; for (;;) { for (curstr = str;; curstr++, curname++) { if (!*curstr && (use_abbrevs || !isalpha(*curname))) return (1); if (!*curname) return (0); if ((use_abbrevs && !*curstr) || *curname == ' ') break; if (LOWER(*curstr) != LOWER(*curname)) break; } while (isalpha(*curname)) curname++; if (!*curname) return (0); curname++; } } /*** * File: handler.c * Do: replace original get_number() function with this ***/ int get_number(char **name) { int i; char number[MAX_INPUT_LENGTH], *ppos; /* * These lines was added to make possible the dot sign to be used as a magic * char on isname() function. */ if (!isdigit(**name)) return (1); if ((ppos = strchr(*name, '.')) != NULL) { *ppos++ = '\0'; strcpy(number, *name); strcpy(*name, ppos); for (i = 0; *(number + i); i++) if (!isdigit(*(number + i))) return (0); return (atoi(number)); } return (1); } -- +---------------------------------------------------------------+ | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html | | Newbie List: http://groups.yahoo.com/group/circle-newbies/ | +---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 06/25/03 PDT