On nick

From Scriptwiki
Revision as of 11:34, 14 June 2006 by Vliedel (talk | contribs) ($comchan($newnick instead of $nick)

Jump to: navigation, search

The on NICK event triggers when a user changes nickname while on the same channel as you.

on <level>:NICK:<commands>

In this event, $nick holds the old nickname and $newnick the new one.

Example

on *:NICK: {
 echo -a $nick is now knows as $newnick 
}

This example would just echo every nickchange to the active window.


If you want to echo it to every common channel (e.g. for changing mIRC's standard layout), you could use the following:

on ^*:NICK: {
 ; we want to halt mIRC's default output
 haltdef
 var %i = 1
 ; lets loop through all common channels
 while (%i <= $comchan($newnick,0)) {
  ; actually echo it to the channel
  echo -t $comchan($newnick,%i) $nick has just changed his nick to $newnick
  ; increase looping-variable
  inc %i
 }
}