TinTin++ Mud Client The TinTin++ message board

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
TinTin++ Mud Client

Colorized Logoutput helper

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Finished Scripts
View previous topic :: View next topic  
Author Message
zypop



Joined: 25 Aug 2011
Posts: 5

PostPosted: Sat Aug 27, 2011 4:57 pm    Post subject: Colorized Logoutput helper Reply with quote

I recently had a problem that when I would take a line and echo "part" of it to a log file, I would often miss some of the colors or have no colors at all... I decided to directly control the console colors... so I took the console colors and converted them into VARS, so I just call the var I want to specify the color I'm looking for...

Code:
#nop Formatting Options... NOT ALL are supported by every term

#var text_reset {\e[0m}

#nop TEXT AFFECTS
#var bold_on {\e[1m}
#var bold_off {\e[21m}
#var dim_on {\e[2m}
#var dim_off {\e[22m}
#var underline_on {\e[4m}
#var underline_off {\e[24m}
#var blink_on {\e[5m}
#var blink_off {\e[25m}
#var reverse_on {\e[7m}
#var reverse_off {\e[27m}
#var hidden_on {\e[8m}
#var hidden_off{\e[28m}
#var strike_out_on {\e[9m}
#var strike_out_off {\e[29m}

#nop TEXT COLORS
#var c_default {\e[39m}
#var c_red {\e[31m}
#var c_green {\e[32m}
#var c_yellow {\e[33m}
#var c_blue {\e[34m}
#var c_magenta {\e[35m}
#var c_cyan {\e[36m}
#var c_light_gray {\e[37m}
#var c_dark_gray {\e[90m}
#var c_light_red {\e[91m}
#var c_light_green {\e[92m}
#var c_light_yellow {\e[93m}
#var c_light_blue {\e[94m}
#var c_light_magenta {\e[95m}
#var c_light_cyan {\e[96m}
#var c_white  {\e[97m}

#nop Background Colors
#var b_default {\e[49m}
#var b_red {\e[41m}
#var b_green {\e[42m}
#var b_yellow {\e[43m}
#var b_blue {\e[44m}
#var b_magenta {\e[45m}
#var b_cyan {\e[46m}
#var b_light_gray {\e[47m}
#var b_dark_gray {\e[100m}
#var b_light_red {\e[101m}
#var b_light_green {\e[102m}
#var b_light_yellow {\e[103m}
#var b_light_blue {\e[104m}
#var b_light_magenta {\e[105m}
#var b_light_cyan {\e[106m}
#var b_white {\e[107m}


Here is the example on how I'm using it... I am sure it has much more useful applications that I leave to you:


Code:
#nop Remove Chat from standard dialog and place in log file
#action {~^\{chan ch=%+\}%*$} {#line log $log_file {[${c_green} %1 ${text_reset}] %2}; #line gag;}


This takes a chat "channel" on aardwold and drops it into a separate log file. It preserves the original colors of the text AND adds a color coded channel specifier to the text... I coded all the chat channels to output in GREEN.. (i use other colors for announcements, auctions etc...), I was just trying to show an example... Here is a line of output from this action:

[ tech ] Turie Tech: Fiendish: I have one right now.


It kept the original colors, and I called out a custom color "green" for my channel indicator. Note don't forget the ${text_reset} otherwise the color you select will color ALL text.

Also note not very feature is supported by every term. For example "blink" does not work in gnome-terminal, but does in kterm. So if you are having a problem with something working make sure your term supports the feature. To find out more and what your terminal supports you can find it here http://misc.flogisoft.com/bash/tip_colors_and_formatting
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Finished Scripts All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads
TinTin++ Homepage

Powered by phpBB © 2001, 2002 phpBB Group