osq syntax

There are two main parts of the osq syntax: expressions and directives.

Expressions

Expression are mathematical. For example, "2 + 2" is an expression. "4 * a + f(cos(q * pi)) ^ 2" is an expression, too.

To call an expression, surround the expression with "${}" (excluding the quotes). For example:

You have ${num_cows} cow(s).
That's twice ${num_cows / 2} cow(s).

By default, all expressions use floating-point arithmetic. You aren't restricted to integers.

For more information on expressions and supported data types and operations, see the expressions page.

Directives

Directives manipulate blocks of text. They begin with # in the first column of a line.

The directives in osq are:

#def
Binds an identifier with some text.
#let
Binds an identifier with an evaluated text.
#for
Creates a C-style for loop.
#rep
Repeats a block of text a given number of times.
#each
Executes a block of text for each item in a list.
#if
Conditionally executes a block of text.
#include
Includes another osq script.
#local
Creates a local variable.

Documentation for each directive is linked above.