🔢 Operators
ZeroTrace supports dynamic operators (prefixed with _$) and variables that can work together to create flexible, dynamic scripts.
📝 Operator Syntax Rules
- Standalone or in variables - Can be used directly or assigned to variables
- Always starts with
_$- Identifies it as an operator - Parentheses enclose arguments - Required even for no-argument operators
- Case-sensitive names - Must match exactly as documented
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 string
writeLn _$Random(1,100) # Incorrect case🔢 Available Operators
Random Number Generation
_$random(from, to) # Random integer between from and toExample:
Input: _&random(1, 10)
Output: 7 (random number between 1 and 10)
_$random_number() # Random digit (0-9)Example:
Input: _&random_number()
Output: 3
String Operations
_$uppercase(string)Example:
Input: _&uppercase('admin')
Output: ADMIN
_$lowercase(string)Example:
Input: _&lowercase('Admin')
Output: admin
_$reverse(string)Example:
Input: _&reverse('admin')
Output: nimda
_$length(string)Example:
Input: _&length('admin')
Output: 5
_$concat(str1, str2)Example:
Input: _&concat('user', '01')
Output: user01
_$substring(str, start, len)Example:
Input: _&substring('password', 0, 4)
Output: pass
_$replace(str, target, repl)Example:
Input: _&replace('admin123', '123', '456')
Output: admin456
Random Character Generation
_$random_lowercase_letter(1)Example:
Output: g
_$random_uppercase_letter(1)Example:
Output: K
_$random_letter(1)Example:
Output: R or h
_$random_special(1)Example:
Output: ! or #
_$random_char(1)Example:
Output: 4 or @ or q
🧩 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 create dynamic, adaptable scripts that change behavior each run!
Important: When using operators in variables:
- Wrap the operator in quotes for assignment
- Use
${variable}$syntax when referencing - Operators still can't be embedded in normal strings
- ❗ You cannot nest random operators inside each other.
For example:
_&random(1, _&random(2,5))is invalid. Always use separate variables instead.