Liberty Unleashed

Scripting => Script Snippets => Topic started by: Windlord on April 25, 2011, 03:41:47 am

Title: Easy IRC colour code application
Post by: Windlord on April 25, 2011, 03:41:47 am
Code: (squirrel) [Select]
const ircCol = "\x0003";
const ircBold = "\x0002";

function iCol ( col, string ) return ircCol + iColnumToString( col ) + string + ircCol;

function iBold( string ) return ircBold + string + ircBold;

function iColnumToString( colnum )
{
 if (typeof(colnum) == "string") return colnum;
 local colstr = colnum.tostring();
 return colnum < 10 ? "0"+colstr : colstr;
}

Example usage:
Code: (squirrel) [Select]
Echo( iCol( 2, "Server Connected" ) +" "+ iBold( iCol( 4, "BUT IT'S BURNING!!!" ) ) );Server Connected BUT IT'S BURNING!!!
Title: Re: Easy IRC colour code application
Post by: Orpheus on April 26, 2011, 11:16:08 pm
Thanks again wind for yet another clean cut and useful script snippet (:

Regards Orpheus