🧩 Variables
Variables in ZeroTrace allow you to store and reuse values, making your scripts more dynamic and organized.
Variables can contain:
- Static values (like
true,admin,1234) - Operators (dynamic data, e.g., random numbers)
- States (system states, e.g., CapsLock on/off)
📝 Variable Syntax Rules
- Declaration always starts with
_$VAR - Assignment uses
=and requires quotes around the value - Usage inside strings requires the syntax:
${variable}$ - Dynamic Content: Variables can hold operators (
_$random()) or states (_@capslockState)
Valid Usage:
# Static value
_$VAR isAdmin = "true"
writeLn "${isAdmin}$"# Operator inside variable
_$VAR delayTime = "_$random(500, 1500)"
delay "${delayTime}$"# State inside variable
_$VAR capsStatus = "_@capslockState"
writeLn "${capsStatus}$"Invalid Usage:
# Missing quotes around value
_$VAR username = admin# Referencing without ${}$
writeLn "$isAdmin"# Using variable without declaration
writeLn "${undefinedVar}$"🎯 Accessing Variable Values
When you use a variable inside a string ("${variable}$"), it will:
- Check global variables for a match.
- If the value contains an operator (
_$), it will execute it dynamically. - If the value contains a state (
_@), it will check the actual device/system state.
🔄 Supported States
Usage inside/between strings are not supported.
| State | Description | Output |
|---|---|---|
_@capslockState | CapsLock state | ON / OFF |
_@numlockState | NumLock state | ON / OFF |
_@scrolllockState | ScrollLock state | ON / OFF |
_@usbState | USB connection state | ON / OFF |
_@detectedOS | Detected operating system | Windows / Linux / macOS / iOS / Android / Unknown OS / OS Detection Disabled / Waiting... |
Valid Usage:
_$VAR capsStatus = "_@capslockState"
writeLn "${capsStatus}$"Unsupported Usage:
_$VAR capsStatus = "_@capslockState"
writeLn "Capslock Status is ${capsStatus}$"🧩 Practical Examples
Dynamic Delay
_$VAR delayTime = "_$random(500, 1500)"
delay "${delayTime}$"Device State Check
_$VAR usbStatus = "_@usbState"
writeLn "USB is: ${usbStatus}$"Combining Operators and Text
_$VAR username = "_$random(1, 100)"
writeLn "Generated user: ${username}$"You can nest operators and states inside variables to create powerful dynamic scripts!
Important: Variables must have their values wrapped in quotes, and referenced with the correct syntax.