From WikiChip
Difference between revisions of "mirc/on events/on nick"
< mirc‎ | on events

m
m (Parameters: Add this)
 
(11 intermediate revisions by 5 users not shown)
Line 1: Line 1:
 +
{{mirc title|On Nick - Events}}
 
The '''ON NICK''' event triggers when a user is on the same channel as you, and they change their nickname.
 
The '''ON NICK''' event triggers when a user is on the same channel as you, and they change their nickname.
  
This event fills the '''[[$chan identifier - mIRC|$chan]]''', '''[[$newnick identifier - mIRC|$newnick]]''', and '''[[$nick identifier - mIRC|$nick]]''' identifiers.
+
This event fills the '''{{mIRC|$newnick}}''' and '''{{mIRC|$nick}}''' identifiers.
  
 
{| class="wikitable" style="line-height: 25px; margin-left: 75px;"
 
{| class="wikitable" style="line-height: 25px; margin-left: 75px;"
Line 7: Line 8:
 
! Identifier !! Description
 
! Identifier !! Description
 
|-
 
|-
| '''$chan''' || The channel name where the event occurred. This can also be '''#'''.
+
| '''$newnick''' || The new nickname of the user. You can use it with $comchan for example.
|-
 
| '''$newnick''' || The new nickname of the user.
 
 
|-
 
|-
 
| '''$nick''' || The user's previous nickname.
 
| '''$nick''' || The user's previous nickname.
Line 16: Line 15:
 
== Synopsis ==
 
== Synopsis ==
 
<pre>ON <level>:NICK:<commands></pre>
 
<pre>ON <level>:NICK:<commands></pre>
 +
 +
== Parameters ==
 +
<span style="display: inline-block; width: 105px;">'''<level>'''</span>The corresponding {{mIRC|access levels}} for the event to trigger.
 +
 +
<span style="display: inline-block; width: 105px;">'''<commands>'''</span>The commands to be performed when the event listener's criteria is met.
 +
  
 
== Example ==
 
== Example ==
 
Echo the nickname change, and disregard mIRC's default nick change message:
 
Echo the nickname change, and disregard mIRC's default nick change message:
 
<source lang="mIRC">ON ^*:NICK: {
 
<source lang="mIRC">ON ^*:NICK: {
   echo $chan * $nick |==> $newnick
+
   echo $comchan($newnick,1) * $nick |==> $newnick
  
 
   ; Halt the default mIRC message
 
   ; Halt the default mIRC message
Line 31: Line 36:
 
Echo to the channel when the local nickname is changed, and halt mIRC's default message:
 
Echo to the channel when the local nickname is changed, and halt mIRC's default message:
 
<source lang="mIRC">ON ME:^*:NICK: {
 
<source lang="mIRC">ON ME:^*:NICK: {
   echo $chan You are now ==> $newnick
+
   echo $comchan($newnick,1) You are now ==> $newnick
  
 
   ; Halt the default mIRC message
 
   ; Halt the default mIRC message
Line 39: Line 44:
 
The example above should have an output resembling the following:
 
The example above should have an output resembling the following:
 
<pre>You are now ==> whoMe</pre>
 
<pre>You are now ==> whoMe</pre>
 +
 +
<source lang="mIRC">
 +
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
 +
}
 +
</source>
  
 
== Compatibility ==
 
== Compatibility ==
Added: mIRC v2.1a
+
{{mIRC compatibility|2.1a}}
 
 
Added On: 28/02/95
 
  
 
== See Also ==
 
== See Also ==
Line 49: Line 66:
 
* [[On mode - mIRC|ON MODE]]
 
* [[On mode - mIRC|ON MODE]]
 
* [[On part - mIRC|ON PART]]
 
* [[On part - mIRC|ON PART]]
* [[$newnick identifier - mIRC|$newnick]]
+
* {{mIRC|$newnick}}
* [[$nick identifier - mIRC|$nick]]
+
* {{mIRC|$nick}}
 +
{{mIRC on event list}}
  
[[Category:mIRC on events]]
+
[[Category:mIRC on events|nick]]

Latest revision as of 07:54, 6 February 2024

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[edit]

ON <level>:NICK:<commands>

Parameters[edit]

<level>The corresponding access levels for the event to trigger.

<commands>The commands to be performed when the event listener's criteria is met.


Example[edit]

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[edit]

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[edit]