On this page
Build vision-aware controller scripts with confidence.
This guide documents the Atlas scripting language in the current source snapshot: syntax, values and types, events, functions, value and reference semantics, built-in APIs, controller constants, validation rules, and reusable examples.
Source snapshot: this guide is published from the Atlas source repository before Atlas for Windows is publicly released. Signatures and behavior can change before release; release-pinned documentation ships with the signed release.
What an Atlas script does
An Atlas script connects video analysis and controller input to small, explicit output
changes. Video work belongs in on_frame. Controller reads and output changes
belong in on_input. Atlas preserves normal controller passthrough unless your
script overrides a value. A script can also capture network packets and inspect, edit, or
drop them in network events.
Observe
Configure native vision tools or ONNX models and read their latest targets once per video frame.
Decide
Store simple state in globals, functions, arrays, structs, and enums using familiar control flow.
Apply
Change only the buttons, sticks, triggers, feedback, touchpad, or motion values the script owns.
Your first complete script
This example records whether a color detector found a marker during the latest video frame, then mirrors that state to an output button when controller input arrives.
color markerColor = vision.color([0, 90, 80], [15, 255, 255]);
bool markerVisible = false;
event on_frame() {
markerVisible = markerColor.target != null;
}
event on_input() {
if (markerVisible) {
output.set_button("cross", true);
}
}
event on_stop() {
ui.clear();
}
on_frame updates vision state; on_input applies controller output
without coupling controller timing to the camera frame rate. When no marker is visible,
the script leaves Cross untouched so the physical button still passes through.
Execution model
- Load: Atlas parses, validates, compiles, and initializes global declarations.
- Start:
on_startruns once. - Connect:
on_connectruns once immediately afteron_startfor the active controller family; it is not redispatched when the family changes. - Process:
on_framereceives video work andon_inputreceives controller work. Afternetwork.capture(filter)starts capture,on_network_recvandon_network_sendreceive each matching packet. - Stop:
on_stopruns before Atlas clears controller output, feedback, and overlays and ends network capture. Global values remain allocated until the script is reloaded.
Where to go next
Language fundamentals
Learn every declaration form, value category, data type, operator, array, struct, enum, scope, and control-flow statement.
Functions and references
Understand copies, shared struct parameters, writable aliases, return values, and safe helper design.
Event lifecycle
See when every callback runs, including the network packet events, and which API families are valid in each execution context.
API reference
Search every documented object, method, button name, platform view, host constant, vision tool, and network capture and packet member.
Recipes and examples
Copy generic, portable scripts for controller output, timing, vision, overlays, models, network capture, and cleanup.
Diagnostics
Decode validation messages and learn the rules Atlas enforces before a script can run.
Core rules worth remembering
- Use
varfor general numeric values; removed spellings such asint,float, anddoubleare rejected. - Use qualified control-name constants such as
ps5.cross, or pass a quoted name such as"cross". Usecontroller.ps5only as a controller-family value. - Controller APIs belong in
on_input. Video and overlay APIs belong inon_frame. - Typed struct parameters are deep-copied by default. A
StructName &valueparameter shares member and nested-array mutations, but assigning a new struct only rebinds the callee's local parameter; see Functions and references. - A reference alias such as
var ref = &values[0];writes through to its original variable, field, or array element. packetbelongs directly inon_network_recvoron_network_send. Network capture is optional and needs WinDivert, which you install yourself, and administrator approval once per Run; see Network events.- Use
on_stopfor overlay and non-controller cleanup. Release controller output or feedback duringon_input; Atlas performs a final controller clear afteron_stop.