Text and Number Identifiers

 

$abs(N)

Returns the absolute value of number N.

 

$abs(5)   returns 5

$abs(-1)  returns 1

 

$and(A,B)

Returns A binary and B.

 

$asc(C)

Returns the ascii number of the character C.

 

$asc(A)  returns 65

$asc(*)   returns 42

 

$base(N,inbase,outbase,zeropad,precision)

Converts number N from inbase to outbase. The last two parameters are optional.

 

$base(15,10,16)        returns F

$base(1.5,10,16)        returns 1.8

$base(2,10,16,3)        returns 002

 

$biton(A,N)

Returns the A value with the Nth bit turned on.

 

$bitoff(A,N)

Returns the A value with the Nth bit turned off.

 

$bytes(N,bkmpgt3d)

Returns comma formatted file-size.

 

Properties: suf

 

The bkmgt options return the result as bytes, kilobytes, etc.

 

The 3 option returns a result in 3 digit format and overrides the other options.

 

The d option retains decimal point values.

 

The .suf property appends the b, k, M, G, T suffixes to the result.

 

$calc(operations)

Returns the result of the specified operations. This identifiers allows you to perform multiple operations easily. For example:

 

$calc(3.14159 * (2 ^ %x % 3) - ($ticks / (10000 + 1)))

 

$cbrt(N)

Returns the cube root of N.

 

$ceil(N)

Returns N rounded to the next highest integer.

 

$chr(N)

Returns the character with ascii number N.

 

$chr(65)  returns A

$chr(42)  returns *

 

$compress(file|&bvar, blNmN)

$decompress(file|&bvar)

Compresses the specified file or binary variable. Returns 1 for success, 0 for failure.

 

The b option indicates that the first parameter is a binary variable.

The lN option sets a compression level of 1 to 9 (default is 6).

The mN option sets the compression method, where N = 1 is raw, N = 2 is zlib (the default), and N = 3 is gzip.

 

$cos(N), $cosh(N), $acos(N)

Return the cosine, hyperbolic cosine, and arccosine of N.

 

Properties: deg

 

$count(string,substring,substring2,...,substringN)

Returns the number of times substring occurs in string.

 

$count(hello,el)  returns 1

$count(hello,l)    returns 2

 

Note: $countcs() is the case-sensitive version.

 

$encode(%var | &binvar, amubtx, N)

$decode(%var | &binvar, amubtx, N)

Encode or decode text in %vars or &binvars.

 

The second parameter consists of switches, where a = base32, m = mime, u = uucode (default), v = z85, b = &binvar, t = text (default), and x = percent-encode all characters except "unreserved" as defined in RFC3986.

 

If encoding/decoding a &binvar, the identifiers return the actual number of characters written to the &binvar. Note that encoding uses more storage space than the original data.

 

The last two parameters are optional, default to uuencode, and N = 1.

 

If you want to retrieve the result in chunks, you can use the N parameter to retrieve the Nth encoded chunk. N = 0 returns the total number of chunks. This only applies when encoding. When decoding, one line of combined chunks must be decoded at once, so N = 0 always return 1.

 

These identifiers also support blowfish encryption. The identifier format is:

 

$encode(%var | &binvar, switches, key, [salt | iv])

$decode(%var | &binvar, switches, key, [salt | iv])

 

Where the switches are:

 method: c = cbc or e = ecb encryption (one or the other)

 key: l = literal key (optional)

 salt/iv: s = salt or i = iv or r = randomiv (all optional)

 padding: z = zeros, n = one and zeros, p = spaces (all optional)

 

$floor(N)

Returns N rounded to the next lowest integer.

 

$gcd(N,N2,...)

Returns the greatest common divisor of a list of numbers.

 

$hypot(N,M)

Returns the length of the hypotenuse.

 

$int(N)

Returns the integer part of a floating point number with no rounding.

 

$int(3.14159)  returns 3

 

$intersect(x1,y1,x2,y2,x3,y3,x4,y4,method)

Returns the point at which two lines/rays intersect.

 

The method parameter is optional. If not specified, two lines are compared. If specified, it can be lr, rl, rr = line/ray, ray/line, ray/ray.

 

$isbit(A,N)

Returns 1 if the Nth bit in number A is turned on.

 

$islower(text)

Returns $true if text is all lower case.

 

$isnum(N,sd,I,J)

Returns $true if N is a number, where s = allow +/- sign, d = allow decimal, and range is between I and J.

 

The switches and range parameters are optional.

 

$isupper(text)

Returns $true if text is all upper case.

 

$lcm(N,N2,...)

Returns the least common multiple of a list of numbers.

 

$left(text,N)

Returns the N left characters of text.

 

$left(goodbye,4)  returns good

 

If N is a negative value, it returns all but N characters.

 

$len(text)

Returns the length of text.

 

