On this page
API Reference
Search every generated schema entry, then use the verified behavior notes on this page for exact ranges, defaults, passthrough rules, return values, host restrictions, and current compatibility limitations.
How to read this reference
on_input. See Events for the lexical restriction,
independent video/input schedules, and cleanup order.
Namespaces and availability
| Namespace or value | Availability | Purpose |
|---|---|---|
input, output |
Directly inside on_input |
Read the current physical packet and override selected output fields |
rumble, lightbar, platform feedback |
Directly inside on_input; Remote Play output only |
Controller feedback commands |
gyro, accel, ps5, ps4 |
Directly inside on_input |
Motion reads plus PlayStation-qualified controller-name constants and PlayStation feedback helpers |
xb |
Directly inside on_input |
The Xbox One and Xbox Series X|S layout: qualified control-name constants plus the Xbox rumble helpers |
vision, models, ui, font |
Any event or function; creation calls may also initialize globals. Vision reads and drawing normally belong in on_frame. |
Computer vision, model sources, and video overlays |
network |
Any event or function | Start and stop network capture and read its state |
packet |
Directly inside on_network_recv and on_network_send |
Read, edit, or drop the packet being decided |
math, string, system, type() |
Any event or function | General calculations, bit operations, formatting, logging, and runtime type inspection |
controller, host, cronuszen, rgb, type |
Any event or function | Terminal comparison and value constants |
frame, time_ms, system.width, system.height |
Any event or function | Runtime and latest-video metadata |
Console naming and API scope
xb for Xbox One and Xbox Series X|S. xb is the
one Xbox namespace: Atlas uses the same controller layout and Remote Play feedback route for
both consoles. The former xb1 and xbox spellings were removed. A
script that still uses them does not compile, and the diagnostic names the xb
replacement, for example xb1 was renamed to xb; use xb.rt. Neither
xb nor the removed names mean Xbox 360.
controller.xb360,
host.xb360, or cronuszen.xb360 to identify that family or protocol.
Atlas does not expose an xb360.* control-name or feedback namespace, so this
reference does not advertise Xbox 360-only functions that the runtime cannot perform.
An Xbox 360 pad, or any third-party XInput pad, connected to the PC reports
controller.xb, because Atlas reads every XInput pad as an Xbox controller.
input.controller never reports controller.xb360; only a Cronus
Zen on the Xbox 360 protocol reports cronuszen.xb360.
The console namespaces intentionally contain two kinds of members: qualified control-name
constants such as ps5.cross and xb.a, and callable feedback APIs
such as ps5.rumble or xb.rumble. The reference navigation keeps
those in separate groups so a name constant is not mistaken for a function.
Feedback by controller
Each console namespace offers only the feedback its controller physically has. A DualSense has every feedback family, a DualShock 4 has rumble and a light bar, and an Xbox controller has rumble only.
| Namespace | Controller | Rumble | Light bar | Player LEDs and player number | Adaptive triggers |
|---|---|---|---|---|---|
ps5 | DualSense | Yes | Yes | Yes | Registered, but the VM does not implement them yet |
ps4 | DualShock 4 | Yes | Yes | No | No |
xb | Xbox One, Xbox Series X|S | Yes | No | No | No |
ps5:rumble,set_rumble,rumble.*,lightbar,set_lightbar,reset_lightbar,lightbar.*,player_led,set_player_led,player_number,set_player_number,player,player.*, the trigger-effect helpers,adt,adt.*, andclear_feedback.ps4:rumble,set_rumble,rumble.*,lightbar,set_lightbar,reset_lightbar,lightbar.*, andclear_feedback. A DualShock 4 has no player LEDs or player number and no adaptive triggers.xb:rumble,set_rumble,rumble.*, andclear_feedback. Xbox controllers have no light bar, no player LEDs or player number, and no adaptive triggers.
Only the namespaced calls are checked. A console namespace call for feedback its controller
lacks does not compile, and the diagnostic atlas.unsupported_feedback names
what is missing, for example
Xbox controllers have no light bar, so xb.set_lightbar is not available; xb feedback is rumble only.
The output.* feedback calls, such as output.set_lightbar and
output.set_player_led, and the shared rumble.* and
lightbar.* shortcuts are not tied to a console, so they compile for any target.
Atlas sends script feedback to the local controller the user holds, not to the console, so
the local controller's hardware decides what shows. With Xbox Remote Play and a DualSense in
hand, output.set_lightbar lights the DualSense's light bar; with an Xbox pad in
hand, the same call shows nothing because the pad has no light bar.
event on_input() {
if (input.controller == controller.xb && input.get(xb.rt) > 80) {
xb.rumble(60, 30);
} else {
xb.rumble.clear();
}
}
Controller input
input represents the current physical packet. Edge helpers compare this packet
with the preceding packet, not with the video-frame rate.
| Member | Returns | Behavior |
|---|---|---|
input.get(control) | var | Current numeric value: digital buttons are 0 or 100; triggers are live pressure from 0 to 100. |
input.pressed(button) | bool | True for the packet where a button changes up to down. A trigger edge is 0 to greater than 0. |
input.held(button) | bool | True while a button is down or a named trigger is greater than 0. |
input.released(button) | bool | True for the packet where a button changes down to up. A trigger edge is greater than 0 to 0. |
input.trigger(trigger) | var | Specialized trigger-pressure reader from 0 to 100; retained alongside the unified input.get. |
input.left_x, left_y, right_x, right_y | var | Live stick percentage, approximately -100 to 100. |
input.controller | string | Current family; compare with controller.*. |
input.time | var | Smoothed input packet interval in milliseconds. It is 0 initially and may be read outside on_input. |
gyro.available, gyro.x/y/z | bool, var | Motion capability and latest gyro values. |
accel.available, accel.x/y/z | bool, var | Motion capability and latest accelerometer values. |
input.get(ps5.touchpad), but
input.touchpad[0] does not return a touch point, and
input.capabilities currently evaluates to null. Use
gyro.available and accel.available for the motion capability that is
implemented.
event on_input() {
if (input.pressed("options")) {
system.log("Options pressed");
}
if (input.controller == controller.ps5 && input.get(ps5.l2) > 50) {
output.set_button(ps5.cross, true);
}
}
ps5.l2,
ps4.l2, and xb.lt evaluate to the string "l2".
Pass them to a reader: input.get(ps5.l2) returns trigger pressure,
input.get(xb.x) returns 0 or 100 for the Xbox X button, and
input.get("west") accepts the quoted compatibility alias. Named controls are
not direct properties of input.
Controller output and passthrough
At the beginning of every on_input, the VM starts from the real input state. It
records exactly which fields a setter touches and emits only those fields as a patch. If a
setter is skipped on the next packet, that field immediately returns to passthrough.
| Method | Range/defaults | Exact behavior |
|---|---|---|
output.set_button(button, down = true) | Boolean | Overrides one button. L2/R2 names set a trigger fully on or off. output.button is an alias. |
output.press(button) | Pressed | Presses one button for this input packet. |
output.release(button) | Released | Releases one button for this input packet. |
output.tap(button, frames?) | frames accepted but ignored | Currently presses for this input packet only; there is no delayed release scheduler. |
output.set_stick(stick, x, y?) | -100 to 100 | Sets X and optionally Y. With only two arguments, it sets X only. |
output.set_stick_x, set_stick_y | -100 to 100 | Overrides one axis while the other axis passes through. |
output.set_trigger(trigger, percent) | 0 to 100 | Sets analog trigger pressure. Use 100 for full pressure; boolean true converts to 1%, not 100%. |
output.set_gyro(x, y, z) | Raw numeric values | Overrides the motion state and marks DualSense motion capability. |
output.set_accel(x, y, z) | Raw numeric values | Overrides the acceleration state and marks DualSense motion capability. |
output.set_touch(index, x, y, active?, id?) | index 0-1; x 0-1920; y 0-1080; active true; id 0 | Emits both touch points while changing the selected point. |
output.clear(), output.neutral() | No value | Both force all buttons, sticks, and triggers neutral for this packet. They do not mark touch or motion as overridden. |
output.commit() | No arguments | Registered but currently has no VM implementation. Setters already flush together at the end of on_input. |
on_input returns.
event on_input() {
if (input.held("l1")) {
output.set_stick_x("right", 35);
}
// Right Y and every other field remain physical passthrough.
}
Controller feedback
| Method family | Behavior |
|---|---|
output.set_rumble(left, right?) | 0-100 per motor. If right is omitted, both motors use left. output.rumble_motors, ps5.rumble, ps4.rumble, and xb.rumble route to the same implementation. |
rumble.set(motor, value), output.set_rumble_motor | Motor is "left", "right", or "both". Although one argument passes registry arity validation, a useful call needs both motor and value. |
rumble.left/right/both(value) | Sets the selected motor or both motors from 0-100. |
rumble.clear() | Sends zero for both script-owned rumble motors. |
lightbar.set(color) | Accepts one #RRGGBB/0xRRGGBB string or an rgb.* value. |
lightbar.set(r, g, b) | Accepts three byte values from 0-255. Literal names such as "blue" and CSS-style rgb(...) strings are not parsed. |
lightbar.clear() | Latches black. Use reset when console ownership should resume. |
lightbar.reset() | Releases script lightbar ownership back to Remote Play. |
ps4.lightbar(color), ps5.lightbar(color) | The same light bar command through a console namespace. xb has no light bar helpers. |
ps5.player_led(mask) | Uses the low five bits of the mask. Only ps5 has player LED helpers. |
ps5.player_number(number) | Clamps 0-4 and maps to the standard player LED patterns. |
output.clear_feedback(), ps5.clear_feedback(), ps4.clear_feedback(), xb.clear_feedback() | Zeros script rumble/player LEDs and releases lightbar ownership; for an Xbox controller that stops rumble. |
Feedback is emitted only when the current event calls a feedback method. Omitting a call on
a later packet does not itself send a clear, so use an explicit else branch when
feedback must stop immediately.
event on_input() {
if (input.held("l1")) {
rumble.both(35);
lightbar.set(rgb.teal);
ps5.player_number(1);
} else {
rumble.clear();
lightbar.reset();
ps5.player.clear();
}
}
Model sources
The language uses model for both an ONNX source value and a configured live
model detector. Their runtime members differ, so use distinct variable names.
| Call or value | Returns | Behavior |
|---|---|---|
models.set(path) | Source model | Name is the normalized filename stem. This form does not add an entry to the legacy name registry. |
models.set(name, path) | Source model | Also stores a legacy name-to-path entry. |
source.name, source.path | string | Available on source values returned by models.set. |
models.path(source) | string | Returns a source model's ONNX path. |
models.path(name) | string | Looks up a legacy two-argument registration; defaults to name "primary". |
models.all() | Array | Returns legacy registered names only, in unspecified order. It does not return paths and does not include one-argument source values. |
vision.model(source, ...) | Configured model | Has live vision-tool members such as enabled, threshold, results, and target; it does not expose source name/path. |
model sourceModel = models.set("models/object_detector.onnx");
model detector = vision.model(
sourceModel,
["object", "marker"],
null,
0.55,
true,
vision.directml
);
event on_frame() {
target hit = detector.target;
ui.status(string.format("detections {}", detector.count));
}
models.path generally returns an empty string because the configured detector is
a live VisionTool payload, not the source Model payload.
Computer vision
A configuration call emits a native pipeline configuration immediately and returns a typed, shared live value. Retain that value and read its members instead of relying on string tool names.
| Tool | Call syntax | Native behavior |
|---|---|---|
color | vision.color(lower, upper, roi?, min_area?, enabled?) | HSV color thresholding. The detailed reference documents optional arguments and their defaults. |
contour | vision.contour(lower, upper, roi?, min_area?, enabled?) | Contour/blob extraction from the HSV mask. |
template | vision.template(image, threshold?, roi?, enabled?) | Native template matching. |
feature | vision.feature(image, threshold?, roi?, enabled?) | Currently uses the template-matching pipeline with a feature label. |
match | vision.match(image, threshold?, roi?, enabled?) | Template-matching variant. vision.feature_match is an alias returning match. |
motion | vision.motion(roi?, threshold?, min_area?, enabled?) | Frame-difference motion bounds. |
edges | vision.edges(roi?, threshold?, min_area?, enabled?) | Edge-density bounds. |
circle | vision.circle(roi?, threshold?, min_area?, enabled?) | OpenCV Hough circle detection when OpenCV is available. |
line | vision.line(roi?, threshold?, min_area?, enabled?) | OpenCV probabilistic Hough line detection when available. |
qr | vision.qr(roi?, enabled?) | QR decoding through ZXing-C++ or OpenCV. |
barcode | vision.barcode(roi?, enabled?) | Broad barcode decoding through ZXing-C++ or supported OpenCV builds. |
ocr | vision.ocr(roi?, language?, enabled?) | OCR over the selected region; .lang reports the configured hint. |
track | vision.track(source?, roi?, enabled?) | Turns all current pipeline tracks into detections. The current runner uses source only as an output label; it stores and re-emits roi but does not apply either value as a filter. |
model | vision.model(model, labels?, roi?, threshold?, enabled?, backend?) | Runs an ONNX model with an optional single label or label array. |
face | vision.face(model, roi?, threshold?, enabled?, backend?) | Model configuration with the label face; the supplied ONNX file determines actual capability. |
person | vision.person(model, roi?, threshold?, enabled?, backend?) | Model configuration with the label person. |
Live tool members
| Tool values | Read/write members | Read-only result/config members |
|---|---|---|
| Every typed tool | enabled, overlay, roi | results, count, target |
color, contour | lower, upper, min_area | Shared result members |
motion, edges, circle, line | threshold, min_area | Shared result members |
template, feature, match | threshold, image | Shared result members |
ocr | Shared writable members | lang plus shared results |
track | Shared writable members | source plus shared results |
model | threshold plus shared writable members | labels plus shared results |
face, person | threshold plus shared writable members | Shared result members |
Writing a live configuration member immediately re-emits the tool configuration.
Thresholds clamp to 0-1 and min_area has a minimum of 1. An ROI is
[x, y, width, height]; a fully 0-1 ROI is treated as normalized, otherwise the
values are treated as pixels and clipped to the frame.
color tools, for example, causes the later configuration to replace the earlier
one by pipeline key. Model-backed names derive from the model source name.
Detections and targets
| Member | Meaning |
|---|---|
target.x, target.y | Center of the detection box. |
confidence, score | Detection confidence; both expose the same native score. |
class_id | Numeric model class ID, or -1 when the detector has no class. |
label, text | Resolved label and decoded/OCR text. |
tool, kind | Pipeline tool name and detector kind. |
box.x/y/width/height | Top-left position and size. |
box.left/top/right/bottom | Box edges. |
Box values normalize to 0-1 when frame telemetry dimensions are available. If telemetry is
0, native pixel values pass through. tool.target selects the highest-score
detection for that tool or returns null. vision.target(name, label)
can also filter by label, decoded text, or a class_N class ID.
detector.results,
detector.count, and detector.target correctly retain the configured
tool identity. The current vision.results(detector) and
vision.target(detector) call paths do not recognize a configured typed
VisionTool payload and can become unfiltered. A source value from models.set or
an explicit string name does filter those compatibility calls.
Video UI, fonts, and colors
| Member | Returns | Behavior |
|---|---|---|
font.create(size = 1, color = rgb.white) | font | Consolas font. Size clamps to 0.5-4; color accepts hex strings or rgb.*. |
font.default | font | White Consolas font at size 1. |
fontValue.size, fontValue.color | Number, hex string | Readable and writable; writes affect later draws through that shared value. |
ui.print(font, x, y, value) | Nothing | Draws text with normalized coordinates. ui.text is an alias. |
ui.rect(x, y, width, height, color?, thickness?, filled?, id?) | Runtime handle | Defaults to white, thickness 2, unfilled. |
ui.line(x1, y1, x2, y2, color?, thickness?, id?) | Runtime handle | Draws a normalized line. |
ui.circle(x, y, radius, color?, thickness?, filled?, id?) | Runtime handle | Radius is a fraction of frame height. |
ui.clear() | Nothing | Clears all ui--prefixed drawings. Passing a handle/id clears one drawing. |
ui.status(text) | Nothing | Updates persistent status id status; an empty string removes it. Extra accepted arguments are ignored by the VM. |
Every shape receives a fresh handle unless an explicit final ID is supplied. All current
font values use the same internal text ID ui-font, so multiple
ui.print calls replace one another even when they use different font values.
Use ui.status plus one printed label, or shapes with explicit IDs, when several
independently replaceable entries are needed.
font hud = font.create(1.25, rgb.cyan);
event on_frame() {
ui.print(hud, 0.02, 0.05, string.format("frame {}", frame));
ui.line(0.45, 0.50, 0.55, 0.50, rgb.white, 2, "horizontal");
ui.line(0.50, 0.45, 0.50, 0.55, rgb.white, 2, "vertical");
}
Math, strings, system values, and types
math
abs(value), inv(value), pow(base, power),
sqrt(value), random(min, max),
clamp(value, min, max), min(a, b), and
max(a, b) return numbers. Negative square-root input is clamped to 0.
Random bounds are order-normalized. Atlas has no bitwise operators; use the
math.bit_* and shift helpers instead.
string.format
string.format(fmt, ...values) supports up to 15 replacement values. Each
literal {} consumes the next value. Missing values become empty text and
extra values are ignored.
system
system.log(value) writes a scalar-friendly event-log line;
system.beep() requests a Windows notification beep.
system.controller is the family available outside on_input.
system.width/height report latest frame pixels.
type(value)
Returns a type-name string. Whole finite numbers report int32; fractional
numbers report float. Other results include string,
bool, null, array, font,
model, target, handle, exact vision type names,
and user struct names.
event on_frame() {
var value = math.clamp(math.pow(0.75, 2), 0, 1);
if (type(value) == type.float) {
system.log(string.format("value {}", value));
}
}
Network capture and packets
network starts and stops packet capture while the script runs; its members may
be used in any event or function, but network.capture() returns
false in global initializers and on_stop
(where capture can start). packet is
the one packet being decided inside on_network_recv or
on_network_send. Capture needs WinDivert and administrator approval; see
Network events for setup, filters, timing, and what
happens when a script is slow or fails.
Capture control
| Member | Returns | Behavior |
|---|---|---|
network.capture(filter) | bool | Starts or replaces capture with a WinDivert filter. true means Atlas accepted the request and capture is starting in the background. false means Atlas refused the request: the filter is longer than 2048 characters, uses characters other than printable ASCII, tabs, and line breaks, or has unbalanced parentheses; the helper already failed to start in this Run; or the script is not running (a global initializer or on_stop). network.error then gives the reason at once. The first call in a Run shows the administrator prompt. |
network.stop() | Nothing | Stops capture and passes waiting packets unchanged. A later network.capture() in the same Run needs no new prompt. |
network.active | bool | true once capture is running and packets can reach the events. It is still false in the event that called network.capture(). |
network.error | string | Why capture failed or ended: a declined prompt, a missing or unverified WinDivert, a Capture filter error: from WinDivert, or a lost helper. It also gives the reason Atlas refused the last network.capture(), starting in the event that called it. Empty when there is none. A new accepted network.capture() clears it. |
network.interface | string | The interface capture is limited to. The Atlas window has no interface selector yet, so this is normally "All interfaces". |
network.received, network.sent | Number | Packets handed to the receive and send side in the current capture. |
network.dropped | Number | Packets the script dropped in the current capture. |
network.failed_open | Number | Packets that continued unchanged because the script errored, missed the 50 ms deadline, the queue was full, or an edit could not be sent. |
The counters start again at 0 each time a capture begins, including a replacement capture.
They and network.active are refreshed before each event. Capture ends only
after on_stop, so on_stop still sees the running capture's counters.
Packet fields
| Field | Type | Meaning |
|---|---|---|
packet.protocol | string | "udp", "tcp", "icmp", or "other". A later fragment of a split packet, or a packet whose UDP or TCP header is cut short, reads "other". |
packet.src_ip, packet.dst_ip | string | Dotted IPv4 such as "192.0.2.10", or compressed IPv6 such as "2001:db8::1". |
packet.src_port, packet.dst_port | Number | UDP or TCP port; 0 for any other protocol. |
packet.length | Number | Bytes in the whole packet, IP header included. |
packet.payload_length | Number | Bytes of payload, as described below. |
packet.outbound | bool | WinDivert's outbound flag for the packet. |
packet.forwarded | bool | The packet is passing through this PC rather than to or from it. |
packet.ipv6, packet.loopback | bool | IPv6 packet; loopback (this PC to itself) packet. |
Offsets: payload or whole packet
Most packet.* methods count offsets from the start of the payload:
the data after the UDP header (8 bytes) or the TCP header (including its options). For other
protocols, later fragments, and cut-short UDP or TCP headers, the payload starts right after
the IP header, IPv4 options and IPv6 extension headers included. Methods whose names start
with raw_ count from byte 0 of the whole IP packet instead.
Reading past the end of the packet returns null (packet.bytes
returns an empty array and packet.hex an empty string). Writing past the end does
nothing. No method can make a packet longer or shorter.
Reading and editing
| Method | Returns | Behavior |
|---|---|---|
packet.byte(offset), packet.set_byte(offset, value) | Number, nothing | One payload byte, 0-255. Written values wrap to 0-255. |
packet.bit(offset, bit), packet.set_bit(offset, bit, on) | bool, nothing | One bit of a payload byte. Bit 0 is the least significant and bit 7 the most. |
packet.read(type, offset), packet.write(type, offset, value) | Number, nothing | A typed value in the payload; see the type table below. |
packet.bytes(offset?, count?) | Array | Payload bytes as numbers: all of them, from offset to the end, or count bytes (clamped to what is there). |
packet.set_bytes(offset, bytes) | Nothing | Writes an array of byte values at offset. Values past the end of the packet are skipped. |
packet.hex(offset?, count?) | string | The same bytes as uppercase hex separated by spaces, such as "78 01 FF", for logging. |
packet.raw_byte(offset), packet.raw_set_byte(offset, value) | Number, nothing | One byte of the whole packet. |
packet.raw_read(type, offset), packet.raw_write(type, offset, value) | Number, nothing | A typed value anywhere in the whole packet, including the IP and transport headers. |
packet.copy_to(record, layout, offset?), packet.copy_from(record, layout, offset?) | bool | Copies payload bytes into struct fields, or struct fields into the payload, following a layout string. |
packet.drop(), packet.pass() | Nothing | Drop the packet, or cancel an earlier drop in the same event. Passing is the default. |
A write that lands inside the packet marks it as edited, and Atlas recalculates the packet's checksums before sending it. If an edited packet is no longer a valid IP packet of the same version, or its length field claims more bytes than the packet has, Atlas sends the original instead.
Value types
| Type | Size | Values |
|---|---|---|
"u8", "i8" | 1 byte | 0 to 255; -128 to 127 |
"u16", "i16" | 2 bytes | 0 to 65535; -32768 to 32767 |
"u32", "i32" | 4 bytes | 0 to 4294967295; -2147483648 to 2147483647 |
"f32", "f64" | 4 and 8 bytes | IEEE-754 floating point |
Values are little-endian unless the type ends in be, as in "u16be".
Network headers, including every port and length field, are big-endian, so read them with a
be type. Type names ignore case and surrounding spaces. When writing, integer
types truncate toward zero and wrap to their width, so -1 written as
"u8" becomes 255. An unknown type name reads null and writes nothing.
event on_start() {
if (!network.capture("udp and udp.DstPort == 9000")) {
system.log("Network capture could not start");
}
}
event on_network_send() {
if (packet.ipv6 || packet.payload_length < 3) {
return;
}
// IPv4 header: time to live is byte 8, and the total length is a big-endian u16 at byte 2.
var ttl = packet.raw_byte(8);
var total = packet.raw_read("u16be", 2);
// Payload: a big-endian message id, then a flags byte.
var id = packet.read("u16be", 0);
if (packet.bit(2, 0)) {
// Clear flag bit 0 and keep the other seven bits.
packet.set_bit(2, 0, false);
}
if (id == 1 && ttl > 1 && total == packet.length) {
system.log(packet.hex(0, 3));
}
}
Layout strings and structs
packet.copy_to and packet.copy_from move several values at once
between the payload and a struct variable. The layout string lists fields in byte order as
type name or type name[count], separated by ; or
,. The fields follow each other with no padding, starting at
offset (0 by default).
- Each name must be a field of the struct, and may appear only once. The names do not have to cover every struct field.
- An array entry reads
countvalues (1 to 65535) into a new array in that field. When writing, missing elements are written as 0. - Both methods return
falsefor an invalid layout, a name the struct does not have, or a layout that runs past the end of the packet. Afalseresult changes nothing: no packet byte and no struct field. Neither the editor nor the compiler checks layout strings, so check the result.
struct Update {
var kind;
var sequence;
var sticks[4];
var buttons;
};
const string UPDATE_LAYOUT = "u8 kind; u16 sequence; i16 sticks[4]; u16 buttons";
Update update;
event on_start() {
if (!network.capture("udp and udp.DstPort >= 30000 and udp.DstPort <= 30020")) {
system.log("Network capture could not start");
}
}
event on_network_send() {
if (packet.copy_to(update, UPDATE_LAYOUT) && update.kind == 0x78) {
update.buttons = math.bit_or(update.buttons, 0x20);
if (!packet.copy_from(update, UPDATE_LAYOUT)) {
system.log("Update did not fit");
}
}
}
Bit helpers
Atlas has hexadecimal literals such as 0x20 but no bitwise operators. These
math helpers work in any event or function. They treat values as unsigned 32-bit
integers: each value is truncated toward zero and wrapped, so -1 is
0xFFFFFFFF, and the result is always 0 to 4294967295.
| Method | Result |
|---|---|
math.bit_and(value, operand) | Bits set in both, such as math.bit_and(0xF0, 0x3C) = 48 (0x30) |
math.bit_or(value, operand) | Bits set in either |
math.bit_xor(value, operand) | Bits set in exactly one |
math.bit_not(value) | Every bit flipped, so math.bit_not(0) = 4294967295 |
math.shift_left(value, amount) | value shifted up; bits past bit 31 are lost |
math.shift_right(value, amount) | value shifted down, filling with zeros |
Only the low five bits of amount are used, so a shift is always 0 to 31 places.
To clear bits, combine the helpers: math.bit_and(flags, math.bit_not(0x04)).
Constant values
Controller families, output hosts, and Cronus protocol
controller.*
ps5, ps4, xb, xb360, generic, unknown. Each evaluates to its lowercase name.
host.*
ps5, ps4, xb, xb360, cronuszen, titan2, generic, mock, unknown.
cronuszen.*
none, ps3, ps4, ps5, xb, xb360, switch, wheel, generic, unknown. Compare them with cronuszen.protocol.
The current input controller reports ps5, ps4,
xb (any XInput or Xbox controller, including an Xbox 360 or third-party XInput
pad), or unknown; it never reports xb360. Xbox Remote Play
reports host.xb, and a Cronus Zen on the Xbox One protocol reports
cronuszen.xb. Some constants exist for compatibility even when the active host
does not currently emit that exact spelling. A mock output currently reports
host.unknown, not host.mock. The removed spellings
controller.xb1, controller.xinput, host.xb1, and
cronuszen.xb1 fail to compile with a diagnostic that names the xb
replacement.
Qualified controller names
| Logical control | Accepted names |
|---|---|
| Face south/east/west/north | cross/a/south, circle/b/east, square/x/west, triangle/y/north |
| Shoulders | l1/lb/left_bumper, r1/rb/right_bumper |
| Stick clicks | l3/ls/left_stick_button, r3/rs/right_stick_button |
| Triggers | l2/lt/left_trigger, r2/rt/right_trigger |
| Menu buttons | options/menu/start, create/view/back/share |
| System buttons | ps/home/guide, touchpad/touchpad_button |
| D-pad | up/dpad_up, down/dpad_down, left/dpad_left, right/dpad_right |
Names are case-insensitive. Use a quoted name or a qualified platform name such as
ps5.cross, ps4.share, or xb.rt. Platform values are
normalized name strings; xb.lt evaluates to "l2". The schema still
lists select, but the native button mapper has no select mapping, so
do not use it.
ps5.cross/ps4.cross for PlayStation face buttons and
xb.a for Xbox face buttons. Cross-family members such as
ps5.a and xb.cross are invalid. Quoted names remain available as
compatibility aliases when family qualification is not desired.
Vision backends and runtime type constants
vision.* backends
vision.auto = "auto", vision.cpu = "cpu", and both vision.gpu and vision.directml = "directml".
type.*
int32, float, string, bool, null, array, font, model, target, and handle each evaluate to that lowercase type-name string.
RGB constants
| Names | Hex values |
|---|---|
red, crimson, maroon, salmon, coral | #ff0000, #dc143c, #800000, #fa8072, #ff7f50 |
orange, amber, gold, yellow, olive | #ffa500, #ffbf00, #ffd700, #ffff00, #808000 |
lime, green, dark_green, mint, teal | #32cd32, #00ff00, #006400, #98ff98, #008080 |
cyan/aqua, turquoise, sky_blue, blue, navy | #00ffff, #40e0d0, #87ceeb, #0000ff, #000080 |
indigo, violet, purple, magenta/fuchsia | #4b0082, #ee82ee, #800080, #ff00ff |
pink, hot_pink, rose, brown | #ffc0cb, #ff69b4, #ff007f, #8b4513 |
silver, gray/grey, white, black/off | #c0c0c0, #808080, #ffffff, #000000 |
Registered but not implemented
| Registered family | Names |
|---|---|
| Commit | output.commit() |
| Trigger effects | output.set_trigger_effect, set_trigger_effects, set_trigger_effect_field, clear_trigger_effect |
| Adaptive-trigger aliases | output.set_adaptive_trigger, set_adaptive_trigger_field, clear_adaptive_trigger |
| Platform trigger aliases | ps5.set_trigger_effect, set_trigger_effects, trigger_effect, adaptive_trigger, set_adaptive_trigger, and adt. ps4 and xb have none of these. |
| ADT sub-namespace | ps5.adt.set, ps5.adt.raw, ps5.adt.clear |
Flat ADT field constants do compile to byte indices:
mode=0, start=1, force_1=2,
force_2=3, strength_low=4,
strength_mid=5, strength_high=6,
unknown_1=7, unknown_2=8,
frequency=9, and unknown_3=10. Dotted forms such as
ps5.adt.strength.high are not valid native constants.
Compatibility caveats
- Use canonical roots in new code. A legacy
ctx.prefix is read as the bare path:ctx.output.set_button(...)callsoutput.set_button, and a value read such asctx.controller.ps5has the value ofcontroller.ps5. Both are checked for removed names and missing feedback like the bare path, but event-scope checks skip the prefixed form.ctxand every API root are reserved names, so a script cannot declare its own. - Comparing with the string of a removed name never matches.
input.controller == "xinput"andinput.controller == "xb1"are never true, because an XInput or Xbox pad now reports"xb"; Xbox Remote Play reports host"xb", and a Cronus Zen on the Xbox One protocol reports"xb". Compare withcontroller.xb,host.xb, andcronuszen.xb. The analyzer warns (atlas.renamed_value) when such a literal sits directly in the comparison, but it cannot see a string held in a variable or built at run time. - A compiled script package built before the rename keeps the old behavior until it is recompiled. Constants are folded to strings when a script compiles, so its
controller.xb1,controller.xinput,host.xb1, andcronuszen.xb1comparisons hold"xb1"or"xinput"and no longer match. It can also still run feedback thatxbandps4no longer offer, such as a light bar call written asxb1.set_lightbar, because the compiled calls name built-in IDs that did not change. Recompile such scripts from source. ps5,ps4, andxbeach register their own feedback calls, and each offers only the families its controller has (see Feedback by controller). Only those namespaced calls are checked against the controller;output.*feedback and the sharedrumble.*andlightbar.*shortcuts compile for any target. Every feedback call goes through one Remote Play feedback path to the local controller the user holds, so that controller's hardware decides what shows.- A legacy
video.*owner canonicalizes toui.*natively, but the schema covers it only partially. Useui.*. ui.textis a working alias ofui.print; preferui.printin new examples.ps5.reset_lightbar(),ps5.player(), and nestedps5.rumble.*/lightbar.*/player.*aliases route to the same working feedback helpers.- Unknown literal button names are validation errors. Dynamic names that do not map at runtime return false or perform no output change.
Generated object index
Every API object in the reference schema is rendered below. Native roots also
include string and type, which are covered manually above even if an
older schema does not provide object cards for them.
inputCurrent controller packet. Read a named control with input.get(control): digital buttons return 0 or 100 and triggers return pressure from 0 to 100. Named controls such as x, west, and l2 are not direct input properties; pass a quoted name or a platform-qualified constant. Stick axes remain available as input.left_x/left_y/right_x/right_y and are approximately -100 to 100. input.time is 0 initially, then a smoothed packet interval with individual samples capped at 50 ms. Compare input.controller with controller.* constants. Native touch-point reads and input.capabilities are not currently implemented.
outputPer-packet controller output controls, available directly inside on_input. Setters accumulate until the event returns and override only the fields they touch, so every untouched field remains physical passthrough. output.host reports the selected output host for comparison with host.* constants.
controllerController-family constants for comparisons: controller.ps5, controller.ps4, controller.xb, controller.xb360, controller.generic, and controller.unknown. An XInput (Xbox) controller reports controller.xb. controller.xb360 identifies an Xbox 360 family only; it does not create an xb360.* controller-name or feedback namespace.
hostOutput-host constants for comparisons, including host.ps5, host.ps4, host.xb, host.xb360, host.cronuszen, host.titan2, host.generic, host.mock, and host.unknown. Xbox Remote Play reports host.xb. host.xb360 identifies the Xbox 360 host family only; it does not enable an xb360.* feedback API.
cronuszenCronus Zen bridge status and protocol constants. cronuszen.protocol reports the console protocol from the bridge input report and should be compared with constants such as cronuszen.ps5, cronuszen.ps4, cronuszen.xb (Xbox One and Xbox Series X|S), cronuszen.xb360, cronuszen.ps3, cronuszen.switch, cronuszen.wheel, cronuszen.none, or cronuszen.unknown. cronuszen.xb360 is a reported protocol value only; it is not an xb360.* scripting namespace.
mathMath helper namespace for numeric script expressions, including math.abs, math.inv, math.pow, math.sqrt, math.random, math.clamp, math.min, and math.max.
stringString helper namespace. string.format(fmt, ...args) replaces each {} placeholder with the next value, up to 15 replacement values. The string keyword remains the declaration type for text values.
typeRuntime type inspection. type(value) returns a type-name string; whole numbers report int32 and fractional numbers report float. Compare common results with type.int32, type.float, type.string, type.bool, type.null, type.array, type.font, type.model, type.target, or type.handle. Structs and typed vision values return their specific type names, which do not have fixed type.* constants.
rumbleShortcut for Remote Play controller rumble feedback. Use rumble.set("left", value), rumble.set("right", value), or rumble.set("both", value) with values from 0 to 100. Feedback is rejected for non-Remote-Play output hosts.
lightbarShortcut for Remote Play lightbar feedback. Use one #RRGGBB/0xRRGGBB string (including an rgb.* constant) or three 0 to 255 byte values. Literal color names and CSS-style rgb(...) strings are not parsed. Device lightbar support is still required.
rgbRGB color-code constants such as rgb.red, rgb.green, rgb.blue, rgb.sky_blue, rgb.purple, rgb.white, and rgb.off. Each constant is a "#RRGGBB" string, so it can be used anywhere an RGB code is accepted, like lightbar.set(rgb.blue).
uiDraws text, rectangles, lines, and circles over the video output. Build strings with string.format, draw text with ui.print(font, x, y, string), and show a status label with ui.status. Coordinates are 0 to 1 fractions of the frame.
fontFont values for ui.print. font.create(size, color) builds a Consolas font; size defaults to 1 and clamps to 0.5 through 4, while color accepts #RRGGBB/0xRRGGBB strings or rgb.* constants. font.default is white Consolas at size 1. Font size and color members are readable and writable.
ps5PS5-qualified controller-name properties for use as arguments, such as input.held(ps5.l1), input.get(ps5.l2), or output.set_trigger(ps5.r2, 100). This view exposes PS5 names such as cross/circle/square/triangle, not Xbox a/b/x/y names. Members such as ps5.l2 are strings naming controls, not live input values; read pressure with input.get(ps5.l2) or input.trigger(ps5.l2). Feedback: a DualSense has every feedback family, so ps5 offers rumble, light bar, player LED and player number helpers, and the adaptive-trigger (trigger-effect and adt) helpers. Rumble, light bar, and player helpers require Remote Play output. Adaptive-trigger helpers are registered but currently have no VM implementation.
ps4PS4-qualified controller-name properties for use as arguments. This view exposes PlayStation names, including share, and does not expose Xbox a/b/x/y names. Members such as ps4.l2 are strings naming controls, not live input values; read pressure with input.get(ps4.l2) or input.trigger(ps4.l2). Feedback: a DualShock 4 has rumble and a light bar, so ps4 offers ps4.rumble, ps4.set_rumble, ps4.rumble.*, ps4.lightbar, ps4.set_lightbar, ps4.reset_lightbar, ps4.lightbar.*, and ps4.clear_feedback, all through Remote Play output. A DualShock 4 has no player LEDs or player number and no adaptive triggers, so ps4 has no player, player_led, player_number, trigger-effect, or adt members.
xbXbox controller-name properties for use as arguments. xb is the Atlas namespace for Xbox One and Xbox Series X|S controllers, including Xbox Remote Play; it is not an Xbox 360 namespace. It exposes Xbox names such as a/b/x/y, lb/rb, lt/rt, ls/rs, menu, view, and home; PlayStation-only names such as cross and touchpad are not members. Members such as xb.lt are normalized name strings ("l2"), not live pressure; read pressure with input.get(xb.lt) or input.trigger(xb.lt), and read a digital button numerically with input.get(xb.x). Feedback: Xbox controllers have rumble only, so xb offers xb.rumble, xb.set_rumble, xb.rumble.*, and xb.clear_feedback through Remote Play output. Xbox controllers have no light bar, no player LEDs or player number, and no adaptive triggers, so xb has no lightbar, player, trigger-effect, or adt members.
modelsCreates ONNX source-model values. models.set(path) returns a source with name/path members but does not add a legacy registry entry; models.set(name, path) also registers that name. Keep the source separate from the configured detector returned by vision.model, then read detector.target/results/count.
visionNative computer-vision configuration helpers and latest results. Each configuration call emits a pipeline config and returns a typed live value with enabled/overlay/roi plus results/count/target members. Prefer those members over compatibility vision.results/vision.target calls. Most non-model tool names are fixed to their type, so a later same-type configuration replaces the earlier one. For tracking, source and roi are stored and re-emitted as configuration metadata but the current tracker applies neither filter and follows all detections.
gyroLatest controller gyro values, available directly inside on_input. Check gyro.available before relying on gyro.x/y/z.
accelLatest controller accelerometer values, available directly inside on_input. Check accel.available before relying on accel.x/y/z.
systemSystem-level helpers. Use system.log(message) to write to the Atlas event log and system.beep() to play a short Windows beep. system.controller reports the connected controller family (like input.controller) and, unlike input.controller, is available in any event such as on_connect. system.width and system.height are the captured video frame size in pixels, so scripts can convert normalized vision coordinates to pixels without hardcoding a resolution. Compare the controller family to constants such as controller.ps5, controller.ps4, or controller.xb.
frameCurrent frame counter for the running script.
time_msMilliseconds elapsed since the native script runtime object was created. This clock is not reset by each Run.
networkControls WinDivert network capture. network.capture(filter) starts it (one administrator prompt per Run) and network.stop() ends it. network.active, network.error, network.interface and the received, sent, dropped and failed_open counters report its state. Every member can be used in any event or function, but capture starts only while the script is running: network.capture() works in on_start, on_connect, on_frame, on_input, on_network_recv and on_network_send (and functions they call), and returns false in global initializers and on_stop, with network.error saying why.
packetThe packet being decided inside on_network_recv() or on_network_send(). Reads its protocol, addresses, ports, lengths and bytes, edits it in place, and packet.drop()/packet.pass() choose its fate. Only valid directly inside the two network events.
Generated controller-name index
These lists come directly from the reference schema. The verified mapping notes above take precedence for compatibility names that are accepted by validation but not mapped by the native controller converter.
PlayStation
cross circle square triangle l1 r1 l2 r2 l3 r3 options create ps touchpad up down left right
PS5
cross circle square triangle l1 r1 l2 r2 l3 r3 options create ps touchpad up down left right
PS4
cross circle square triangle l1 r1 l2 r2 l3 r3 options share ps touchpad up down left right
Xbox control names (xb)
a b x y lb rb lt rt ls rs menu view home up down left right
cross circle square triangle a b x y l1 r1 l2 r2 l3 r3 lb rb lt rt ls rs options menu create view ps home touchpad up down left rightCompatibility names:
south east west north dpad_up dpad_down dpad_left dpad_right left_bumper right_bumper left_stick_button right_stick_button left_trigger right_trigger start select back share guide touchpad_buttonGenerated method index
All schema method entries are included and searchable. See Registered but not implemented before using commit or adaptive-trigger entries, and use the exact native behavior tables above when a compatibility description implies a stronger guarantee.
input 5 methods
Current controller packet. Read a named control with input.get(control): digital buttons return 0 or 100 and triggers return pressure from 0 to 100. Named controls such as x, west, and l2 are not direct input properties; pass a quoted name or a platform-qualified constant. Stick axes remain available as input.left_x/left_y/right_x/right_y and are approximately -100 to 100. input.time is 0 initially, then a smoothed packet interval with individual samples capped at 50 ms. Compare input.controller with controller.* constants. Native touch-point reads and input.capabilities are not currently implemented.
input.getinput.get(control)Returns the current numeric value of a named control. Digital buttons return 0 when released or 100 when held; L2/R2 and LT/RT return live pressure from 0 to 100. Pass a platform-qualified control such as input.get(ps5.l2) or input.get(xb.x), or a quoted compatibility name such as input.get("west"). Named controls are not direct properties of input.
input.pressedinput.pressed(button)Returns true for the controller packet where a button moves from up to down. For a trigger name, the edge is 0 to greater than 0. Use a quoted name or a qualified name string such as ps5.l2; read the current numeric value with input.get(ps5.l2).
input.heldinput.held(button)Returns true while a button is down. A named trigger is held while its pressure is greater than 0. Use a quoted name or a qualified name string such as ps5.l2; read the current numeric value with input.get(ps5.l2).
input.releasedinput.released(button)Returns true for the controller packet where a button moves from down to up. For a trigger name, the edge is greater than 0 to 0. Use a quoted name or a qualified name string such as ps5.l2.
input.triggerinput.trigger(trigger)Returns L2/R2 or LT/RT trigger pressure from 0 to 100. This specialized trigger reader remains available; input.get(control) is the unified numeric getter for both digital buttons and triggers.
output 30 methods
Per-packet controller output controls, available directly inside on_input. Setters accumulate until the event returns and override only the fields they touch, so every untouched field remains physical passthrough. output.host reports the selected output host for comparison with host.* constants.
output.set_buttonoutput.set_button(button, down?)Overrides one button for the current on_input packet; down defaults to true when omitted. L2/R2 names set that trigger fully on or off. The patch flushes when on_input returns.
output.buttonoutput.button(button, down?)Alias for output.set_button with the same per-packet behavior, default down=true.
output.pressoutput.press(button)Presses one button for the current input packet. Most held mappings should call set_button(button, condition) every packet.
output.releaseoutput.release(button)Releases one button for the current input packet. Most held mappings should call set_button(button, condition) every packet.
output.tapoutput.tap(button, frames?)Currently presses the button for this input packet only. The optional frames argument is accepted but ignored; Atlas has no delayed tap scheduler.
output.set_stickoutput.set_stick(stick, x, y?)Overrides X and, when supplied, Y on the left or right stick for this packet. Values clamp to -100 through 100. With only stick and x, only X is touched.
output.set_stick_xoutput.set_stick_x(stick, x)Overrides only the X axis on the left or right stick for this packet, clamped to -100 through 100.
output.set_stick_youtput.set_stick_y(stick, y)Overrides only the Y axis on the left or right stick for this packet, clamped to -100 through 100.
output.set_triggeroutput.set_trigger(trigger, value)Overrides L2/R2 pressure for this packet, clamped to 0 through 100. Use a quoted name or a qualified name string such as ps5.l2. Boolean true converts numerically to 1 percent, not 100; use 100 for full pressure.
output.set_gyrooutput.set_gyro(x, y, z)Overrides gyro x/y/z for this packet and marks DualSense motion capability. The selected output path must support motion.
output.set_acceloutput.set_accel(x, y, z)Overrides accelerometer x/y/z for this packet and marks DualSense motion capability. The selected output path must support motion.
output.set_touchoutput.set_touch(index, x, y, active?, id?)Overrides touchpad point 0 or 1 for this packet. X clamps to 0-1920, Y to 0-1080, active defaults true, and id defaults 0 and clamps to -1 through 127. Both touch points are emitted.
output.clearoutput.clear()Forces every button, stick axis, and trigger neutral for the current packet. It does not mark touch or motion as overridden. It is equivalent to output.neutral in the current VM.
output.neutraloutput.neutral()Forces every button, stick axis, and trigger neutral for the current packet. It does not mark touch or motion as overridden. The patch still flushes when on_input returns; output.commit is not required.
output.commitoutput.commit()Registered compatibility method with no current VM implementation. It performs no additional send; working setters are accumulated and flushed automatically when on_input returns.
output.set_rumbleoutput.set_rumble(left, right?)Sends Remote Play rumble from 0 to 100. If right is omitted, both motors use left. Non-Remote-Play hosts reject feedback.
output.rumble_motorsoutput.rumble_motors(left, right?)Alias for output.set_rumble with the same Remote-Play-only route, 0 to 100 range.
output.set_rumble_motoroutput.set_rumble_motor(motor, value)Sends Remote Play rumble to "left", "right", or "both" from 0 to 100. Motor and value are both required. Non-Remote-Play hosts reject feedback.
output.set_lightbaroutput.set_lightbar(color_or_r, g?, b?)Sends a Remote Play lightbar command using one #RRGGBB/0xRRGGBB string (including rgb.* constants) or three 0 to 255 bytes. Literal color names and CSS-style rgb(...) strings are not parsed. The color latches until output.reset_lightbar; device support is required, non-Remote-Play hosts reject feedback.
output.reset_lightbaroutput.reset_lightbar()Releases script lightbar ownership back to the Remote Play console. Non-Remote-Play hosts reject feedback.
output.set_player_ledoutput.set_player_led(mask)Sends a Remote Play player-LED command using the low five bits of the mask. Device support is required, non-Remote-Play hosts reject feedback.
output.set_player_numberoutput.set_player_number(number)Sends a Remote Play player indicator from 0 to 4 (values clamp; 0 turns it off). Device support is required, non-Remote-Play hosts reject feedback.
output.set_trigger_effectoutput.set_trigger_effect(trigger, field, value)Registered compatibility method with no current VM implementation; it performs no adaptive-trigger change. Flat field constants such as ps5.adt.mode and ps5.adt.strength_high compile, while dotted forms such as ps5.adt.strength.high do not.
output.set_trigger_effectsoutput.set_trigger_effects(trigger, field, value)Registered plural alias of output.set_trigger_effect with no current VM implementation. It performs no adaptive-trigger change.
output.set_trigger_effect_fieldoutput.set_trigger_effect_field(field, value)Registered compatibility method with no current VM implementation; it performs no trigger-effect change.
output.clear_trigger_effectoutput.clear_trigger_effect(target?)Registered compatibility method with no current VM implementation; it does not clear trigger effects.
output.set_adaptive_triggeroutput.set_adaptive_trigger(trigger, field, value)Registered alias of output.set_trigger_effect; the current VM has no implementation, so it performs no adaptive-trigger change.
output.set_adaptive_trigger_fieldoutput.set_adaptive_trigger_field(field, value)Registered alias of output.set_trigger_effect_field; the current VM has no implementation, so it performs no adaptive-trigger change.
output.clear_adaptive_triggeroutput.clear_adaptive_trigger(target?)Registered alias of output.clear_trigger_effect; the current VM has no implementation, so it does not clear adaptive-trigger state.
output.clear_feedbackoutput.clear_feedback()Sends a Remote Play feedback clear that zeros rumble and player LEDs and releases lightbar ownership. Adaptive-trigger feedback is not changed because trigger-effect methods are not implemented. Non-Remote-Play hosts reject feedback.
models 3 methods
Creates ONNX source-model values. models.set(path) returns a source with name/path members but does not add a legacy registry entry; models.set(name, path) also registers that name. Keep the source separate from the configured detector returned by vision.model, then read detector.target/results/count.
models.setmodels.set(path_or_name, path?)Creates an ONNX source-model value with readable name/path members. The one-argument form derives the name from the filename but does not add a legacy registry entry. The two-argument form models.set(name, path) also stores that name for models.path(name) and models.all().
models.pathmodels.path(model_or_name?)Returns the path from a source model produced by models.set, or looks up a legacy two-argument model name (default name: primary). Passing the configured live detector returned by vision.model generally yields an empty string; keep the source model when its path is needed.
models.allmodels.all()Returns an array of names stored by the legacy two-argument models.set(name, path) form, in unspecified order. Paths and one-argument source models are not included.
vision 19 methods
Native computer-vision configuration helpers and latest results. Each configuration call emits a pipeline config and returns a typed live value with enabled/overlay/roi plus results/count/target members. Prefer those members over compatibility vision.results/vision.target calls. Most non-model tool names are fixed to their type, so a later same-type configuration replaces the earlier one. For tracking, source and roi are stored and re-emitted as configuration metadata but the current tracker applies neither filter and follows all detections.
vision.colorvision.color(lower, upper, roi?, min_area?, enabled?)Configures a native color threshold tool and returns a color value. Store it in a color variable; read/set color.enabled, color.overlay, color.roi, color.lower, color.upper, color.min_area to update the running detector, and read color.results, color.count, color.target for detections.
vision.contourvision.contour(lower, upper, roi?, min_area?, enabled?)Configures native contour/blob extraction and returns a contour value. Read/set enabled, overlay, roi, lower, upper, min_area; read results, count, target.
vision.templatevision.template(image, threshold?, roi?, enabled?)Configures a native template matching tool and returns a template value. Read/set enabled, overlay, roi, threshold, image; read results, count, target.
vision.motionvision.motion(roi?, threshold?, min_area?, enabled?)Configures native frame-difference motion detection and returns a motion value. Read/set enabled, overlay, roi, threshold, min_area; read results, count, target.
vision.edgesvision.edges(roi?, threshold?, min_area?, enabled?)Configures native edge-density detection and returns an edges value. Read/set enabled, overlay, roi, threshold, min_area; read results, count, target.
vision.qrvision.qr(roi?, enabled?)Configures native QR detection and returns a qr value. Read/set enabled, overlay, roi; read results, count, target.
vision.barcodevision.barcode(roi?, enabled?)Configures native barcode detection and returns a barcode value. Read/set enabled, overlay, roi; read results, count, target.
vision.ocrvision.ocr(roi?, language?, enabled?)Configures OCR and returns an ocr value. All arguments are optional: roi defaults to null for the full frame, language defaults to null (no additional language hint), and enabled defaults to true. Read/set enabled, overlay, roi; read lang, results, count, target.
vision.modelvision.model(model, labels?, roi?, threshold?, enabled?, backend?)Configures an ONNX Runtime detector from a source model returned by models.set and returns a configured live model value. Only model is required. labels may be one string, an array, or null; roi defaults to null for the full frame, threshold to 0.5, enabled to true, and backend to vision.auto (vision.gpu and vision.directml both select DirectML). Read/set enabled, overlay, roi, threshold; read labels, results, count, target. Keep the separate source model for name/path reads.
vision.trackvision.track(source?, roi?, enabled?)Configures native tracking and returns a track value. All arguments are optional and enabled defaults to true. The current pipeline tracks all detections: source only labels emitted output, while roi is stored and re-emitted but not applied by RunTrackerTool. Read/set enabled, overlay, roi; read source, results, count, target.
vision.featurevision.feature(image, threshold?, roi?, enabled?)Configures the native template-matching pipeline with a feature label and returns a feature value; it is not a separate feature-descriptor implementation. Read/set enabled, overlay, roi, threshold, image; read results, count, target.
vision.matchvision.match(image, threshold?, roi?, enabled?)Configures the native template-matching pipeline with a match label and returns a match value. Read/set enabled, overlay, roi, threshold, image; read results, count, target.
vision.feature_matchvision.feature_match(image, threshold?, roi?, enabled?)Alias for vision.match(); returns a match value.
vision.circlevision.circle(roi?, threshold?, min_area?, enabled?)Configures native Hough circle detection and returns a circle value. Store it in a circle variable; read and set circle.enabled, circle.overlay, circle.roi, circle.threshold, and circle.min_area to update the running detector, and read circle.results, circle.count, circle.target. roi may be null for the full frame; enabled defaults to true.
vision.linevision.line(roi?, threshold?, min_area?, enabled?)Configures native Hough line detection and returns a line value. Read/set enabled, overlay, roi, threshold, min_area; read results, count, target.
vision.facevision.face(model, roi?, threshold?, enabled?, backend?)Configures a generic ONNX model tool with the label face and returns a face value; only model is required, and the supplied source determines actual detection capability. roi defaults to null for the full frame, threshold to 0.5, enabled to true, and backend to vision.auto. Read/set enabled, overlay, roi, threshold; read results, count, target.
vision.personvision.person(model, roi?, threshold?, enabled?, backend?)Configures a generic ONNX model tool with the label person and returns a person value; only model is required, and the supplied source determines actual detection capability. roi defaults to null for the full frame, threshold to 0.5, enabled to true, and backend to vision.auto. Read/set enabled, overlay, roi, threshold; read results, count, target.
vision.resultsvision.results(tool?)Returns latest detections, optionally filtered by an explicit string name or an ONNX source model from models.set. Prefer configuredTool.results: the current compatibility call does not recognize a configured typed VisionTool argument and can become unfiltered.
vision.targetvision.target(name?, label?)Returns the highest-score target or null. The first argument may be an explicit string name or an ONNX source model from models.set; the optional label matches label/text or a class_N ID. Prefer configuredTool.target because a configured typed VisionTool argument is not recognized by this compatibility call and can become unfiltered.
ui 7 methods
Draws text, rectangles, lines, and circles over the video output. Build strings with string.format, draw text with ui.print(font, x, y, string), and show a status label with ui.status. Coordinates are 0 to 1 fractions of the frame.
ui.statusui.status(text, ignored_color?, ignored_size?, ignored_id?)Draws or updates the persistent status label at the top-left of the video preview. Pass an empty string to remove it. The registry accepts up to three additional compatibility arguments, but the current VM ignores them.
ui.printui.print(font, x, y, string)Draws text over the video feed using a font value and normalized x/y coordinates. The current VM assigns every ui.print call the same ui-font ID, so any later ui.print replaces the previous printed text even when it uses a different font value.
ui.textui.text(font, x, y, string)Exact compatibility alias of ui.print. It draws replaceable text with the same shared ui-font ID, so a later ui.text or ui.print call replaces the previous printed text.
ui.rectui.rect(x, y, width, height, color?, thickness?, filled?, id?)Draws a rectangle and returns its runtime handle. Color is optional (default white), thickness defaults to 2 pixels, and filled defaults false; an optional eighth ID string creates a replaceable stable handle. Coordinates are passed as normalized frame fractions and are not VM-clamped.
ui.lineui.line(x1, y1, x2, y2, color?, thickness?, id?)Draws a line and returns its runtime handle. Color is optional (default white), thickness defaults to 2 pixels, and an optional seventh ID string creates a replaceable stable handle. Coordinates are passed as normalized frame fractions and are not VM-clamped.
ui.circleui.circle(x, y, radius, color?, thickness?, filled?, id?)Draws a circle and returns its runtime handle. Color is optional (default white), thickness defaults to 2 pixels, filled defaults false, and an optional seventh ID string creates a replaceable stable handle. x/y are normalized frame fractions; radius is a fraction of frame height.
ui.clearui.clear(handle_or_id?)With no argument, clears every ui- prefixed drawing; with a handle or ID, clears that one drawing. on_frame already clears ui- drawings before redrawing. ui.status uses the separate status ID and is cleared with ui.status(""), not ui.clear().
math 14 methods
Math helper namespace for numeric script expressions, including math.abs, math.inv, math.pow, math.sqrt, math.random, math.clamp, math.min, and math.max.
math.absmath.abs(expression)Returns the absolute value of a numeric expression.
math.invmath.inv(expression)Returns the sign-inverted value of a numeric expression.
math.powmath.pow(base, power)Raises base to the specified power.
math.sqrtmath.sqrt(expression)Returns sqrt(max(expression, 0)); a negative runtime value produces 0.
math.randommath.random(min, max)Returns a uniformly distributed real number between the two bounds after ordering them from low to high. Do not rely on the upper endpoint being included.
math.clampmath.clamp(expression, min, max)Clamps a numeric expression within the min/max range.
math.minmath.min(expression1, expression2)Returns the lower value of two numeric expressions.
math.maxmath.max(expression1, expression2)Returns the higher value of two numeric expressions.
math.bit_andmath.bit_and(value, operand)Bitwise AND of two values as unsigned 32-bit integers. Each value is truncated toward zero and wrapped, so -1 is 0xFFFFFFFF.
math.bit_ormath.bit_or(value, operand)Bitwise OR of two values as unsigned 32-bit integers. Each value is truncated toward zero and wrapped, so -1 is 0xFFFFFFFF.
math.bit_xormath.bit_xor(value, operand)Bitwise XOR of two values as unsigned 32-bit integers. Each value is truncated toward zero and wrapped, so -1 is 0xFFFFFFFF.
math.bit_notmath.bit_not(value)Bitwise NOT of a value as an unsigned 32-bit integer, so math.bit_not(0) is 4294967295 (0xFFFFFFFF).
math.shift_leftmath.shift_left(value, amount)Shifts an unsigned 32-bit value left by amount bits; bits shifted past bit 31 are lost. Only the low five bits of amount are used, so the shift is 0-31.
math.shift_rightmath.shift_right(value, amount)Shifts an unsigned 32-bit value right by amount bits, filling with zeros. Only the low five bits of amount are used, so the shift is 0-31.
system 2 methods
System-level helpers. Use system.log(message) to write to the Atlas event log and system.beep() to play a short Windows beep. system.controller reports the connected controller family (like input.controller) and, unlike input.controller, is available in any event such as on_connect. system.width and system.height are the captured video frame size in pixels, so scripts can convert normalized vision coordinates to pixels without hardcoding a resolution. Compare the controller family to constants such as controller.ps5, controller.ps4, or controller.xb.
system.logsystem.log(message)Writes a line to the Atlas event log.
system.beepsystem.beep()Plays a short Windows beep. Useful as a simple audible debugging signal.
font 2 methods
Font values for ui.print. font.create(size, color) builds a Consolas font; size defaults to 1 and clamps to 0.5 through 4, while color accepts #RRGGBB/0xRRGGBB strings or rgb.* constants. font.default is white Consolas at size 1. Font size and color members are readable and writable.
font.createfont.create(size = 1, color = rgb.white)Returns a Consolas font. size defaults to 1 and clamps to 0.5 through 4. color defaults white and accepts #RRGGBB/0xRRGGBB strings or rgb.* constants; literal color names are not parsed. Example: font hud = font.create(1.5, rgb.purple);
font.defaultfont.defaultA ready-to-use default font value (white, Consolas). Usable directly, like ui.print(font.default, 0.1, 0.1, "hi").
string 1 method
String helper namespace. string.format(fmt, ...args) replaces each {} placeholder with the next value, up to 15 replacement values. The string keyword remains the declaration type for text values.
string.formatstring.format(fmt, ...args)Returns a string where each {} in fmt is replaced by the next argument in order. Extra {} with no argument become empty; extra arguments are ignored. Example: string.format("this {} is a test {}", 10, "cool") -> "this 10 is a test cool".
rumble 5 methods
Shortcut for Remote Play controller rumble feedback. Use rumble.set("left", value), rumble.set("right", value), or rumble.set("both", value) with values from 0 to 100. Feedback is rejected for non-Remote-Play output hosts.
rumble.setrumble.set(motor, value)Sends Remote Play rumble to "left", "right", or "both" from 0 to 100. Motor and value are both required. Non-Remote-Play hosts reject feedback.
rumble.leftrumble.left(value)Sends the left Remote Play rumble motor from 0 to 100. Non-Remote-Play hosts reject feedback.
rumble.rightrumble.right(value)Sends the right Remote Play rumble motor from 0 to 100. Non-Remote-Play hosts reject feedback.
rumble.bothrumble.both(value)Sends both Remote Play rumble motors from 0 to 100. Non-Remote-Play hosts reject feedback.
rumble.clearrumble.clear()Sends zero for both script-owned Remote Play rumble motors. Non-Remote-Play hosts reject feedback.
lightbar 3 methods
Shortcut for Remote Play lightbar feedback. Use one #RRGGBB/0xRRGGBB string (including an rgb.* constant) or three 0 to 255 byte values. Literal color names and CSS-style rgb(...) strings are not parsed. Device lightbar support is still required.
lightbar.setlightbar.set(color_or_r, g?, b?)Sends a Remote Play lightbar command using one #RRGGBB/0xRRGGBB string (including rgb.* constants) or three 0 to 255 bytes. Literal color names and CSS-style rgb(...) strings are not parsed. The color latches until reset; device support is required, non-Remote-Play hosts reject feedback.
lightbar.clearlightbar.clear()Latches a black Remote Play lightbar value. Use lightbar.reset() to release ownership. Device support is required, non-Remote-Play hosts reject feedback.
lightbar.resetlightbar.reset()Releases script lightbar ownership back to the Remote Play console. Non-Remote-Play hosts reject feedback.
ps5 17 methods
PS5-qualified controller-name properties for use as arguments, such as input.held(ps5.l1), input.get(ps5.l2), or output.set_trigger(ps5.r2, 100). This view exposes PS5 names such as cross/circle/square/triangle, not Xbox a/b/x/y names. Members such as ps5.l2 are strings naming controls, not live input values; read pressure with input.get(ps5.l2) or input.trigger(ps5.l2). Feedback: a DualSense has every feedback family, so ps5 offers rumble, light bar, player LED and player number helpers, and the adaptive-trigger (trigger-effect and adt) helpers. Rumble, light bar, and player helpers require Remote Play output. Adaptive-trigger helpers are registered but currently have no VM implementation.
ps5.rumbleps5.rumble(left, right?)Sends Remote Play rumble from 0 to 100; right defaults to left when omitted. Non-Remote-Play hosts reject feedback.
ps5.set_rumbleps5.set_rumble(left, right?)Sends Remote Play rumble from 0 to 100; right defaults to left when omitted. Non-Remote-Play hosts reject feedback.
ps5.lightbarps5.lightbar(color_or_r, g?, b?)Sends a Remote Play lightbar command using one #RRGGBB/0xRRGGBB string (including rgb.* constants) or three 0 to 255 bytes. Device support is required.
ps5.set_lightbarps5.set_lightbar(color_or_r, g?, b?)Sends a Remote Play lightbar command using one #RRGGBB/0xRRGGBB string (including rgb.* constants) or three 0 to 255 bytes. Device support is required.
ps5.reset_lightbarps5.reset_lightbar()Working compatibility alias of output.reset_lightbar. It releases script lightbar ownership back to the Remote Play console; non-Remote-Play hosts reject feedback.
ps5.player_ledps5.player_led(mask)Sends a Remote Play player-LED command using the low five bits of the mask. Device support is required.
ps5.set_player_ledps5.set_player_led(mask)Sends a Remote Play player-LED command using the low five bits of the mask. Device support is required.
ps5.player_numberps5.player_number(number)Sends a Remote Play player indicator from 0 to 4; values clamp and 0 turns it off. Device support is required.
ps5.set_player_numberps5.set_player_number(number)Sends a Remote Play player indicator from 0 to 4; values clamp and 0 turns it off. Device support is required.
ps5.playerps5.player(number)Working direct-call compatibility form of ps5.player.set(number). It sends a Remote Play player indicator from 0 to 4; values clamp, 0 turns it off. The same name also owns the ps5.player.set, ps5.player.led, and ps5.player.clear namespace members.
ps5.set_trigger_effectps5.set_trigger_effect(trigger, field, value)Registered compatibility method with no current VM implementation; it performs no adaptive-trigger change. Flat ps5.adt field constants compile, dotted forms do not.
ps5.set_trigger_effectsps5.set_trigger_effects(trigger, field, value)Registered plural alias of ps5.set_trigger_effect with no current VM implementation. It performs no adaptive-trigger change.
ps5.trigger_effectps5.trigger_effect(trigger, field, value)Registered alias of ps5.set_trigger_effect with no current VM implementation. It performs no adaptive-trigger change.
ps5.adaptive_triggerps5.adaptive_trigger(trigger, field, value)Registered compatibility alias of ps5.set_trigger_effect with no current VM implementation. It performs no adaptive-trigger change.
ps5.set_adaptive_triggerps5.set_adaptive_trigger(trigger, field, value)Registered compatibility alias of ps5.set_trigger_effect with no current VM implementation. It performs no adaptive-trigger change.
ps5.adtps5.adt(trigger, field, value)Registered direct-call compatibility alias of ps5.set_trigger_effect with no current VM implementation. It performs no adaptive-trigger change. The same name also owns the ps5.adt field constants and ps5.adt.set/raw/clear namespace members.
ps5.clear_feedbackps5.clear_feedback()Sends a Remote Play clear that zeros rumble/player LEDs and releases lightbar ownership. Adaptive triggers are unchanged because their methods are not implemented. Non-Remote-Play hosts reject feedback.
ps5.rumble 5 methods
ps5.rumble.setps5.rumble.set(motor, value)Sends Remote Play rumble to "left", "right", or "both" from 0 to 100. A useful call requires motor and value.
ps5.rumble.leftps5.rumble.left(value)Sends the left Remote Play rumble motor from 0 to 100.
ps5.rumble.rightps5.rumble.right(value)Sends the right Remote Play rumble motor from 0 to 100.
ps5.rumble.bothps5.rumble.both(value)Sends both Remote Play rumble motors from 0 to 100.
ps5.rumble.clearps5.rumble.clear()Sends zero for both script-owned Remote Play rumble motors.
ps5.lightbar 3 methods
ps5.lightbar.setps5.lightbar.set(color_or_r, g?, b?)Sends a Remote Play lightbar command using one #RRGGBB/0xRRGGBB string (including rgb.* constants) or three 0 to 255 bytes. Device support is required.
ps5.lightbar.clearps5.lightbar.clear()Latches a black Remote Play lightbar value. Use reset to release ownership. Device support is required.
ps5.lightbar.resetps5.lightbar.reset()Releases script lightbar ownership back to the Remote Play console.
ps5.player 3 methods
ps5.player.setps5.player.set(number)Sends a Remote Play player indicator from 0 to 4; values clamp and 0 turns it off.
ps5.player.ledps5.player.led(mask)Sends a Remote Play player-LED command using the low five bits of the mask.
ps5.player.clearps5.player.clear()Sends a zero Remote Play player-LED mask.
ps5.adt 3 methods
ps5.adt.setps5.adt.set(field, value)Registered compatibility method with no current VM implementation; it performs no adaptive-trigger change.
ps5.adt.rawps5.adt.raw(trigger, field, value)Registered compatibility method with no current VM implementation; it performs no adaptive-trigger change.
ps5.adt.clearps5.adt.clear(target?)Registered compatibility method with no current VM implementation; it does not clear adaptive-trigger state.
ps4 6 methods
PS4-qualified controller-name properties for use as arguments. This view exposes PlayStation names, including share, and does not expose Xbox a/b/x/y names. Members such as ps4.l2 are strings naming controls, not live input values; read pressure with input.get(ps4.l2) or input.trigger(ps4.l2). Feedback: a DualShock 4 has rumble and a light bar, so ps4 offers ps4.rumble, ps4.set_rumble, ps4.rumble.*, ps4.lightbar, ps4.set_lightbar, ps4.reset_lightbar, ps4.lightbar.*, and ps4.clear_feedback, all through Remote Play output. A DualShock 4 has no player LEDs or player number and no adaptive triggers, so ps4 has no player, player_led, player_number, trigger-effect, or adt members.
ps4.rumbleps4.rumble(left, right?)Sends DualShock 4 Remote Play rumble from 0 to 100; right defaults to left when omitted. Non-Remote-Play hosts reject feedback.
ps4.set_rumbleps4.set_rumble(left, right?)Sends DualShock 4 Remote Play rumble from 0 to 100, like ps4.rumble; right defaults to left when omitted. Non-Remote-Play hosts reject feedback.
ps4.lightbarps4.lightbar(color_or_r, g?, b?)Sends a DualShock 4 Remote Play light bar command using one #RRGGBB/0xRRGGBB string (including rgb.* constants) or three 0 to 255 bytes. Device support is required.
ps4.set_lightbarps4.set_lightbar(color_or_r, g?, b?)Sends a DualShock 4 Remote Play light bar command, like ps4.lightbar, using one #RRGGBB/0xRRGGBB string (including rgb.* constants) or three 0 to 255 bytes. Device support is required.
ps4.reset_lightbarps4.reset_lightbar()Releases script light bar ownership back to the Remote Play console; non-Remote-Play hosts reject feedback.
ps4.clear_feedbackps4.clear_feedback()Sends the same Remote Play clear as output.clear_feedback to the controller the user holds: it zeros rumble and player LEDs and releases light bar ownership, whatever pad is attached, so a DualSense used with a PS4 also has its player LEDs cleared. A DualShock 4 itself has no player LEDs. Adaptive triggers are unchanged. Non-Remote-Play hosts reject feedback.
ps4.rumble 5 methods
ps4.rumble.setps4.rumble.set(motor, value)Sends DualShock 4 Remote Play rumble to "left", "right", or "both" from 0 to 100. A useful call requires motor and value.
ps4.rumble.leftps4.rumble.left(value)Sends the left DualShock 4 Remote Play rumble motor from 0 to 100.
ps4.rumble.rightps4.rumble.right(value)Sends the right DualShock 4 Remote Play rumble motor from 0 to 100.
ps4.rumble.bothps4.rumble.both(value)Sends both DualShock 4 Remote Play rumble motors from 0 to 100.
ps4.rumble.clearps4.rumble.clear()Sends zero for both script-owned DualShock 4 Remote Play rumble motors.
ps4.lightbar 3 methods
ps4.lightbar.setps4.lightbar.set(color_or_r, g?, b?)Sends a DualShock 4 Remote Play light bar command using one #RRGGBB/0xRRGGBB string (including rgb.* constants) or three 0 to 255 bytes. Device support is required.
ps4.lightbar.clearps4.lightbar.clear()Latches a black DualShock 4 Remote Play light bar value. Use reset to release ownership. Device support is required.
ps4.lightbar.resetps4.lightbar.reset()Releases script light bar ownership back to the Remote Play console.
xb 3 methods
Xbox controller-name properties for use as arguments. xb is the Atlas namespace for Xbox One and Xbox Series X|S controllers, including Xbox Remote Play; it is not an Xbox 360 namespace. It exposes Xbox names such as a/b/x/y, lb/rb, lt/rt, ls/rs, menu, view, and home; PlayStation-only names such as cross and touchpad are not members. Members such as xb.lt are normalized name strings ("l2"), not live pressure; read pressure with input.get(xb.lt) or input.trigger(xb.lt), and read a digital button numerically with input.get(xb.x). Feedback: Xbox controllers have rumble only, so xb offers xb.rumble, xb.set_rumble, xb.rumble.*, and xb.clear_feedback through Remote Play output. Xbox controllers have no light bar, no player LEDs or player number, and no adaptive triggers, so xb has no lightbar, player, trigger-effect, or adt members.
xb.rumblexb.rumble(left, right?)Sends Xbox Remote Play rumble from 0 to 100; right defaults to left when omitted. Non-Remote-Play hosts reject feedback.
xb.set_rumblexb.set_rumble(left, right?)Sends Xbox Remote Play rumble from 0 to 100, like xb.rumble; right defaults to left when omitted. Non-Remote-Play hosts reject feedback.
xb.clear_feedbackxb.clear_feedback()Sends the same Remote Play clear as output.clear_feedback to the controller the user holds: it zeros rumble and player LEDs and releases light bar ownership, whatever pad is attached, so a DualSense or DualShock 4 used with an Xbox also has its light bar released and player LEDs cleared. An Xbox controller itself has only rumble. Adaptive triggers are unchanged. Non-Remote-Play hosts reject feedback.
xb.rumble 5 methods
xb.rumble.setxb.rumble.set(motor, value)Sends Xbox Remote Play rumble to "left", "right", or "both" from 0 to 100. A useful call requires motor and value.
xb.rumble.leftxb.rumble.left(value)Sends the left Xbox Remote Play rumble motor from 0 to 100.
xb.rumble.rightxb.rumble.right(value)Sends the right Xbox Remote Play rumble motor from 0 to 100.
xb.rumble.bothxb.rumble.both(value)Sends both Xbox Remote Play rumble motors from 0 to 100.
xb.rumble.clearxb.rumble.clear()Sends zero for both script-owned Xbox Remote Play rumble motors.
network 2 methods
Controls WinDivert network capture. network.capture(filter) starts it (one administrator prompt per Run) and network.stop() ends it. network.active, network.error, network.interface and the received, sent, dropped and failed_open counters report its state. Every member can be used in any event or function, but capture starts only while the script is running: network.capture() works in on_start, on_connect, on_frame, on_input, on_network_recv and on_network_send (and functions they call), and returns false in global initializers and on_stop, with network.error saying why.
network.capturenetwork.capture(filter)Starts or replaces network capture with a WinDivert filter such as "udp and udp.DstPort >= 30000"; an empty filter diverts every packet. Returns true when Atlas accepts the request: capture then starts in the background, network.active becomes true once packets can flow, and network.error explains a failure such as a declined administrator prompt, a WinDivert that is missing or unverified, or a filter WinDivert cannot compile. Returns false when Atlas refuses the request itself: the filter has more than 2048 characters, a character other than printable ASCII, tabs and line breaks, or unbalanced parentheses; starting the network helper already failed in this Run, for example because the administrator prompt was declined; or the script is not running (a global initializer or on_stop). network.error then gives the reason, from that call on, until a request is accepted or the script is loaded or run again. The first call in a Run shows the administrator prompt; later calls reuse the approved helper.
network.stopnetwork.stop()Stops network capture; packets still waiting for a decision pass unchanged. A later network.capture() in the same Run starts again without another administrator prompt. Capture also stops automatically when the script stops.
packet 17 methods
The packet being decided inside on_network_recv() or on_network_send(). Reads its protocol, addresses, ports, lengths and bytes, edits it in place, and packet.drop()/packet.pass() choose its fate. Only valid directly inside the two network events.
packet.bytepacket.byte(offset)Reads one payload byte (0-255) at a payload-relative offset, or null when the offset is past the end of the packet.
packet.set_bytepacket.set_byte(offset, value)Writes one payload byte at a payload-relative offset. The value wraps to 0-255; an offset past the end of the packet does nothing.
packet.bitpacket.bit(offset, bit)Reads one bit (0 = least significant, 7 = most significant) of a payload byte as true or false, or null when the offset or bit is out of range.
packet.set_bitpacket.set_bit(offset, bit, on)Sets (on = true) or clears (on = false) one bit of a payload byte. An offset or bit out of range does nothing.
packet.readpacket.read(type, offset)Reads a typed value from the payload: "u8" "i8" "u16" "i16" "u32" "i32" "f32" "f64", little-endian, with a "be" suffix for big-endian ("u16be"). Returns null for an unknown type or when the value would run past the end of the packet.
packet.writepacket.write(type, offset, value)Writes a typed value into the payload. Integer types truncate toward zero and wrap to the type's width, so -1 written as "u8" is 255; "f32" and "f64" store IEEE-754 values. Does nothing for an unknown type or when the value would run past the end of the packet.
packet.bytespacket.bytes(offset?, count?)Returns payload bytes as an array of numbers. With no arguments, returns the whole payload; with only an offset, the bytes from there to the end. count is clamped to the bytes available, and an offset past the end returns an empty array.
packet.set_bytespacket.set_bytes(offset, bytes)Writes an array of byte values (each wrapped to 0-255) into the payload at a payload-relative offset. Values that would pass the end of the packet are skipped.
packet.hexpacket.hex(offset?, count?)Returns payload bytes as space-separated uppercase hex, such as "78 01 FF", for logging. With no arguments, formats the whole payload; an offset past the end returns an empty string.
packet.copy_topacket.copy_to(record, layout, offset?)Decodes payload bytes into the fields of a struct variable following a layout string like "u8 kind; u16 sequence; i16 sticks[4]", starting at a payload-relative offset (0 by default). Every layout name must be a field of the struct; an array entry stores a new array of the listed count. Returns false, leaving every struct field unchanged, when the layout is invalid, names a field the struct does not have, or would run past the end of the packet.
packet.copy_frompacket.copy_from(record, layout, offset?)Encodes the fields of a struct variable back into the payload using the same layout string. Array entries write the listed count of elements, using 0 for missing elements. Returns false, leaving the packet unchanged, when the layout is invalid, names a field the struct does not have, or would run past the end of the packet.
packet.droppacket.drop()Drops the packet so it is not delivered. A drop takes precedence over any edits made in the same event; packet.pass() cancels it.
packet.passpacket.pass()Cancels an earlier packet.drop() in the same event, so the packet is delivered, including any edits already made. Delivering is the default.
packet.raw_bytepacket.raw_byte(offset)Reads one byte of the whole IP packet (header included) at an absolute offset, or null when the offset is past the end.
packet.raw_set_bytepacket.raw_set_byte(offset, value)Writes one byte of the whole IP packet at an absolute offset. The value wraps to 0-255; an offset past the end does nothing.
packet.raw_readpacket.raw_read(type, offset)Reads a typed value from the whole IP packet at an absolute offset, using the same type names as packet.read. Returns null when the value would run past the end.
packet.raw_writepacket.raw_write(type, offset, value)Writes a typed value into the whole IP packet at an absolute offset, with the same wrapping as packet.write. If the edited packet is no longer a valid IP packet of the same version, or its length field claims more bytes than the packet has, Atlas sends the original packet instead.