- Home
- Docs
- ZeroTrace HID
- Operators
ZeroTrace HID
Operators
ZeroTrace supports dynamic operators (prefixed with _$) and variables.
Operator Syntax Rules
- Standalone or in variables: can be used directly or assigned to variables.
- Always starts with
_$: identifies the token as an operator. - Parentheses required: arguments must be inside
(...)even for no-argument operators. - Case-sensitive names: operator names must match exactly.
Valid Usage
# Direct usage
writeLn _$random(1,100)
# Variable assignment
_$VAR randomNum = "_$random(1,100)"
writeLn "${randomNum}$"
Invalid Usage
writeLn "Value: _$random(1,100)" # Embedded in a normal string
writeLn _$Random(1,100) # Incorrect case
Available Operators
Random Number Generation
_$random(from, to) # Random integer between from and to
Example:
Input: _$random(1, 10)
Output: 7
_$random_number() # Random digit (0-9)
Example:
Input: _$random_number()
Output: 3
Practical Examples
Dynamic Configuration
_$VAR ledR = "_$random(0,255)"
_$VAR ledG = "_$random(0,255)"
_$VAR ledB = "_$random(0,255)"
ledColor "${ledR}$" "${ledG}$" "${ledB}$"
or
ledColor _$random(0,255) _$random(0,255) _$random(0,255)
Pro tip: Combine variables and operators to generate dynamic values each run.
Important:
- Wrap operator expressions in quotes when assigning to variables.
- Reference variables with
${variable}$. - Do not embed operators in normal string literals.
- Nested random operators are not supported. Example:
_$random(1, _$random(2,5))is invalid.