Downloading File
Filename: $ansi2mirc2 - Ansi Colour Converter
alias ansi2mirc2 {
unset %ansi.forecol
unset %ansi.setting
%string = $replacecs($1-,mm,m $+ $chr(255) $+ m $+ $chr(255))
%string = $replacecs(%string,MM,M $+ $chr(255) $+ M $+ $chr(255))
%x = 1
if (!$pos(%string,$chr(27),1)) return $1-
unset %return
if ($pos(%string,$chr(27),%x) > 1) %return = $gettok(%string,1,27)
while ($pos(%string,$chr(27),%x)) {
%pos = $pos(%string,$chr(27),%x)
%rightstring = $mid(%string,$calc(%pos),1000)
%colcode = $gettok(%rightstring,1,$asc(m))
%colcode = $remove(%colcode,[)
if ($gettok(%colcode,0,$asc(;)) == 2) {
%ansi.setting = $gettok(%colcode,1,$asc(;))
%colcode = $gettok(%colcode,2,$asc(;))
}
if (%ansi.setting == 1) %col = $replace(%colcode,30,14,31,04,32,09,33,08,34,12,35,13,36,11,37,00)
if (%ansi.setting != 1) %col = $replace(%colcode,30,01,31,05,32,03,33,07,34,2,35,06,36,10,37,15)
if (%colcode == 0) {
unset %ansi.*
%col =
}
if ($left($gettok(%rightstring,2-,$asc(m)),1) != $chr(27)) %return = %return $+ $+ %col $+ $remove($gettok($gettok(%rightstring,2-,$asc(m)),1,27),$chr(27))
inc %x
}
return $remove(%return,$chr(255))
}


