From: Mathew Earle Reuther [mailto:graymere@zipcon.net] > Ok, say I've got a list of words or abbreviations which I want to > be able to plug into my score or who commands and such. The value > input into the command display should vary based upon the level of > the character. Perhaps this snippet will help. I slightly modified one of the "whois" commands available out there for my needs (sorry I don't have my notes here to credit the original author). Also in class.c (stock) there is a set of case statements that do this out of the box. You would then add the appropriate output to act.informative.c in do_score(). ACMD(do_whois) { const char *immlevels[LVL_IMPL - (LVL_IMMORT-1)] = { "a Builder.", /* highest mortal level +1 */ "a Master Builder.", /* highest mortal level +2 */ "a Newbie Watcher.", /* highest mortal level +3 */ "a Watcher.", /* highest mortal level +4 */ "a Staff Member.", /* highest mortal level +5 */ "an Implementor.", /* highest mortal level +6 */ }; char buf[MAX_STRING_LENGTH]; struct char_data *victim = 0; struct char_file_u tmp_store; skip_spaces(&argument); if (!*argument) { send_to_char(ch, "Who?\r\n"); } else { CREATE(victim, struct char_data, 1); clear_char(victim); if (load_char(argument, &tmp_store) > -1) { store_to_char(&tmp_store, victim); *buf = '\0'; if (GET_LEVEL(victim) >= LVL_IMMORT) sprintf(buf + strlen(buf), "%s %s is %s\r\n", GET_NAME(victim), GET_TITLE(victim), immlevels[GET_LEVEL(victim)-LVL_IMMORT]); else if (GET_LEVEL(victim) < LVL_IMMORT) sprintf(buf + strlen(buf), "%s %s is a level %d %s.\r\n", GET_NAME(victim), GET_TITLE(victim), GET_LEVEL(victim), GET_CLASS_NAME(victim)); send_to_char(ch, buf); } else { send_to_char(ch, "There is no such player.\r\n"); } free(victim); } } -- +---------------------------------------------------------------+ | 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