Skip to main content
What every script has without an import.
Logic goes in tick (128 Hz), drawing in render (once per overlay frame). render.* draw calls anywhere else throw.

Overview

Events

on, emit, addEventListener, event types.

Subscriptions

Subscription, signal, once.

Timers

setTimeout, setInterval.

console and script

Log levels, console.inspect, manifest data.

Events

The global object is an EventTarget. on and emit are shortcuts on it; addEventListener and on<type> properties see the same events.

on


Adds a listener and returns a Subscription.

emit


Dispatches a CustomEvent on the global object, synchronously. detail is null when omitted. Returns false if a listener called preventDefault().
Augmenting ScriptCustomEvents types detail for both calls.

addEventListener and handler properties


The standard API works on the same events. A handler property holds one function; assigning replaces it, null removes it.

Event types


Everything a script owns is released after unload, so there’s nothing to clean up by hand.

Input event fields


Fields follow the DOM. preventDefault() on input events does nothing; the game still gets the input.

Errors


Exceptions from listeners, timers, ui handlers and ESP evaluators land in error. Unhandled rejections land in unhandledrejection. Both go to the log unless you call preventDefault().

Subscriptions

on and every other subscribe-style call (ui .on(...), ui.effect, key binds) return a Subscription: a function that unsubscribes when called. .dispose() and [Symbol.dispose] do the same. Dropping the function does not unsubscribe.

Timers

setTimeout, setInterval, clearTimeout and clearInterval work as in a browser. Callbacks run at most once per tick, so setInterval(fn, 0) repeats every tick.
A listener or timer that runs for more than 2 seconds is stopped and the script is marked as errored.

console

Output goes to the cheat log, tagged with the script name. Objects print inspected ({ a: 1 }) and printf placeholders (%s, %d, %o, …) work.

console.inspect


Returns what console.log(value) would print, without printing it. depth defaults to 2.

script

Frozen metadata from manifest.json, read-only.

Web runtime

Standard web APIs (fetch, URL, TextEncoder, crypto, …) are globals too, see Web APIs and Networking. Storage is localStorage.

Example

A hotkey that toggles a crosshair, with the state kept across reloads.