Browse docsOverview
On this page
Atlas scripting language

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.

7 events25 API objects163 methods41 recipes

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.

marker-button.atlas
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();
}
Why two events? Video and controller packets arrive independently. 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

  1. Load: Atlas parses, validates, compiles, and initializes global declarations.
  2. Start: on_start runs once.
  3. Connect: on_connect runs once immediately after on_start for the active controller family; it is not redispatched when the family changes.
  4. Process: on_frame receives video work and on_input receives controller work. After network.capture(filter) starts capture, on_network_recv and on_network_send receive each matching packet.
  5. Stop: on_stop runs 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 var for general numeric values; removed spellings such as int, float, and double are rejected.
  • Use qualified control-name constants such as ps5.cross, or pass a quoted name such as "cross". Use controller.ps5 only as a controller-family value.
  • Controller APIs belong in on_input. Video and overlay APIs belong in on_frame.
  • Typed struct parameters are deep-copied by default. A StructName &value parameter 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.
  • packet belongs directly in on_network_recv or on_network_send. Network capture is optional and needs WinDivert, which you install yourself, and administrator approval once per Run; see Network events.
  • Use on_stop for overlay and non-controller cleanup. Release controller output or feedback during on_input; Atlas performs a final controller clear after on_stop.
Atlas scripting documentation (source snapshot). Reference content is generated from the Atlas script API schema; the prose is written from the native parser, analyzer, compiler, and VM sources.