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

m (Add'l example)
(Example)
Line 11: Line 11:
 
== Example ==
 
== Example ==
 
When a user disconnects, stop mIRC's default message and, instead, echo to the active window a custom message:
 
When a user disconnects, stop mIRC's default message and, instead, echo to the active window a custom message:
<source lang="mIRC">ON ^*:QUIT: {
+
<source lang="mIRC">on ^*:QUIT:{
 
   echo -a * $nick just disconnected from $network
 
   echo -a * $nick just disconnected from $network
 
   haltdef
 
   haltdef
Line 22: Line 22:
 
   var %i $comchan($nick,0)
 
   var %i $comchan($nick,0)
 
   while (%i) {
 
   while (%i) {
     echo -ctg quit $chan(%i) * $nick $+($chr(40),$address,$chr(41)) Quit $iif($1,$+($chr(40),$1-,$chr(41)))  
+
     echo -ctg quit $comchan($nick,%i) * $nick $+($chr(40),$address,$chr(41)) Quit $iif($1,$+($chr(40),$1-,$chr(41)))  
 
     dec %i
 
     dec %i
 
   }
 
   }

Revision as of 12:50, 28 October 2023

The ON QUIT event is triggered when a user quits/disconnects from the IRC network while on the same channel as the local mIRC client.

Synopsis

ON <level>:QUIT:<commands>

<level>The level for the event to trigger.

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

Example

When a user disconnects, stop mIRC's default message and, instead, echo to the active window a custom message:

on ^*:QUIT:{
  echo -a * $nick just disconnected from $network
  haltdef
}
Because ON QUIT is not associated with # or $chan, to show a quit message in all channels you share with that nick, you can use $comchan. You can simulate mIRC's default Quit message in channels with:
 
on ^*:QUIT:{
  var %i $comchan($nick,0)
  while (%i) {
    echo -ctg quit $comchan($nick,%i) * $nick $+($chr(40),$address,$chr(41)) Quit $iif($1,$+($chr(40),$1-,$chr(41))) 
    dec %i
  }
  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