mIRC Scripting
mIRC: Operators
Comparison Operators:
Comparison operators are used to compare two values in an /if statement.
| Operator | Description | Example (all $TRUE) |
|---|---|---|
| == | equal to | if (2 == 2) { |
| === | case-sensitive equal to | if (tEsT === tEsT) { |
| != | not equal to | if (2 != 3) { |
| < | less than | if (2 < 5) { |
| > | greater than | if (9 > 2) { |
| >= | greater than or equal to | if (8 >= 5) { |
| <= | less than or equal to | if (5 <= 5) { |
| // | is a multiple of | if (3 // 6) { |
| \\ | is not a multiple of | if (2 \\ 3) { |
| & | bitwise comparison | if (7 & 1) { |
Strings
isin / isincs
String v1 is in string v2. isincs is the case sensitive version of isin.
if (v1 isincs v2) {
Example:
if (there isin Hi there!) {
iswm / iswmcs
Wild string v1 matches string v2. Iswmcs is the case sensitive version of iswm.
* - any character zero or more times
? - any single character
if (v1 iswmcs v2) {
Example:
if (H?llo iswm Hello) {
isnum
Number v1 is a number in the range n2. n2 can be a single number, from n2 and up (n2-), or a range of numbers n1-n2.
if (v1 isnum n1) {
if (v1 isnum n1-) {
if (v1 isnum n1-v2) {
Example:
if (10 isnum 10) {
if (102 isnum 10-) {
if (3 isnum 1-99) {
isletter
Number v1 is a letter. v2 can be a list of letters. This operator IS case sensitive. This operator only checks the first letter of a string.
if (v1 isletter v2) {
Example:
if (c isletter abcABC) {
if (aGGGG isletter a) {
isalpha
V1 is made up of only letters.
Example:
isalnum
V1 is made up of only letters and numbers.
Example:
islower
V1 is made up of only lower case letters.
Example:
isupper
V1 is made up of only upper case letters.
Example:
IRC Related Operators:
ison
Nick ison Channel #Chan.
Example:
isreg
Nick is a regular user on #Chan.
Example:
isvoice
Nick is a voice in #Chan .
Example:
if (foo isvoice #bar) {
ishop
Nick is help-operator in #Chan.
Example:
if (Dave03 ishop #Help) {
isop
Nick is an operator in #Chan.
Example:
if (Mike isop #mIRC) {
ischan
#Chan is a channel which you are on
Example:
Arithmetic Operators:
| Operator | Description | Example | Return |
|---|---|---|---|
| + | Subtraction | $calc(3 + 3) | 6 |
| - | Subtraction | $calc(11 - 3) | 8 |
| / | Division | $calc(21 / 7) | 3 |
| * | Multiplication | $calc(5 * 5) | 25 |
| % | Modulus | $calc(11 % 3) | 2 |
| ^ | Exponents | $calc(5 ^ 2) | 25 |
Please Note:
Spaces in the $calc are not needed, 1+1 will be the same as 1 + 1. The calc identifier supports multiple parentheses to change order of operations, For example: $calc( (2 + 2) * 2 ) = 8 and $calc( 2 + 2 * 2 ) = 6. When using variables, operators can be placed without a space before the % sign. For example: $calc(1-%a +%b).
One operator arithmetic problem can be set to a variable without the calc identifier:
var %add 2 + 2
var %add %add + 2
return %add
; 6
}
Assignment Operators:
mIRC offers just one way to set a variable (other than commands) using the equals sign (“=”).
Logical Operators:
Logical operators are used to compare multiple conditions together.
| Operator | Description |
|---|---|
| || | OR |
| && | AND |
if (2 < 4) && (6 > 2) echo -a Yes 2 > 4 AND 6 > 2!
if (2 < 4) || (6 > 222222) echo -a 2 < 4, But I Don't Think 6 is more then 222222!
}

