ZeroTrace HID
Operators
The 14 dynamic value generators — random data and string manipulation
Operators are _$-prefixed expressions that produce a value each time they run — random data, or a transform of another string. There are 14 of them.
Syntax rules
- Always starts with
_$— this marks the token as an operator. - Parentheses are required — arguments go inside
(...), even where a count defaults. - Names are case-sensitive —
_$randomworks,_$Randomdoes not. - Use directly as an argument, or assign to a variable.
# Direct usage
writeLn _$random(1,100)
# Assigned to a variable
_$VAR randomNum = "_$random(1,100)"
writeLn "${randomNum}$"
An operator is only evaluated when it is the argument itself — it is not expanded when buried inside a normal string literal (writeLn "Value: _$random(1,100)" types the literal text). To combine an operator with surrounding text, assign it to a variable and reference that variable.
Available operators
_$random(from, to) — a random integer between from and to (inclusive). If to is below from the bounds are swapped automatically.
_$random(1, 10) # e.g. 7
Nesting
Operators nest — arguments are evaluated recursively, innermost first.
_$random(1, _$random(2, 5)) # inner operator resolves before the outer one
Practical example
Generate a fresh random LED color each run:
_$VAR ledR = "_$random(0,255)"
_$VAR ledG = "_$random(0,255)"
_$VAR ledB = "_$random(0,255)"
ledColor "${ledR}$" "${ledG}$" "${ledB}$"
or inline:
ledColor _$random(0,255) _$random(0,255) _$random(0,255)
Wrap an operator in quotes when assigning it to a variable, reference variables with ${name}$, and don't embed operators inside normal string literals.