This method isn't 100% working, for the following reasons:

1) It doesn't take into account mirc's cyclic behaviour with colours. Black is 1, but also 17, 33, 49 etc. So if the black text is created by these numbers, the script won't detect it. Even worse, if the number is 17, the script will replace 1 with $color(normal) giving weird results (fex, if $color(normal) is 5 and the text is 17blah, the script converts it to 057blah).

2) It doesn't take into account the existence of background colouring. It seems logical that the script should not strip black text if this is followed by a background colour, because the sender must have picked a visible combination (and if he didn't, it's his fault :tongue:). The only exception is the background colour 99, which is transparent.

3) The <matchtext> in the on TEXT event catches only 1. Even if you ignore the colour cycling, 01 remains undetected.

Having these in mind, I made an alias that strips black text with the help of -what else?- regular expressions.
Code:
alias stripblack {
  var %r = /(?:1(?=[^\d])|01|17|33|49|65|81|97)(?:(?!,\d)|(?=,99))/g
  !.echo -q $regsub($1,%r, $+ $color(normal).dd,%r)
  return %r
}

on ^*:TEXT:**:*:{
  var %1- = $stripblack($1-)
  if (%1- != $1-) {
    if (#* iswm $target) {
      if ($gettok($readini($+(",$mircini,"),options,n2),30,44)) $&amp;
        var %nick = $nick($chan,$nick).pnick
      else var %nick = $nick
      echo $color(normal) -bflmrti2 $chan $+(&lt;,,$nick($chan,$nick).color,%nick,,&gt;) %1-
    }
    else {
      echo $color(normal) -bflmrti2 $nick $+(&lt;,,$cnick($nick).color,$nick,,&gt;) %1-
    }
    haltdef
  }
}


On a sidenote, $base($color(normal),10,10,2) can be replaced with $color(normal).dd, although the usage of $base here is good for learning purposes (when $color isn't used).

Last edited by qwerty; 08/01/03 01:17 PM.

/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com