on NICK events don't happen in channels, so there is no $chan. Loop through $comchan instead.
on ^*:NICK:{
var %i = 1
while ( $comchan($newnick,%i) ) {
echo -tc nick $v1 ¤¤¤ $nick is now known as $newnick
inc %i
}
haltdef
}
The "-t" puts the timestamp in only if enabled in the window being echoed to. The "-c nick" makes it echo in the colour for nick changes in the Alt+K colour dialog.
The /echo -c switch was added in mIRC v6.11. Use /echo $color(nick) if you have a version older than that.
The $v1 identifier was added in mIRC v6.16. Change it to $ifmatch if you have a version older than that.
Zyzzyx26:
You can use the -a switch to echo the line in the current active window.
Bad idea IMO. The active window may not even be on the same network as the nick change.