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

m (Parameters: Correct typo)
 
(19 intermediate revisions by 6 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 [[$banmask identifier - mIRC|$banmask]] identifier, and the [[$bnick identifier - mIRC|$bnick]] identifier. It is important to note that [[$bnick identifier - 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 separate them by comma.
 +
** '''*''' - Any channel window
 +
** '''#''' - Any channel window
 +
** '''#channel[,#]''' - one or more specific channels, separate 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. Optionally, a single '''#''' tag can be used which refers to all channels, or a channel name can be specified directly, such as '''#myChannel'''. Furthermore, mIRC allows the option of including multiple channels, which are separated with a comma, like so: #myChannel,#myOtherChannel,#lastChannel
+
== {{mIRC|local identifiers}} ==
  
<span style="display: inline-block; width: 105px;">'''<commands>'''</span>The commands to be performed when the event listener's criteria is met.
+
=== {{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 ==
 +
 
 +
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 ==
Line 23: Line 51:
  
 
ON *:BAN:#myChannel,#myOtherChannel:msg # Wow, so $iif($bnick,$bnick just got in trouble,$banmask was just added to the channel's ban list) $+ .</source>
 
ON *:BAN:#myChannel,#myOtherChannel:msg # Wow, so $iif($bnick,$bnick just got in trouble,$banmask was just added to the channel's ban list) $+ .</source>
 
The above script utilizes the [[$iif identifier - mIRC|$iif() identifier]], which is a very powerful inline comparison tool within mIRC.
 
  
 
== Compatibility ==
 
== Compatibility ==
Added: mIRC v4.5
+
{{mIRC compatibility|4.5}}
 
 
Added On: 30/06/96
 
  
 
== See Also ==
 
== See Also ==
* [[$banmask identifier - mIRC|$banmask]]
+
* {{mIRC|$banmask}}
* [[$bnick identifier - mIRC|$bnick]]
+
* {{mIRC|$bnick}}
* [[$ibl identifer - mIRC|$ibl]]
+
* {{mIRC|$ibl}}
* [[/ban command - mIRC|/ban]]
+
* {{mIRC|/ban}}
* [[On unban - mIRC|ON UNBAN Event]]
+
* {{mIRC|on events/on unban|on unban event}}
 +
{{mIRC on event list}}
  
[[Category:mIRC on events]]
+
[[Category:mIRC on events|ban]]

Latest revision as of 06:39, 6 February 2024

The ON BAN event is triggered whenever a user on a channel has been banned.

Synopsis[edit]

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

Parameters[edit]

  • <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 separate them by comma.
    • * - Any channel window
    • # - Any channel window
    • #channel[,#] - one or more specific channels, separate them by comma
  • <commands> - The commands to be performed when the event triggers

local identifiers[edit]

$banmask[edit]

Returns the banmask used to ban the user.

$bnick[edit]

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

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

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

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