Difference between revisions of "On nick"

From Scriptwiki
Jump to: navigation, search
m ($comchan($newnick instead of $nick)
m (added $me note)
 
Line 3: Line 3:
  
 
In this event, $nick holds the old nickname and $newnick the new one.
 
In this event, $nick holds the old nickname and $newnick the new one.
 +
Note that $nick is not in your [[$ial|ial]] anymore, while if you changed nick, $me is your old nick.
  
 
== Example ==
 
== Example ==
Line 9: Line 10:
 
  }
 
  }
 
This example would just echo every nickchange to the active window.
 
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:
 
If you want to echo it to every common channel (e.g. for changing mIRC's standard layout), you could use the following:

Latest revision as of 19:31, 8 December 2007

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. Note that $nick is not in your ial anymore, while if you changed nick, $me is your old nick.

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
 }
}