Skip to content

Math

Creates a Math object which gives allows access to the math type members.

Forms

math Math

Returns the math object which is used to perform math operations.

Associated DataTypes

math

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

Members

float Abs[n]

The absolute value of the result of n

float Acos[n]

Arccosine of n (in degrees)

float Asin[n]

Arcsine of n (in degrees)

float Atan[n]

Arctangent of n (in degrees)

float Calc[n]

Performs a mathematical calculation n

int Clamp[n, min, max]

Clamps the value n such that min _<= _n <= max

float Cos[n]

Cosine of n (in degrees)

int Dec[hex]

Decimal value of a hexidecimal string

float 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

string Hex[n]

Returns hexidecimal value of int n

int Not[n]

Bitwise complement of n

int Rand[n]

Random integer. Rand[5] range 0 to 4. Rand[100,200] range 100 to 199

float Sin[n]

Sine of n (in degrees)

float Sqrt[n]

Square root of n

float Tan[n]

Tangent of n (in degrees)

Usage

/echo ${Math.Calc[3-1]}

Echoes 2.00

/echo ${Math.Calc[49%6+25]}

Echoes the result of 49 modulo 6 + 25, or 1 + 25

/echo ${Math.Sqrt[49]}

Echoes the square root of 49

/echo ${Math.Rand[500]}

Echoes a random number between 1 and 500

Math.Rand now takes an optional min argument so you can get a random number between 2 variables.

/echo ${Math.Rand[5,10]}

this would return a randum number between 5 and 10.