A trigger can have a return value. This trigger will return the square of the first parameter:
ON square RETURN ($0 * $0)
To call this function put an asterisk in front of the triggername. For example:
SET a (*square 7)
will set a to 49.
Self defined functions should always be surrounded with parentheses. For example:
SET a (*square (*square 7))
will return (7*7)*(7*7) = 2401.
SIN and COS are floating point operations, but BS2 doesn't have floating point variables, so you have to multiply the parameters by 1000 and devide the result by 1000. This way you get 3 decimal digits. For example “SET a (SIN 7000)” will set “a” to the sin 7 multiplied by 1000. So “a” will be 121. The real value for sin 7 would be 0,121869…
SET tutorialvar 7
will set tutorialvar to 7.
SET tutorialvar (7 * 7)
will set tutorialvar to 49.
SET tutorialvar (5 == 7)
will set tutorialvar to 0.
SET tutorialvar (5 == 5)
will set tutorialvar to 1.
SET tutorialvar (SIN 7000)
will set tutorialvar to sin(7) * 1000 = 121.