Expressions allow one to do computations in scripts or to retrieve numerical values. They use simple arithmetic to do the calculations, nothing too fancy. Anywhere that a number is usually accepted, an expression expansion can be used, even within an expansion!

The basic syntax:
$[ term op term ... op term ]

A term can be any of the following:
numericunsigned integer values
stringreferences integer variables, all other types default to 0
[ifcheck]calls a numeric ifcheck, botched ifcheck calls result in 0
Example: [vnum $n]
(expression)grouped by parenthesis, they are the result of sub expressions, such as (3+cnt)


!xboolean NOT
x : yrandom range from x to y
x / ydivision **
x % ymodulo **
x * ymultiplication
x + yaddition
x - ysubtraction
** NOTE: division or modulo by zero computes to zero for the entire expression.

Simple constant:

Referencing a variable:

Random Numbers:


Ifcheck calls:
$[[vnum $n]]
$[3*[tokenvalue $n 1234 0]]
$[[tokenvalue $n 1234 0]+[tokenvalue $n 1234 2]]

These calls can be nested too: (Remember, $[ ] can be used pretty much anywhere numbers can be used)
$[[dice $[[tokenvalue $n 1234 0]] $[[tokenvalue $n 1234 1]]]]

Back to Top