alias colornicks {
[color:blue]; Set variables.[/color]
var %c = 1,%text = $1-,%i = $gettok(%text,0,32)
[color:blue]; Loop through each "word."[/color]
while (%c <= %i) {
var %nick = $gettok(%text,%c,32)
[color:blue]; Remove certain symbols from the end of the current word.
; This allows you to match "Riamus" and "Riamus." for example.
; Add/Remove symbols if necessary. Note that a nick can't end in these or it won't be colored.[/color]
while ($right(%nick,1) == : || $right(%nick,1) == - || $right(%nick,1) == $chr(44) || $right(%nick,1) == . || $right(%nick,1) == ! || $right(%nick,1) == $chr(63)) {
var %nick = $left(%nick,-1)
}
[color:blue]; Check if the nick is on the channel or you are in a query or chat with the nick.[/color]
if (%nick ison $chan || %nick == $active) {
[color:blue]; Replace the nick with a colored version.
; If the nick is the first word, it will put brackets around it. Otherwise, just color it.[/color]
if (%c != 1) {
var %text = $reptok(%text,$gettok(%text,%c,32),$replacex($gettok($1-,%c,32),%nick,09 $+ %nick $+ ),32)
}
else {
var %text = $reptok(%text,$gettok(%text,%c,32),$replacex($gettok($1-,%c,32),$gettok($1-,%c,32),03«09 $+ %nick $+ 03»),32)
}
}
inc %c
}
[color:blue]; Return text to calling script.[/color]
return %text
}