loading

Text Field Expressions

Many modules allow for [variable] to be used in place of static numbers. This flexibility allows for either use of standard numbers or variables in a fields that can be used either way. The most recent release allows for full expressions to now be specified in addition to just variables. Prior to this release you could have used the VBScript module to provide for simple calculations. However, using the [variable] expression is quicker and easier to update. For example, you can now specify [(120-COG_X)+10] in text fields whereas before only [COG_X] was understood.

For variables that are arrays you can access individual elements in the array using the following syntax

[variable:0]
[variable:1]
[variable:2]
etc.

The following are the understood expression syntax:

  • "" - specifies a string
  • '' - specifies a string
  • [] - evaluates variable within
  • * - multiplication
  • / - division
  • % - modulus
  • + - addition
  • - - subtraction
  • << - bit shift left
  • >> - bit shift right
  • < - less than
  • <= - less than or equal to
  • > - greater than
  • >= - greater than or equal to
  • == - equal to
  • != - not equal to
  • & - bitwise and
  • | - bitwise or
  • ^ - bitwise xor
  • && - boolean conjunction
  • || - boolean disjunction
  • - - unary negation
  • ! - boolean not
  • pow(x,y) - power
  • abs(x) - absolute value
  • sqrt(x) - square root
  • exp(x) - e**x exponentiation
  • cstr(x) - convert expression to a string
  • cint(x) - convert expression to an integer
  • cflt(x) - convert experssion to a floating point
  • sin(x)
  • cos(x)
  • tan(x)
  • asin(x) - arcsin
  • acos(x) - arccosine
  • atan(x) - arctangent
  • ln(x) natural log
  • log(x) or log10(x) - log base 10
  • log2(x) - log base 2
  • floor(x) - floor or integer value of x
  • ceil(x) - ceiling of x
  • max(x,y) - returns the maximum of x or y
  • min(x,y) - returns the minimum of x or y
  • maxArray(x) - returns the maximum of the array x
  • minArray(x) - returns the minimum of the array x
  • round(x) - round of x
  • random(x) - random number from 0 to x
  • pixel(x,y) - returns the pixel color at the specified location (red|(green<<8)|(blue<<16))
  • rpixel(x,y) - returns the red pixel color of the current image at the specified location
  • gpixel(x,y) - returns the green pixel color of the current image at the specified location
  • bpixel(x,y) - returns the blue pixel color of the current image at the specified location
  • ? - Conditional operator (comparison) ? (result if true) : (result if false)
  • () - Precedence parentheses can be used to alter precedence

Examples:

	[my_variables_value]
  [3*(5+10/2)]
  [(3*5)+(10/2)]
  [3*5+pow(10,2)/2]
  [3*5+10/2]
  [(1?3:(5+3))+1]
  [COG_X>100?100:COG_X]
  [(10 + (55.78 * 30.55))/4]
  [5.54<=55.54]
  [55.54!=55.54]
  [255&8]
  [6^4]
  [!5]
  [pow(10,2)]
  [exp(1)]
  [tan(0.75)]
  [asin(0.84147098)]
  [acos(0.540302)]
  [atan(1.55740772)]
  [ln(8)]
  [log(100)]
  [log2(32)]
  [floor(5.88)]
  [ceil(5.01)]
  [round(5.01)]
  [round(5.51)]
  ["hello"+"world"]