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

(Parameters)
Line 1: Line 1:
 
{{mIRC Guide}}
 
{{mIRC Guide}}
The '''ON BAN''' event is triggered whenever a user on a channel has been banned. When the ban occurs, the two identifiers that are most closely associated with the event are the {{mIRC|$banmask}} identifier, and the {{mIRC|$bnick}} identifier. It is important to note that {{mIRC|$bnick}} is not always filled, as some bans don't always contain the nickname, but rather a [[wildcard]] in the form of a [[banmask]].
+
The '''ON BAN''' event is triggered whenever a user on a channel has been banned.
  
 
== Synopsis ==
 
== Synopsis ==
<pre>ON <level>:BAN:<#[,#]>:<commands></pre>
+
<pre>ON <level>:BAN:<*,#[,#]>:<commands></pre>
  
 
== Parameters ==
 
== Parameters ==
 
 
* '''<level>''' - The corresponding {{mIRC|access levels}} for the event to trigger.
 
* '''<level>''' - The corresponding {{mIRC|access levels}} for the event to trigger.
 
* '''<matchtext>''' - The corresponding {{mIRC|on text|matchtext}} for the event to trigger.
 
* '''<matchtext>''' - The corresponding {{mIRC|on text|matchtext}} for the event to trigger.
* '''<*><?><#[,#]>''' - The place, or places where the event listens, you can seperate them by comma.
+
* '''<*><#[,#]>''' - The place, or places where the event listens, you can seperate them by comma.
** '''*''' - Any query/channel window
+
** '''*''' - Any channel window
** '''?''' - Any query windows
 
 
** '''#''' - Any channel window
 
** '''#''' - Any channel window
 
** '''#channel[,#]''' - one or more specific channels, seperate them by comma
 
** '''#channel[,#]''' - one or more specific channels, seperate them by comma
 
* '''<commands>''' - The commands to be performed when the event triggers
 
* '''<commands>''' - The commands to be performed when the event triggers
  
 +
== {{mIRC|local identifiers}} ==
 +
 +
=== {{mIRC|$banmask}} ===
 +
 +
Returns the banmask used to ban the user.
 +
 +
=== {{mIRC|$bnick}} ===
 +
 +
Returns the nickname of the user being banned. It is important to note that {{mIRC|$bnick}} is not always filled, as some bans don't always contain the nickname.
 +
 +
== Comparing levels ==
  
<span style="display: inline-block; width: 105px;">'''<level>'''</span>The level for the event to trigger.
+
You can compare the levels of the banner and the banned by prefixing the line with <, >, <=, =>, <> (different than), or =, in the following way:
  
<span style="display: inline-block; width: 105px;">'''<#[,#]>'''</span>The channel or channels for which the ban occurred.
+
<source lang="mIRC">
 +
on >=2:BAN:#mIRC:/msg $chan $nick banned $banmask (legal)
 +
on 1:BAN:#mIRC:/msg $chan $nick banned $banmask (illegal)
 +
</source>
  
<div style="background-color: rgba(0,0,0,.03); display: block;"><span style="display: inline-block; margin-left: 105px; width: 65px;">'''#'''</span>If no channel mentioned, targets all channels; otherwise, a specific channel.</div>
+
In this situation, if the banners level is larger than or equal to the banned users level, then it is a legal ban.
  
<div style="background-color: rgba(0,0,0,.06); display: block;"><span style="display: inline-block; margin-left: 105px; width: 65px;">'''[,#]'''</span>Can be used to specify multiple, literal channel targets.</div>
+
Otherwise, it defaults to the second ON BAN line which indicates that it is an illegal ban. Remember, this is comparing the banners and banned users levels and has nothing to do with the level 2 in the definition.
  
<span style="display: inline-block; width: 105px;">'''<commands>'''</span>The commands to be performed when the event listener's criteria is met.
 
  
 
== Examples ==
 
== Examples ==

Revision as of 06:31, 22 January 2016

Template:mIRC Guide The ON BAN event is triggered whenever a user on a channel has been banned.

Synopsis

ON <level>:BAN:<*,#[,#]>:<commands>

Parameters

  • <level> - The corresponding access levels for the event to trigger.
  • <matchtext> - The corresponding matchtext for the event to trigger.
  • <*><#[,#]> - The place, or places where the event listens, you can seperate them by comma.
    • * - Any channel window
    • # - Any channel window
    • #channel[,#] - one or more specific channels, seperate them by comma
  • <commands> - The commands to be performed when the event triggers

local identifiers

$banmask

Returns the banmask used to ban the user.

$bnick

Returns the nickname of the user being banned. It is important to note that $bnick is not always filled, as some bans don't always contain the nickname.

Comparing levels

You can compare the levels of the banner and the banned by prefixing the line with <, >, <=, =>, <> (different than), or =, in the following way:

on >=2:BAN:#mIRC:/msg $chan $nick banned $banmask (legal)
on 1:BAN:#mIRC:/msg $chan $nick banned $banmask (illegal)

In this situation, if the banners level is larger than or equal to the banned users level, then it is a legal ban.

Otherwise, it defaults to the second ON BAN line which indicates that it is an illegal ban. Remember, this is comparing the banners and banned users levels and has nothing to do with the level 2 in the definition.


Examples

; This ban event listens for a ban
; on all channels, and responds by messaging the channel.
 
ON *:BAN:#:msg # Looks like the address $banmask has just been added to this channel's ban list.
; This example will watch for a ban on two
; specific channels: #myChannel and #myOtherChannel. When a ban is
; noticed, the script will also attempt to find out if a $bnick was set.
; If it was not, it will use it, otherwise it will use $banmask.
 
ON *:BAN:#myChannel,#myOtherChannel:msg # Wow, so $iif($bnick,$bnick just got in trouble,$banmask was just added to the channel's ban list) $+ .

Compatibility

Added: mIRC v4.5
Added on: 30 Jun 1996
Note: Unless otherwise stated, this was the date of original functionality.
Further enhancements may have been made in later versions.


See Also