This function, "stripCOLOR" is used to strip escaped string color codes from the players text output que if they so desire not to see color. This is assuming you handle your color codes as such, in possibly screen.h ----------------- ** in screen.h ** ----------------- #define C_N "\033[0m" // Normal #define C_R "\033[31m" // Red #define C_BrR "\033[1;31m" // Bright Red #define C_G "\033[32m" // Green #define C_BrG "\033[1;32m" // Bright Green #define C_Y "\033[33m" // Yellow #define C_BrY "\033[1;33m" // Bright Yellow #define C_B "\033[34m" // Blue #define C_BrB "\033[1;34m" // Bright Blue #define C_M "\033[35m" // Magenta #define C_BrM "\033[1;35m" // Bright Magenta #define C_C "\033[36m" // Cyan #define C_BrC "\033[1;36m" // Bright Cyan #define C_W "\033[37m" // White #define C_BLACK "\033[30m" // Black #define C_BOLD "\033[1m" // Bold #define C_BLINK "\033[5m" // Blink #define C_NULL "" // NULL #define C_CLEAR "\033[2J" // Clear ?? #define C_UNDERLINE "\033[4m" // Underline #define C_DARK "\033[2m" // Dark #define C_BR "\033[41m" // (background) Red #define C_BG "\033[42m" // (background) Green #define C_BY "\033[43m" // (background) Yellow #define C_BB "\033[44m" // (background) Blue #define C_BM "\033[45m" // (background) Magenta #define C_BC "\033[46m" // (background) Cyan #define C_BW "\033[47m" // (background) White #define C_BBLACK "\033[40m" // (background) Black ?? ------------------------- ********************* ------------------------- Okay, Let's get right into the code: --------------------------- **[ stripCOLOR ] function** --------------------------- char *stripCOLOR(char *haystack, char *needle, char *replacement) { static char buffer[MAX_STRING_LENGTH]; static char buffer2[MAX_STRING_LENGTH]; char *haystackORIG = haystack; char *needleORIG = needle; char *replacementORIG = replacement; char *ch; // Check to see if we find the 'orig' string in the 'st' string // If not, return the string if (!(ch = (char*)strstr(haystack, needle))) return (char*)haystack; // Okay, the needle was found in the haystack, let's replace it with the 'replacement' strncpy(buffer, haystack, (ch - haystack)); strncpy(buffer2, haystack, ((ch - haystack) + strlen(needle))); buffer[(ch - haystack)] = '\0'; buffer2[((ch - haystack) + strlen(needle))] = '\0'; if (strlen(needle) >= strlen(replacement)) { sprintf((buffer + (ch - haystack)), "%s%s", replacement, (ch + strlen(needle))); } else { sprintf((buffer2 + (ch - haystack)), "%s%s", replacement, (ch + strlen(needle))); strncpy(buffer, buffer2, strlen(buffer)); } // Since the needle was found once, let's cycle thru and check for more of these needles. stripCOLOR(buffer, needleORIG, replacementORIG); return buffer; } ------------------------------------------ **[ vwrite_to_output ] modified function** ------------------------------------------ size_t vwrite_to_output(struct descriptor_data *t, const char *format, va_list args) { static char txt[MAX_STRING_LENGTH]; size_t wantsize; int size; char *txtHold; int sz, len; bool found = FALSE; /* if we're in the overflow state already, ignore this new output */ if (t->bufspace == 0) return (0); wantsize = size = vsnprintf(txt, sizeof(txt), format, args); sz = wantsize; // Start the color figuring if (t->character) { // This is of course assuming you have a player PRF flag of PRF_NOCOLOR // in your structs.h file if (PRF_FLAGGED(t->character, PRF_NOCOLOR)) { txtHold = stripCOLOR(txt, C_BrG, ""); txtHold = stripCOLOR(txtHold, C_R, ""); txtHold = stripCOLOR(txtHold, C_BrR, ""); txtHold = stripCOLOR(txtHold, C_G, ""); txtHold = stripCOLOR(txtHold, C_Y, ""); txtHold = stripCOLOR(txtHold, C_BrY, ""); txtHold = stripCOLOR(txtHold, C_B, ""); txtHold = stripCOLOR(txtHold, C_BrB, ""); txtHold = stripCOLOR(txtHold, C_M, ""); txtHold = stripCOLOR(txtHold, C_BrM, ""); txtHold = stripCOLOR(txtHold, C_C, ""); txtHold = stripCOLOR(txtHold, C_BrC, ""); txtHold = stripCOLOR(txtHold, C_BR, ""); txtHold = stripCOLOR(txtHold, C_BG, ""); txtHold = stripCOLOR(txtHold, C_BY, ""); txtHold = stripCOLOR(txtHold, C_BB, ""); txtHold = stripCOLOR(txtHold, C_BM, ""); txtHold = stripCOLOR(txtHold, C_BC, ""); txtHold = stripCOLOR(txtHold, C_N, ""); len = strlen(txtHold); wantsize = len; size = len; for (sz ; sz > -1; sz--) { txt[sz] = txtHold[sz]; } found = TRUE; } } if (!found) wantsize = size = vsnprintf(txt, sizeof(txt), format, args); /* If exceeding the size of the buffer, truncate it for the overflow message */ if (size < 0 || wantsize >= sizeof(txt)) { size = sizeof(txt) - 1; strcpy(txt + size - strlen(text_overflow), text_overflow); } /* * If the text is too big to fit into even a large buffer, truncate * the new text to make it fit. (This will switch to the overflow * state automatically because t->bufspace will end up 0.) */ if (size + t->bufptr + 1 > LARGE_BUFSIZE) { size = LARGE_BUFSIZE - t->bufptr - 1; txt[size] = '\0'; buf_overflows++; } /* * If we have enough space, just write to buffer and that's it! If the * text just barely fits, then it's switched to a large buffer instead. */ if (t->bufspace > size) { strcpy(t->output + t->bufptr, txt); t->bufspace -= size; t->bufptr += size; return (t->bufspace); } buf_switches++; /* if the pool has a buffer in it, grab it */ if (bufpool != NULL) { t->large_outbuf = bufpool; bufpool = bufpool->next; } else { /* else create a new one */ CREATE(t->large_outbuf, struct txt_block, 1); CREATE(t->large_outbuf->text, char, LARGE_BUFSIZE); buf_largecount++; } strcpy(t->large_outbuf->text, t->output); t->output = t->large_outbuf->text; strcat(t->output, txt); /* set the pointer for the next write */ t->bufptr = strlen(t->output); /* calculate how much space is left in the buffer */ t->bufspace = LARGE_BUFSIZE - 1 - t->bufptr; return (t->bufspace); } ... and that's pretty much all there is to it.