Math Expressions

Zooper Widget Mathematical expressions can be used both inside conditionals or in the “then” / “else” statements, so all these statements are valid:
$(3*2)$ will write 6
$(1>0)?(3*2)$ will write 6 is 1 > 0
$(3*2 > 4)?Yes!:No$ will write Yes if “3*2″ is greater than 4 (so yes, it will write yes!)
$(int(#Dm#/10) = 3 || int(#Dm#/10) = 5)? It's thirty something or fifty something$ will write “It’s thirty something or fifty something” when minute is between 30 and 39 OR 50 and 59 (so #Dm# is current minute, we divide by 10 and then we take the integer part, so, for example if #Dm# is 39 -> 39/10 = 3.9 -> int(3.9) -> 3 and 3 = 3)

Below is a complete reference of current accepted constants, operators and functions. Please note that all “widget” constants (like “xo”) will result in the offset as set in the preference, not the one you set in the advanced parameters (to avoid loops). Please also check this forum post for some examples from other users.

Constants:
e: Base of natural algorithms (2.71828)
pi: Ratio of the circumference of a circle to its diameter (3.14159265359)
xo: current module X Offset as set in the preferences
yo: current module Y Offset as set in the preferences

Operators:
+: Addition
-: Subtraction
-: Unary minus
*: Multiplication
/: Division
^: Exponentiation
%: Modulo

Functions:
abs: absolute value
acos: arc cosine
asin: arc sine
atan: arc tangent
average: average of arguments
ceil: nearest upper integer
cos: cosine
cosh: hyperbolic cosine
floor: nearest lower integer
ln: natural logarithm (base e)
log: base 10 logarithm
max: maximum of arguments
min: minimum of arguments
round: nearest integer
int: same as round
sin: sine
sinh: hyperbolic sine
sum: sum of arguments
tan: tangent
tanh: hyperbolic tangent
random: pseudo-random number (between 0 and 1)

Feedback and Knowledge Base