Skip to main content

Units

This page describes all functions and operations available for units

Usage

Most basic unit is plain number, such as '1' or '4.5'. You can use variables with $ like '$example'. Each function requires name parenthesis and comma separated arguments e.g. 'min(PI, $example)'. You can combine as many as you want, e.g. 'min(PI, 10 + $example)'. You can do pretty complex infix, e.g. 'atan2($mouseY, $mouseX) - HALF_PI - HALF_PI / 22'.

Constants
  • true - boolean true value, equal to 1.0
  • false - boolean false value, equal to 0.0
  • PI - number equal to 3.14159265358979323846
  • HALF_PI - number equal to 1.57079632679
  • TWO_PI - number equal to 6.28318530718
  • E - number equal to 2.7182818284590452354
Operations
  • cond ? a : b = TERNARY, if cond then a, else b
  • -a = NEGATE
  • a + b = SUM
  • a - b = SUB
  • a * b = MUL
  • a / b = DIV
  • a % b = MOD
  • a ** b = POW
  • a & b = BIT AND
  • a | b = BIT OR
  • a ^ b = BIT/BOOL XOR
  • ~a = BIT NOT
  • !a = BOOL NOT
  • a << b = SHIFT LEFT
  • a >> b = SHIFT RIGHT
  • a == b = EQUALS
  • a != b = NOT EQUALS
  • a > b = GREATER THAN
  • a < b = LESS THAN
  • a >= b = GREATER OR EQUAL THAN
  • a <= b = LESS OR EQUAL THAN
Functions
  • random()
  • time()
  • roundTime()
  • min(a, b)
  • max(a, b)
  • pow(a, b)
  • abs(a)
  • sin(a)
  • cos(a)
  • tan(a)
  • atan(a)
  • atan2(y, x)
  • deg(a)
  • rad(a)
  • log(a)
  • log10(a)
  • log1p(a)
  • sqrt(a)
  • sq(a)
  • floor(a)
  • ceil(a)
  • if(statement, trueUnit, falseUnit)