Formatting codes, are used by IRC clients, to produce a more readable format, by changing text to and from bold, underline, colour (both font and background colours) and reversed text.
Most, but not all, clients support this, and some support it differently to others.
Additionally, some clients support more than the codes listed below, however, I will point out, only the ones that are relevant.
Most of this topic will relate to how mIRC functions, seeing how this is the more widely used client. Should any issues regarding “other client” support be noted, you should point these out in a reply, as they may likely be asked in the future.
Bold text
Client support
This is produces using the CTRL+B control code, by literally holding down the CTRL key, and tapping B.
ASCII character
The bold character has a octal value of 2, but is represented as 002.
As with all the characters, simply typing 002 isn’t enough, as this will only produce the characters 0, 0 and 2. Instead, you have to escape the code, so that Tcl knows, to translate them into the correct coding.
This is done, using the Tcl escape code, which is a simple \ (backslash).
Start and stop
You set the start and end points of the formatting, by using one code to start, and one to stop. These are placed in the text string at the required points.
Example
Code:
\002Hello\002 to all
Output
Hello to all
Underline text
Client support
This is produced using the CTRL+U control code, by literally holding the CTRL key, and tapping U.
ASCII character
The underline character has a octal value of 37, but is represented as 037.
Start and stop
You set the start and end points of the formatting, by using one code to start, and one to stop. These are placed in the text string at the required points.
Example
Code:
This is how to produce a \037EXAMPLE\037 of the underline character
Output:
This is how to produce a EXAMPLE of the underline character
Reversed/italic text
Client support
In mIRC: Produced using CTRL+R, causes text to show in reverse.
This means, the font and background colours are switched.
IE, Red text, or a black background causes, black text on a red background.
Other clients: This produces the text in italic’s/stressed look.
This doesn’t apply to all other clients, as some may act like mirc.
ASCII character
This control code uses the code 26, represented as 026.
Start and stop
You set the start and end points of the formatting, by using one code to start, and one to stop. These are placed in the text string at the required points.
Example
Code:
Here is an \026EXAMPLE\026 of the output
Output other:
Here is an EXAMPLE of the output
Output mIRC:
Forum doesn’t have the formatting codes for this, I may add a image for this later
Normal text
Client support
This is produced using the CTRL+O code, and causes text to return to client default formatting.
Thus, if a script is in use on the client, to produce formatting on the screen, this will bypass this formatting, to use the client default colours, weight and decoration.
ASCII character
This code uses octal value 17, represented as 017
Start and stop
mIRC: This can be turned on and off, like in the above examples.
Other clients: This may be a one off code, where all counters are reset, and no formatting will be used, until the next control character is parsed.
Example
Code:
Here is an example of \017normalised text
Output:
There is no real way to show an example on the forum, and I may create an image later
CTCP Delimiter
Client support
All clients will support this. In most clients, you use a CTCP command to create the correct output.
ASCII character
The CTCP character uses decimal code 1, represented as 001. The order and commands used with this character are important, and are mainly beyond this document.
In brief, the CTCP protocol, is a sub-protocol of IRC (RFC 1459). It was produced after the IRC protocol, to extend the abilities of clients, and to allow structured data/requests to be made, in a fashion, that doesn’t break existing clients, and doesn’t interfere with regular data.
More technical details on what it is used for, and how you should use it, is available in The Client-to-Client Protocol (CTCP) specification
Start and stop
As noted, the position of this code is important.
The very first character of a line, needs to be the CTRL code, starting the code. The very last character needs to be the CTRL code, ending it.
This, it may only ever be the first or the last character, with none in between.
Any arguments to send, need to be enclosed between the codes.
Note: While not to do with start and stop, there is one more thing to note.
CTCP requests are made, using the PRIVMSG command, and any reply, should be sent via the NOTICE command.
CTCP commands/messages take the following format
This means the COMMANDS can be on its own. If there are arguments to send, sererate each by a space, then terminate with a CTCP control character.\001<COMMAND>[ <SPACE> <ARGUMENT> [ARGUMENSTS]]\001
Some of the default suported characters are
ExamplePING - Measure the round trip through IRC servers.
ERROR - Tell a client of errornouse information. Can be used like echo below.
FINGER - Get information about a single client, much like the finger protocol.
ECHO - Simalar to ping, however, you can send text with this.
TIME - Get information about the current time/date and timezone for a user.
DCC - DCC chat, send and fserve requests (and others on supported clients) are initilised through the CTCP protocol.
Code:
\001PING 11235465\001
Output:
No example possible
Colour control
Client support
Most clients support this code, and within mIRC, is generated using the CTRL+K combination.
ASCII character
This code uses decimal value 3, represented as 003
Start and stop/examples
Colour control codes are both simple, and complex. They allow you to change the foreground colour (font) and background colour (though some clients to not support it, they will accept the code never the less). I will role the example section into this.
There are three ways to represent the colour code.
\003
\003FF
\003FF,BB
Where FF means “Forground colour” and BB means “Background colour”, these are separated using a comma (,).
The colours codes, can be both single and/or double digits, if the first one if to be 0.
As with normal codes, you stop the formatting using the code at the required stop point, without any arguments.
Both FF and BB are made up of single, or 2 digit codes, that correspond to 1 of 16 colours (mIRC has a 17th, with a special meaning).
Here is a list of the colour names, as defined by the mIRC help documents.
Code: Select all
0- White
1- Black
2- Blue
3- Green
4- Light Red
5- Brown
6- Purple
7- Orange
8- Yellow
9- Light Green
10- Cyan
11- Light Cyan
12- Light Blue
13- Pink
14- Grey
15- Light Grey
In mIRC, the 17th colour is number 99, and means transparent, allowing text to blend in with the background, regardless of what colour is in use behind the character, and even better, allowing the character to bleed across colours, without being shown.
From this, we can do the following.
Make text red:
\00304Hello
\0034Hello
Yellow text on red background:
\00308,04Hello
\0038,04Hello
\00308,4Hello
\0038,4Hello
There is one small area to watch out for, when changing between colours, in one line of text. Unless you kill the colour formatting with a single code, or specifically force a background colour, the text will inherit the background colour, from the previous code.
EG
\00300,01Hello \00301to you
and
\00300,01Hello \003\00301to you
These are totally different
In the first case, the word “Hello” is “White on black”, and “to you” is “black on black”, as it inherits the back background from the first code.
In the second, there is a second single colour code character before the “to you” code. This removes all colour formatting, and prevent the background colour from being inherited.
Other control code
There are other control codes available. These include Bell (decimal 7, 007), which make computer go “ding” through the speaker (however, this is usually disabled by default, and most system do not use it because of the annoyance factor).
A complete list of the ASCII table, that can be used in your scripts, is available FROM THIS LINK
Edit: Many thanks to "user" for corrections. Tcl uses octal (base 8) numbers in the escape codes, and not our standard decimal (base 10) numbers.