/* WiziName - Implements immortal-customizable names that replace "Someone" when the imm is wizi. Togglable between a pre-defined default and a custom message that the imm can set. Note - This was created for ROM 2.4, but should be easy enough to modify for other codebases and versions. This is my first snippet, so please be kind when contacting me. Author - Geoff Ellingwood (aka Neppyman) - E-mail neppyman@yahoo.com Home - The Crimson Sunrise (lod.viper-net.com:4050) Use - Have fun with this code. It's simple and easy, but something I haven't seen much of in muds. If you like it, all I ask is that you use the provided helpfile and keep my contact info intact. If you want to drop me a line with comments, bug reports, or whatever, feel free. It would be a fairly trivial matter to add additional wizinames that can be stored, for those who just can't leave code untouched. ;) */ ****** MERC.H ****** Add to pc_data data structure: char *wiziname; char *storedwiziname; int wizinametoggle; Add def: #define DEFAULT_WIZINAME "{BAn Immortal{x" (of course, this can be whatever you want it to be - this is simply a suggestion) Look for this: #define PERS(ch, looker) ( can_see( looker, (ch) ) ? \ ( IS_NPC(ch) ? (ch)->short_descr \ : (ch)->name ) : "Someone" ) Replace it with this: #define PERS(ch, looker) ( can_see( looker, (ch) ) ? \ ( IS_NPC(ch) ? (ch)->short_descr \ : (ch)->name ) : ( IS_IMMORTAL(ch) ? \ ( (ch)->pcdata->wiziname[0]=='\0' ? \ DEFAULT_WIZINAME : \ (ch)->pcdata->wiziname ) : "Someone") ) ****** DOFUN.H ****** COMMAND_FUN (do_wiziname) ****** ACT_WIZ.C ****** Stick this in somewhere: CH_CMD (do_wiziname) { if (!IS_NPC (ch)) { smash_tilde (argument); if (ch->pcdata->storedwiziname[0] == '\0') { chprintln (ch, "Error, you have no custom wiziname set for this character!"); free_string (ch->pcdata->wiziname); ch->pcdata->wiziname = str_dup (DEFAULT_WIZINAME); free_string (ch->pcdata->storedwiziname); ch->pcdata->storedwiziname = str_dup (DEFAULT_WIZINAME); chprintlnf (ch, "Wiziname now set to mud default of: %s", DEFAULT_WIZINAME); ch->pcdata->wizinametoggle = 0; return; } if (argument[0] == '\0') { chprintln (ch, "Wiziname toggled."); switch (ch->pcdata->wizinametoggle) { case 0: ch->pcdata->wizinametoggle = 1; chprintlnf (ch, "Wiziname now set to your custom wiziname of: %s", ch->pcdata->wiziname); free_string (ch->pcdata->wiziname); ch->pcdata->wiziname = str_dup (DEFAULT_WIZINAME); break; default: ch->pcdata->wizinametoggle = 0; chprintlnf (ch, "Wiziname now set to mud default of: %s", DEFAULT_WIZINAME); free_string (ch->pcdata->wiziname); ch->pcdata->wiziname = str_dup (ch->pcdata->storedwiziname); chprintln (ch, "Your stored wiziname has not been lost."); } } else { free_string (ch->pcdata->wiziname); free_string (ch->pcdata->storedwiziname); ch->pcdata->wiziname = str_dup (argument); ch->pcdata->storedwiziname = str_dup (argument); ch->pcdata->wizinametoggle = 1; chprintlnf (ch, "Wiziname now set to your custom wiziname of: %s", ch->pcdata->wiziname); chprintln (ch, "Custom wiziname stored."); } } return; } ****** SAVE.C ****** Look for "fprintf (fp, "Bin %s~\n", ch->pcdata->bamfin);" and add: if (ch->pcdata->wiziname[0] != '\0') fprintf (fp, "WNc %s~\n", ch->pcdata->wiziname); if (ch->pcdata->storedwiziname[0] != '\0') { fprintf (fp, "WNs %s~\n", ch->pcdata->storedwiziname); fprintf (fp, "WNt %d\n", ch->pcdata->wizinametoggle); } Look for "ch->pcdata->bamfout = str_dup ("");" and add: ch->pcdata->storedwiziname = str_dup (""); ch->pcdata->wiziname = str_dup (""); ch->pcdata->wizinametoggle = 0; In fread_char () add the following under the case statements: case 'W': KEYS ("WNc", ch->pcdata->wiziname, fread_string (fp)); KEYS ("WNs", ch->pcdata->storedwiziname, fread_string (fp)); KEY ("WNt", ch->pcdata->wizinametoggle, fread_number (fp)); ****** RECYCLE.C ****** Look for "free_string (pcdata->bamfout);" and add: free_string (pcdata->storedwiziname); free_string (pcdata->wiziname); You'll also need to have an Imp (or you, if you have access) use the command editor to add "wiziname" so that you can use it. It should only be available to Imms, obviously, but no real damage will be done if a mortal uses it. ****** Help File (keyword "WIZINAME") ****** Wiziname is a command which lets immortals set a custom name that appears to mortals (and lower-level imms) when they do things while wizi. It allows you to toggle between a mud-default (useful for anonymity) value and a custom string set by the imm. Toggling will not destroy your saved custom wiziname. To toggle between default and custom, simple type the following: wiziname The first time you issue that command, your custom will be set to the default. To enter and store a custom wiziname, simply type the following: wiziname (your custom wiziname) And it will be set. That's all! WIZINAME by Geoff Ellingwood [neppyman@yahoo.com] ****** END oF LINE ******