/* This code was written by Jaey of Crimson Souls MUD. It was written specificly for a ROM 2.4 MUD with Lope's color code. Any credit given, while appreciated, is not necessary. I spent about an hour and a half ripping the code out of my mud in order to create the patch, and while I think I picked all the necessary code out, I may have omitted something important. Please contact me with any problems. Contact info: E-mail: scarrico@mail.transy.edu Web: http://www.transy.edu/~steven Crimson Souls: ns2.ka.net 6969 */ In merc.h: Add the new connected state. If necessary, change the "16" to a value that isn't being used: #define CON_ANSI 16 Add to the descriptor_data struct: bool ansi; Add the function declaration with a + next to it: + void send_to_desc args( ( const char *txt, DESCRIPTOR_DATA *d ) ); void send_to_char args( ( const char *txt, CHAR_DATA *ch ) ); void page_to_char args( ( const char *txt, CHAR_DATA *ch ) ); In comm.c: In the function game_loop_mac_msdos change: dcon.connected = CON_GET_NAME; to: dcon.connected = CON_ANSI; dcon.ansi = FALSE; and change: { extern char * help_greeting; if ( help_greeting[0] == '.' ) write_to_buffer( &dcon, help_greeting+1, 0 ); else write_to_buffer( &dcon, help_greeting , 0 ); } to: write_to_buffer(&dcon, "Do you want ANSI? (Y/n) ", 0); In the function init_descriptor change: dnew->connected = CON_GET_NAME; to: dnew->connected = CON_ANSI; dnew->ansi = FALSE; and change: { extern char * help_greeting; if ( help_greeting[0] == '.' ) write_to_buffer( dnew, help_greeting+1, 0 ); else write_to_buffer( dnew, help_greeting , 0 ); } to: write_to_buffer(dnew, "Do you want ANSI? (Y/n) ", 0); In function nanny add the following: case CON_ANSI: if ( argument[0] == '\0' || UPPER(argument[0]) == 'Y' ) { d->ansi = TRUE; send_to_desc("{RAnsi enabled!{x\n\r",d); d->connected = CON_GET_NAME; { extern char * help_greeting; if ( help_greeting[0] == '.' ) send_to_desc( help_greeting+1, d ); else send_to_desc( help_greeting , d ); } break; } if (UPPER(argument[0]) == 'N') { d->ansi = FALSE; send_to_desc("Ansi disabled!\n\r",d); d->connected = CON_GET_NAME; { extern char * help_greeting; if ( help_greeting[0] == '.' ) send_to_desc( help_greeting+1, d ); else send_to_desc( help_greeting , d ); } break; } else { send_to_desc("Do you want ANSI? (Y/n) ",d); return; } further down under case CON_GET_OLD_PASSWORD add the lines with a + next to them: if ( check_reconnect( d, ch->name, TRUE ) ) return; sprintf( log_buf, "%s@%s has connected.", ch->name, d->host ); log_string( log_buf ); wiznet(log_buf,NULL,NULL,WIZ_SITES,0,get_trust(ch)); + if (ch->desc->ansi) + SET_BIT(ch->act, PLR_COLOUR); + else REMOVE_BIT(ch->act, PLR_COLOUR); even further down under case CON_CONFIRM_NEW_NAME add the lines with a + next to them: case 'y': case 'Y': sprintf( buf, "New character.\n\rGive me a password for %s: %s", ch->name, echo_off_str ); write_to_buffer( d, buf, 0 ); d->connected = CON_GET_NEW_PASSWORD; + if (ch->desc->ansi) + SET_BIT(ch->act, PLR_COLOUR); break; Make a copy of the code for send_to_char and change the function declaration of the copied version from: void send_to_char( const char *txt, CHAR_DATA *ch ) to: void send_to_desc( const char *txt, DESCRIPTOR_DATA *d ) also in the copied version, which is now called send_to_desc change: if( txt && ch->desc ) to: if( txt && d ) change: if( IS_SET( ch->act, PLR_COLOUR ) ) to: if( d->ansi == TRUE ) change: skip = colour( *point, ch, point2 ); to: skip = colour( *point, NULL, point2 ); If the arguments for the call to the colour function above look different, i.e. you have an older version of the color code, just change the "ch" in your code to NULL. change both instances of: write_to_buffer( ch->desc, buf, point2 - buf ); to: write_to_buffer( d, buf, point2 - buf ); In function colour(), near the top of the function change: if( IS_NPC( ch ) ) to: if( ch && IS_NPC( ch ) ) If you are using version 2.0 of Lope's color code, you will also need to change the line: col = ch->pcdata; to: col = ch ? ch->pcdata : NULL; Some notes: Once you get the code in, you sould do a clean compile of the mud source since a new field was added to the descriptor_data struct in merc.h. If you want to add color to the rest of the login sequence, you just need to convert the write_to_buffer calls sprikled thoughout the login sequence to send_to_desc calls. To convert something like: write_to_buffer( d, "Illegal name, try another.\n\rName: ", 0 ); change it to: send_to_desc("Illegal name, try another.\n\rName: ",d); and add color codes to the text as desired.