From WikiChip
On Nick - Events - mIRC
< mirc‎ | on events
Revision as of 01:22, 28 November 2017 by Maroonbells (talk | contribs) (Correction - event does not fill $chan identifier)

The ON NICK event triggers when a user is on the same channel as you, and they change their nickname.

This event fills the $newnick and $nick identifiers.

Identifier Description
$newnick The new nickname of the user. You can use it with $comchan for example.
$nick The user's previous nickname.

Synopsis

ON <level>:NICK:<commands>

Example

Echo the nickname change, and disregard mIRC's default nick change message:

ON ^*:NICK: {
  echo $comchan($newnick,1) * $nick |==> $newnick
 
  ; Halt the default mIRC message
  haltdef
}

The results of the above example resemble the following:

* Mr_SOCKS |==> noLaundry

Echo to the channel when the local nickname is changed, and halt mIRC's default message:

ON ME:^*:NICK: {
  echo $comchan($newnick,1) You are now ==> $newnick
 
  ; Halt the default mIRC message
  haltdef
}

The example above should have an output resembling the following:

You are now ==> whoMe
Because ON NICK is not associated with # or $chan, to show a nick change message in all channels you share with that nick, you can use $comchan. You can simulate mIRC's default Nick Change message in channels with:
 
ON ^*:NICK:{
  var %i $comchan($newnick,0)
  while (%i) {
    echo -ctg nick $chan(%i) * # $iif($nick == $me,Your nick # is now,$nick is now known as) $newnick
    dec %i
  }
 ; You can precede HALTDEF with a semi-colon to compare this messages with the default
 haltdef
}

Compatibility

Added: mIRC v2.1a
Added on: 28 Feb 1995
Note: Unless otherwise stated, this was the date of original functionality.
Further enhancements may have been made in later versions.


See Also