------------------------------------------------------------------------------- Author: Noah Cunningham (fanight@comcast.net) Date: 8/3/2004 Reason: I've seen this once or twice and I haven't seen a snippit for it. ------------------------------------------------------------------------------- This snippit will allow god level players and above to change what is displayed by their name in the who list. NOTE: THIS WILL CORRUPT YOUR PLAYERFILE, SO IF YOU WISH TO KEEP YOUR PLAYERFILE YOU SHOULD HAVE A PFILE CONVERTER HANDY AND KNOW HOW TO USE IT! Or use ASCII pfiles. You'll need to adjust the do_signet function to work with your color codes if you intend on using them. For example, just copy the commented code from the center() function, change the c's to a's and place it before: if (a <= 5) { You might also want to adjust the length. Five characters is not a lot of space, but I set it to five since that is the stock length of the [Lv Cl] in the who list. Ex: [34 Cl] Fanight (title) [-.I.-] Fanight (title) -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- This code works on stock Circle 3.1, but should work with other versions with little altering. Use any/all of this code as you wish. Any comments may be mailed to me at the above e-mail address. Do not send attachments, I will just delete the message and I will not read it if you do. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Use this code at your own discretion. I warned you it would ruin your player file. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- structs.h ========= In player_special_data_saved add somewhere above/below the spares: char signet[100]; /* Use what you wish - I use 100 to allow for color codes as well */ utils.h ======= Add this line somewhere around the other #define GET_XXXXXXX #define GET_SIGNET(ch) CHECK_PLAYER_SPECIAL((ch), ((ch)->player_specials->saved.signet)) utils.c ======= New function... Used to center stuff. NOTE: Code to remove color codes is commented out. Edit this so that it will remove your color codes. My color code format is >## void center(char *txt, int num); /* Function Proto */ - and - void center(char *txt, int num) { int a, b = 0, c; char nnbuf[100]; /* Change this to allow larger strings to be centered */ strcpy(nnbuf, txt); c = strlen(txt); /* This can be removed if the for loop below is used */ /* for (c = strlen(txt); b < strlen(txt); b++) if (nnbuf[b] == '>'&& isdigit(nnbuf[b+1]) && isdigit(nnbuf[b+2])) c = c - 3; */ a = num - c; /* strlen(txt) minus color codes (if applicable) */ if (a > 0) { strcpy(nnbuf, txt); if ((a % 2) == 0){ a = (num - c) / 2; b = a; } else { a = ((num - c) / 2) + 1.5; b = (a - 1); } strcpy(txt,""); /* Empty the original string */ for (;a != 0;a--) strcat(txt, " "); /* Insert leading spaces */ strcat(txt, nnbuf); /* Insert old string */ for (;b != 0;b--) strcat(txt, " "); /* Insert trailing spaces */ } } act.wizard.c ============ Add our function to set the signet. /* Function Protos */ void center(char *txt, int num); ACMD(do_signet); - and - ACMD(do_signet) { int a; skip_spaces(&argument); if (!*argument) { strcpy(GET_SIGNET(ch), "\0"); send_to_char(ch, "Signet Removed.\r\n"); } else { a = strlen(argument); if (a <= 5) { /* Change the five to whatever length you want. */ center(argument, 5); /* Here too. */ strcpy(GET_SIGNET(ch), argument); send_to_char(ch, "Done.\r\n"); } else send_to_char(ch, "Sorry, signets are limited to 5 characters to provide uniformity in the who list.\r\n"); } } Interpreter.c ============= Add to the command table. ACMD(do_signet); And in cpp_extern const struct command_info cmd_info[] = { ...add... { "signet" , POS_DEAD , do_signet , LVL_GOD, 0 }, Db.c ==== We need to initially set everyone's signet to NULL. In init_char() insert this line just above set_title(ch, NULL); strcpy(GET_SIGNET(ch), "\0"); act.informative.c ================= Last, we need to update our do_who function to recognize the signet and display it. In do_who replace existing code with code between the lines... after... if (showclass && !(showclass & (1 << GET_CLASS(tch)))) continue; if (short_list) { --------------------------------START HERE------------------------------------ if (!strcmp(GET_SIGNET(ch), "\0")) send_to_char(ch, "%s[%2d %s] %-12.12s%s%s", (GET_LEVEL(tch) >= LVL_IMMORT ? CCYEL(ch, C_SPR) : ""), GET_LEVEL(tch), CLASS_ABBR(tch), GET_NAME(tch), (GET_LEVEL(tch) >= LVL_IMMORT ? CCNRM(ch, C_SPR) : ""), ((!(++num_can_see % 4)) ? "\r\n" : "")); else send_to_char(ch, "%s[%s] %-12.12s%s%s", (GET_LEVEL(tch) >= LVL_IMMORT ? CCYEL(ch, C_SPR) : ""), GET_SIGNET(tch), GET_NAME(tch), (GET_LEVEL(tch) >= LVL_IMMORT ? CCNRM(ch, C_SPR) : ""), ((!(++num_can_see % 4)) ? "\r\n" : "")); } else { num_can_see++; if (!strcmp(GET_SIGNET(ch), "\0")) send_to_char(ch, "%s[%2d %s] %s %s", (GET_LEVEL(tch) >= LVL_IMMORT ? CCYEL(ch, C_SPR) : ""), GET_LEVEL(tch), CLASS_ABBR(tch), GET_NAME(tch), GET_TITLE(tch)); else send_to_char(ch, "%s[%s] %s %s", (GET_LEVEL(tch) >= LVL_IMMORT ? CCYEL(ch, C_SPR) : ""), GET_SIGNET(tch), GET_NAME(tch), GET_TITLE(tch)); ---------------------------------STOP HERE------------------------------------ before... if (GET_INVIS_LEV(tch)) send_to_char(ch, " (i%d)", GET_INVIS_LEV(tch)); else if (AFF_FLAGGED(tch, AFF_INVISIBLE)) send_to_char(ch, " (invis)"); -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Done! That should cover it. The 'signet' command is used to set your signet. Once again--USE AT YOUR OWN RISK--I'm not responsible if you break your computer. Have fun! -/\/oah -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-