$len(#mIRC)  returns 5

 

$log(N), $log2(N), $log10(N)

Returns logarithms of N.

 

$longip(address)

Converts an IP address into a long value and vice-versa.

 

$longip(158.152.50.239)  returns 2660774639

$longip(2660774639)       returns 158.152.50.239

 

$lower(text)

Returns text in lowercase.

 

$lower(HELLO)  returns hello

 

$mid(text,S,N)

Returns N characters starting at position S in text.

 

$mid(othello,3,4)  returns hell

 

If N is zero, it returns the number of characters from S to the end of the line.

 

You may also use negative numbers for S or N.

 

$min(N)/$max(N)

Return minimum/maximum of a list of values. Defaults to numbers.

 

Properties: .alpha, .alphacs, .alnum, .alnumcs, .nick.

 

If a single parameter is used, it is treated as a space-delimited list of values.

 

If two or more parameters are used, each is treated as a separate value.

 

$not(A)

Returns the binary not value of A.

 

$or(A,B)

Returns A binary or B.

 

$ord(N)

Appends st, nd, rd, th as appropriate to the number N.

 

$pi

Returns the value of the mathematical constant pi to 20 decimal places.

 

$pos(text,string,N)

Returns a number indicating the position of the Nth occurrence of string in text.

 

$pos(hello there,e,1)  returns 2

$pos(hello there,e,2)  returns 9

$pos(hello there,a,1)  returns $null

 

If N is zero, it returns the number of times string appears in text.

 

Note: You can use $poscs() for a case-sensitive version.

 

$powmod(B,E,M), $modinv(B,M)

Returns the modular exponentiation, and inverse, of the base, exponent, and modulus.

 

$qt(text)

$noqt(text)

Add/remove outer enclosing quotes around text.

 

$rand(v1,v2)

This works in two ways. If you supply it with numbers for v1 and v2, it returns a random number between v1 and v2. If you supply it with letters, it returns a random letter between letters v1 and v2.

 

$rand(a,z)   returns a letter in the range a,b,c,...,z

$rand(A,Z)  returns a letter in the range A,B,C,...,Z

$rand(0,N)  returns a number in the range 0,1,2,...,N

 

Note: You can use $rands() for a cryptographically secure random number.

 

$remove(string,substring,...)

Removes any occurrence of substring in string.

 

$remove(abcdefg,cd)  returns abefg

 

You can also specify multiple remove parameters:

 

$remove(abcdefg,a,c,e,g)  returns bdf

 

Note: You can use $removecs() for a case-sensitive version.

 

$replace(string,substring,newstring,...)

Replaces any occurrence of substring in string with newstring.

 

$replace(abcdefg,cd,xyz)  returns abxyzefg

 

You can also specify multiple replace parameters:

 

$replace(abcdefg,a,A,b,B,c,C,d,D)  returns ABCDefg

 

Note: You can use $replacecs() for a case-sensitive version.

 

$replacex(string,substring,newstring,...)

Replaces any occurrence of substring in string with newstring except for replacements that have already been made.

 

Note: You can use $replacexcs() for a case-sensitive version.

 

$right(text,N)

Returns the N right characters of text.

 

$right(othello,5)  returns hello

 

If N is a negative value, it returns all but N characters.

 

$round(N,D)

Returns the specified floating point number rounded to the Dth decimal digit.

 

$round(3.14159,2)  returns 3.14

 

The D parameter is optional.

 

$sin(N), $sinh(N), $asin(N)

Return the sine, hyperbolic sine, and arcsine of N.

 

Properties: deg

 

$sqrt(N)

Returns the square root of N.

 

$str(text,N)

Returns text repeated N times.

 

$str(ho,3)  returns hohoho

 

$strip(text,buriecmo)

Returns text with bold, underline, reverse, italic, strikethrough, and color control codes stripped out.

 

The second parameter is optional, if used, it strips only the specified types of characters.

 

The m applies the strip settings in the Messages dialog, and the o applies the "only if..." settings in the messages dialog.

 

$stripped

Returns the number of control codes that were stripped from an incoming message, if any. This can be used in any script event that triggers when a message is received from a user.

 

$tan(N), $tanh(N), $atan(N), $atan2(N,M)

Return the tangent, hyperbolic tangent, and arctangent of N, and the arctangent of N/M.

 

Properties: deg

 

$upper(text)

Returns text in uppercase.

 

$upper(hello)  returns HELLO

 

$utfencode/$utfdecode(text)

Returns text UTF-8 encoded or decoded.

 

$wrap(text, font, size, width, biptw, N)

Returns Nth line in text wrapped to the specified width in pixels.

 

Where biptw set the options for bold, italic, process control codes, process tabs, and use word wrap. Each of these can be followed by an N value of zero or one to indicate whether they are disabled or enabled respectively.

 

You can specify 0 for N to return the total number of wrapped lines.

 

$xor(A,B)

Returns A binary xor B.