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

m (See Also)
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
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]].
+
{{mirc title|On Ban - Events}}
 +
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 ==
<span style="display: inline-block; width: 105px;">'''<level>'''</span>The level 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.
 +
* '''<*><#[,#]>''' - 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
  
<span style="display: inline-block; width: 105px;">'''<#[,#]>'''</span>The channel or channels for which the ban occurred.
+
== {{mIRC|local identifiers}} ==
  
<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>
+
=== {{mIRC|$banmask}} ===
  
<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>
+
Returns the banmask used to ban the user.
  
<span style="display: inline-block; width: 105px;">'''<commands>'''</span>The commands to be performed when the event listener's criteria is met.
+
=== {{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 ==
 +
 
 +
You can compare the levels of the banner and the banned by prefixing the line with <, >, <=, =>, <> (different than), or =, in the following way:
 +
 
 +
<source lang="mIRC">
 +
on >=2:BAN:#mIRC:/msg $chan $nick banned $banmask (legal)
 +
on 1:BAN:#mIRC:/msg $chan $nick banned $banmask (illegal)
 +
</source>
 +
 
 +
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.
 +
 
 +
Remember that $banmask is usually a {{mirc|wildcard}} string which means that it will match both wildcard and non-wildcard user strings in your remote users section.
  
 
== Examples ==
 
== Examples ==

Revision as of 14:19, 20 October 2018

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.

Remember that $banmask is usually a wildcard string which means that it will match both wildcard and non-wildcard user strings in your remote users section.

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