From the wonderful RedGuides Wiki

This DataType performs various mathematical calculations. In the following members, n is any formula that consists of valid Operators.

This Data Type is referenced in MacroQuest, and accessed by Top-Level Object(s): Math


Type Member Description
float Abs[n] The absolute value of the result of n
Acos[n] Arccosine of n (in degrees)
Asin[n] Arcsine of n (in degrees)
Atan[n] Arctangent of n (in degrees)
Calc[n] Performs a mathematical calculation n
Cos[n] Cosine of n (in degrees)
Distance[y,x,z:y,x,z] Calculates the distance between two points on the map. 1, 2, or 3 dimensions may be provided. Defaults to your character's current location
Sin[n] Sine of n (in degrees)
Sqrt[n] Square root of n
Tan[n] Tangent of n (in degrees)
int Clamp[n, min, max] Will clamp the value n between min and max
Dec[hex] Decimal value of a hexidecimal string
Not[n] Bitwise complement of n
Rand[n] Random integer. Rand[5] range 0 to 4. Rand[100,200] range 100 to 199
string Hex[n] Returns hexidecimal value of int n


  • An example of using clamp. This will make your ranger stay put if he is already between 25-150 meters away, otherwise it will move him at most 150 away and at least 25 away.

/bct ranger //stick id ${Target.ID} ${Math.Clamp[${Target.Distance},25,150]}

See also