Viewing a buffer

Posted by Gohan_TheDragonball on Mon 29 Oct 2007 10:14 PM — 1 posts, 8,931 views.

USA #0
Just a mod i did awhile back, got tired when going in to modify a helpfile or a room description and having to retype all the color tokens.

        if ( !str_cmp( cmd+1, "l" ) )
        {
            bool showAll = FALSE;

            if ( argument[2] == ' ' )
            {
                argument = one_argument( argument, cmd );
                if ( !str_cmp( argument, "all" ) )
                    showAll = TRUE;
            }

            if ( edit->numlines == 0 )
                send_to_char( "Buffer is empty.\n\r> ", ch );
            else
            {
                send_to_char_color( "&W------------------\n\r", ch );
                for ( x = 0; x < edit->numlines; x++ )
                {
                    ch_printf( ch, "%2d> ", x+1 );
                    if ( showAll )
                        send_to_char( edit->line[x], ch );
                    else
                        ch_printf( ch, "%s\n\r", edit->line[x] );
                    send_to_char( "\n\r", ch );
                }
                send_to_char( "&W------------------\n\r> ", ch );
            }
	    return;
	}


mine looks a little different since in my code i had already redone send_to_char to automatically redirect to send_to_char_color, so i have something called send_to_char_nocolor.