Difference between revisions of "On nick"

From Scriptwiki
Jump to: navigation, search
 
m ($comchan($newnick instead of $nick)
Line 17: Line 17:
 
   [[var]] %i = 1
 
   [[var]] %i = 1
 
   ; lets loop through all common channels
 
   ; lets loop through all common channels
   [[while]] (%i <= $comchan($nick,0)) {
+
   [[while]] (%i <= $comchan($newnick,0)) {
 
   ; actually echo it to the channel
 
   ; actually echo it to the channel
   echo -t [[$comchan]]($nick,%i) $nick has just changed his nick to $newnick
+
   echo -t [[$comchan]]($newnick,%i) $nick has just changed his nick to $newnick
 
   ; increase looping-variable
 
   ; increase looping-variable
 
   [[inc]] %i
 
   [[inc]] %i

Revision as of 11:34, 14 June 2006

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