This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Colors

Help for those learning Tcl or writing their own scripts.
Post Reply
B
Branden
Halfop
Posts: 61
Joined: Sat Aug 04, 2007 8:36 pm

Colors

Post by Branden »

Hi there everyone. :)

I'm wondering, how can I add color to the output of a script?

I have the shoutcast script, and want it show certain things in color.

Is this possible?

Please help.
Thanks,
Branden
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

To add mIRC-style colors, you need to prefix the text with a control-character followed by two comma-separated integers to specify text and background color. You also need to terminate the text with another control-character.

Both control-characters are known as "Ctrl-C", and may be generated using the escape-sequence "\003", or by directly injecting the character if your editor supports it.
NML_375
B
Branden
Halfop
Posts: 61
Joined: Sat Aug 04, 2007 8:36 pm

Post by Branden »

Uhm...
I'm a noob...
HUH?!?! lol
sorry..

Can you show me an example?
User avatar
iamdeath
Master
Posts: 323
Joined: Fri Feb 11, 2005 2:32 pm
Location: *HeLL*
Contact:

Post by iamdeath »

TEXT DECORATION

It's also possible to decorate your text a little bit.
you can use special codes to underline your text for exmaple. Besides underlining you can also make it bold and give it a color. You use these codes by just putting them between the pieces of text you want decorated.

The code for underlining is \037, the code for bold is \002 and the code for colors is \003 which is followed by the number of the color. The newest versions of mIRC have a nice pop-up box that shows up when you type CTRL+K to make a color. The numbers inside the colors are the same numbers to use here in the color code.

You start and end the places where you want your decoration to start and stop with the same code you started the text decoration with.

For example "Hello \002$nick\002, welcome in $chan." would result in only "$nick" being in bold or "Hello \002\0034$nick\003\002, welcome in \037$chan\037." would result in "$nick" being in bold and in the color red
and "$chan" underlined. Note that when the end of the color decoration is defined only the code itself needs to be specified and not the number of the color, if you specify the number of the color again it would just make the text switch to that color again and not show any difference.

Another Example for color is:

Code: Select all

puthelp "PRIVMSG $nick :\0034Hi, my name is nothing.\003"
That will become like this:

Hi, my name is nothing.

For a list of colors, go to your mIRC and type CTRL + K

Thanks
iamdeath
|AmDeAtH @ Undernet
Death is only the *Beginning*...
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
Post Reply