From WikiChip
Editing mirc/operators

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

This page supports semantic in-text annotations (e.g. "[[Is specified as::World Heritage Site]]") to build structured and queryable content provided by Semantic MediaWiki. For a comprehensive description on how to use annotations or the #ask parser function, please have a look at the getting started, in-text annotation, or inline queries help pages.

Latest revision Your text
Line 2: Line 2:
 
By now, you should have a pretty good idea of what variables are and how to use them. Now, all you need to be able to do is operate on them. That's exactly what '''mIRC Operators''' lets you do. ''Operators'' are special symbols or keywords that perform specific operations on two or three operands in mIRC.
 
By now, you should have a pretty good idea of what variables are and how to use them. Now, all you need to be able to do is operate on them. That's exactly what '''mIRC Operators''' lets you do. ''Operators'' are special symbols or keywords that perform specific operations on two or three operands in mIRC.
  
== Operators ==
+
Pretty great post. I just stumbled upon your blog and wanted efbcbbfbfedebebd
mIRC provides the following types of operators:
 
 
 
* Arithmetic Operators
 
* Math Comparison Operators
 
* String Comparison Operators
 
* Lexicographical String Comparison Operators
 
* Logical Operators
 
* Channel-related Operators
 
* List-related Operators
 
 
 
=== Arithmetic Operators ===
 
mIRC supports the following arithmetic operators:
 
 
 
{| class="wikitable"
 
! Operator !! Syntax
 
|-
 
| Addition || a + b
 
|-
 
| Subtraction || a - b
 
|-
 
| Multiplication || a * b
 
|-
 
| Division || a / b
 
|-
 
| Modulo || a % b
 
|-
 
| Power || a ^ b
 
|-
 
| Bitwise AND || a & b
 
|-
 
| Floor division (does not work with /set and /var) || a // b
 
|}
 
 
 
They can be used in conjunction with the {{mIRC|/var}} or {{mIRC|/set}} commands as well as using the {{mIRC|$calc}} Identifier. One special feature of the {{mIRC|$calc}} identifier over the {{mIRC|/var}} and {{mIRC|/set}} commands is that it supports combination of operators as well as parenthesis to be able to change the order of operations.
 
 
 
<syntaxhighlight lang="mirc">alias example {
 
  var %x = 5
 
  ;5 * 5 = 25
 
  %x = %x * 5
 
  echo -a %x
 
 
 
  ;remainder of 25 / 9 = 7
 
  var %y = %x % 9
 
  echo -a %y
 
 
 
  ;25 + 7 - 2 = 30
 
  %x = $calc(%x + %y - 2)
 
  echo -a %x
 
}</syntaxhighlight>
 
  
 
== Math Comparison Operators ==
 
== Math Comparison Operators ==
Math Comparison operators allow you to compare two values:
+
Math Comparison operators allow you to compare two values
  
{| class="wikitable"
+
{| class="wikitable" style="float: right"  
 
! Syntax !! Name !! Result
 
! Syntax !! Name !! Result
 
|-
 
|-
Line 79: Line 30:
  
 
Example:
 
Example:
 +
 
<syntaxhighlight lang="mirc">alias example2 {
 
<syntaxhighlight lang="mirc">alias example2 {
 
   ;true (3 a multiple of 9)
 
   ;true (3 a multiple of 9)
Line 92: Line 44:
  
 
== String Comparison Operators ==
 
== String Comparison Operators ==
mIRC provides a set of operators that can be used to compare two strings. The two iswm and iswmcs operators support two {{mirc|wildcard}} characters as well, the question mark (?) substitutes for any one character and the asterisk character ("*") substitutes for any zero or more characters.
+
mIRC provides a set of operators that can be used to compare two strings. The two iswm and iswmcs operators support two wildcard characters as well, the question mark (?) substitutes for any one character and the asterisk character ("*") substitutes for any zero or more characters.
 +
 
 +
 
 +
Example:
 +
 
 +
<syntaxhighlight lang="mirc">alias example3 {
 +
  var %x = Hello!
 +
  if (?ell?? iswm %x) echo true
 +
  ;false, because of '!'
 +
  if (%x isalpha) echo no
 +
  %x = 5
 +
  if (%x isnum 1-10) echo true
 +
  if (%x isnum)  echo true
 +
}</syntaxhighlight>
 +
 
 +
Operators
  
 
{| class="wikitable"
 
{| class="wikitable"
Line 113: Line 80:
 
|%x isalpha || Alphabetic Characters || True, if %x contains only alphabetic characters.
 
|%x isalpha || Alphabetic Characters || True, if %x contains only alphabetic characters.
 
|-
 
|-
|%x islower || All lower case letters || True, if %x does not contain any upper case letters. %x can contain non alphabetic characters.
+
|%x islower || All lower case letters || True, if %x contains only lower case letters.
 
|-
 
|-
|%x isupper || All upper case letters || True, if %x does not contain any lower case letters. %x can contain non alphabetic characters.
+
|%x isupper || All upper case letters || True, if %x contains only upper case letters.
 
|}
 
|}
  
Example:
+
{{clear}}
<syntaxhighlight lang="mirc">alias example3 {
+
<h3 id="LexStringCompOper">Lexicographical String Comparison Operators</h3>
  var %x = Hello!
 
  if (?ell?? iswm %x) echo true
 
  ;false, because of '!'
 
  if (%x isalpha) echo no
 
  %x = 5
 
  if (%x isnum 1-10) echo true
 
  if (%x isnum)  echo true
 
}</syntaxhighlight>
 
 
 
== Lexicographical String Comparison Operators ==
 
 
A lexicographical comparison is a comparison generally used to sort words alphabetically in dictionaries and indexes. If both strings are equal but one is shorter than the other, the shorter string is ''lexicographically less'' than the longer one.
 
A lexicographical comparison is a comparison generally used to sort words alphabetically in dictionaries and indexes. If both strings are equal but one is shorter than the other, the shorter string is ''lexicographically less'' than the longer one.
  
{| class="wikitable"
+
{| class="wikitable" style="float: right"  
 
! Syntax !! Name !! Result
 
! Syntax !! Name !! Result
 
|-
 
|-
Line 138: Line 95:
 
|-
 
|-
 
|a === b || Case sensitive character comparison || True, if character a is equal to character b, case sensitive.
 
|a === b || Case sensitive character comparison || True, if character a is equal to character b, case sensitive.
|-
 
|a != b<br />a !== b || Case insensitive character comparison || True, if character a is not equal to character b, case insensitive.
 
|-
 
|a !=== b || Case sensitive character comparison || True, if character a is not equal to character b, case sensitive.
 
 
|-
 
|-
 
|str1 == str2 || Case insensitive String comparison || True, if str1 equals str2 in a case insensitive manner.
 
|str1 == str2 || Case insensitive String comparison || True, if str1 equals str2 in a case insensitive manner.
 
|-
 
|-
 
|str1 === str2 || Case sensitive String comparison || True, if str1 equals str2 in a case sensitive manner.
 
|str1 === str2 || Case sensitive String comparison || True, if str1 equals str2 in a case sensitive manner.
|-
 
|str1 != str2<br />str1 !== str2 || Case insensitive String comparison || True, if str1 does not equal str2 in a case insensitive manner.
 
|-
 
|str1 !=== str2 || Case sensitive String comparison || True, if str1 does not equal str2 in a case sensitive manner.
 
 
|-
 
|-
 
|a < b || Lexicographically Less Than || True, if the {{mIRC|$asc}}(a) comes before {{mIRC|$asc}}(b)
 
|a < b || Lexicographically Less Than || True, if the {{mIRC|$asc}}(a) comes before {{mIRC|$asc}}(b)
Line 163: Line 112:
 
In an if statement, you are allowed to have more than one condition. Each condition has to be connected to the other using a logical operator. There are two logical operators: || meaning OR and && meaning AND.
 
In an if statement, you are allowed to have more than one condition. Each condition has to be connected to the other using a logical operator. There are two logical operators: || meaning OR and && meaning AND.
  
Example:
+
For example:
 +
 
 
<syntaxhighlight lang="mirc">if ((%x < 0) || (%x >  10)) {</syntaxhighlight>
 
<syntaxhighlight lang="mirc">if ((%x < 0) || (%x >  10)) {</syntaxhighlight>
  
Line 177: Line 127:
  
 
== Channel-related Operators ==
 
== Channel-related Operators ==
mIRC also provides a set of commands to involve IRC channels:
+
mIRC also provides a set of commands to involve IRC channels.
  
{| class="wikitable"
+
{| class="wikitable" style="float: right"  
 
! Syntax !! Name !! Result
 
! Syntax !! Name !! Result
 
|-
 
|-
Line 185: Line 135:
 
|-
 
|-
 
|%x isop %y || Is an Operator || True, if nick %x is an operators on channel %y.
 
|%x isop %y || Is an Operator || True, if nick %x is an operators on channel %y.
|-
 
|%x isowner %y || Is an Owner || True, if nick %x is an owner on channel %y.
 
 
|-
 
|-
 
|%x ishop %y || Is a Halfop || True, if nick %x is a halfop on channel %y.
 
|%x ishop %y || Is a Halfop || True, if nick %x is a halfop on channel %y.
 
|-
 
|-
|%x isvoice %y || Is a Voice || True, if nick %x is a voice on channel %y (isvo operator also supported).
+
|%x isvoice %y || Is a Voice || True, if nick %x is a voice on channel %y.
 
|-
 
|-
 
|%x isreg %y || Is a Regular || True, if nick %x is a regular user on channel %y.
 
|%x isreg %y || Is a Regular || True, if nick %x is a regular user on channel %y.
 
|-
 
|-
|%x ischan || Is a Channel || True, if channel %x is a channel you are on and if the %x channel window is still open (doesn't matter if you are connected or not).
+
|%x ischan || Is a Channel || True, if channel %x is a channel you are on.
 
|-
 
|-
 
|%x isban %y || Is a ban || True, if ban address %x is a ban on channel %y. (taken from IBL)
 
|%x isban %y || Is a ban || True, if ban address %x is a ban on channel %y. (taken from IBL)
|-
 
|%x isquiet %y || Is a quiet ban || True, if ban address %x is a quiet ban on channel %y. (taken from IQL)
 
 
|}
 
|}
  
'''Note''': the operator ishelp is the same as the operator ishop, and the operator isvo is the same as the operator isvoice
+
Example:
  
Example:
 
 
<syntaxhighlight lang="mirc">alias example4 {
 
<syntaxhighlight lang="mirc">alias example4 {
 
   ;am I on #mIRC
 
   ;am I on #mIRC
Line 214: Line 159:
  
 
== List-related Operators ==
 
== List-related Operators ==
mIRC has 5 additional operators to check mIRC internal lists:
+
mIRC has 5 additional operators to check mIRC internal lists.
  
{| class="wikitable"
+
{| class="wikitable" style="float: right"  
 
! Syntax !! Name !! Result
 
! Syntax !! Name !! Result
 
|-
 
|-
Line 223: Line 168:
 
|%x isavoice<br />%x isavoice %y || In Auto-Voice List<br />In Auto-Voice List For Chan || True, if host %x is in the auto-voice list.<br /> True, if host %x is in the auto-voice list for channel %y.
 
|%x isavoice<br />%x isavoice %y || In Auto-Voice List<br />In Auto-Voice List For Chan || True, if host %x is in the auto-voice list.<br /> True, if host %x is in the auto-voice list for channel %y.
 
|-
 
|-
|%x isignore<br />%x isignore %y || In Ignore List<br />In Ignore List For Type || True, if host %x is in the ignore list.<br />True, if host %x is in the ignore list for type %y.
+
| %x isignore<br />%x isignore %y || In Ignore List<br />In Ignore List For Type || True, if host %x is in the ignore list.<br />True, if host %x is in the ignore list for type %y.
 
|-
 
|-
|%x isprotect<br />%x isprotect %y || In Protect List<br />In Protect List For Chan || True, if host %x is in the protect list.<br />True, if host %x is in the protect list for channel %y.
+
%x isprotect<br />%x isprotect %y || In Protect List<br />In Protect List For Chan || True, if host %x is in the protect list.<br />True, if host %x is in the protect list for channel %y.
 
|-
 
|-
 
|%x isnotify || In Notify List || True, if host %x is in the notify list.
 
|%x isnotify || In Notify List || True, if host %x is in the notify list.
 
|}
 
|}
 
'''Note''': the operator isauto is the same as the operator isaop.
 
  
 
Example:
 
Example:
Line 242: Line 185:
 
}</syntaxhighlight>
 
}</syntaxhighlight>
  
[[Category:mIRC|operators]]
+
[[Category:mIRC]]

Please note that all contributions to WikiChip may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see WikiChip:Copyrights for details). Do not submit copyrighted work without permission!

Cancel | Editing help (opens in new window)