REAPER KB

operator_string` expression optional_expression

walter_themes/walter-expression-operator-string · kind=reference

operator_string expression optional_expression

A predicate or combinator applied to one or two child expressions, producing a value conditionally.

Kind: concept

If operator_string is specified, it can contain simple expressions, and allows you to either choose or combine the following expressions. The format of operator_string is one of the following (val1/val2 can be constant or scalar_value variables, see comment below) -- note the lack of spaces in the string:

Comparisons:
        val1<val2     --   if val1 is less than val2, use first expression, otherwise second
        val1>val2     --   if val1 is greater than val2 ...
        val1<=val2     --   if val1 is less than or equal to val2, use first expression, otherwise second
        val1>=val2     --   if val1 is greater than or equal to val2 ...
        val1==val2    --   if val1 equals val2 ...
        val1!=val2    --   if val1 does not equal val2 ...
        ?val1         --   if val1 is nonzero ...
        !val1         --   if val1 is zero ...
        val1&val2     --   bitwise AND (if any bit is set in both val1 and val2)

Combinators:
        +             --   sum first expression and second expression
        -             --   subtract second expression from first expression  (REAPER 5.0+)
        *             --   multiply first expression and second expression
        /             --   divide first expression by second expression (REAPER 5.0+)
        +:val1:val2   --   val1*(first expression) + val2*(second expression)
        *:val1:val2   --   ((first expression)+[val1 val1...])*((second expression)+[val2 val2...])

If optional_expression is not specified, then in its place will be the current value of the destination, which can also be abbreviated as "." -- so, for example, the following commands are all compiled to the same logic:

  set var w<100 [0]
  set var w<100 [0] .
  set var w<100 [0] var

Finally, you can extend expressions (which are often nested and thus quite long) over multiple lines by ending each line (except the last) with a backslash ("")(requires v4.25+).

Other sections in this document