Try this code:
on ^*:TEXT:**:?,#:{
var %s, %r = /\030? $+ $color(background) $+ (?!,\d{0,2}) $+ /g
%r = $regsub(,$1-,%r,,%s)
if (!$window($target)) query $target
echo -tl $target < $+ $nick $+ > %s
haltdef
}
This doesn't always give the same results as mIRC does, for instance, with background is black on []1,29test. The part after the comma is invalid in which case mIRC generates foreground black. But the given code doesn't resolve this and gives ,29test. Replacing %r = $regsub(,$1-,%r,,%s) by %r = $regsub(,$1-,%r, []0,%s) generates black on black
Better code is:
on ^*:TEXT:**:?,#:{
var %s = $null
if ($color(background) < 10) {
var %r = /\03( $+ $color(background) $+ (?!\d)|0 $+ $color(background) $+ )(?!,(0|1[0-5]|[1-9]\D))/g
}
else {
var %r = /\03( $+ $color(background) $+ )(?!,(0|1[0-5]|[1-9]\D))/g
}
%r = $regsub(, $1-, %r, 0, %s)
if (!$window($target)) query $target
echo -tlbfmr $target < $+ $nick $+ > %s
haltdef
}
This code alsoI solves the problem of getting lines with 1 position colorcode and 2 positions color code e.g. []1test and []01test.
One other problem stays: how to convert dark blue on black to a readable colorscheme??