Skip to content

events

Event registration and dispatch for scripts to hook engine/game lifecycle moments via cheat.Register.

cheat.Register("onUpdate", function() ... end)

Fires every engine frame tick, the fast per-frame update loop.

cheat.Register("onUpdate", function()
-- runs every frame
end)

cheat.Register("onSlowUpdate", function() ... end)

Fires on a slower, throttled update cadence for less time-sensitive polling work.

cheat.Register("onSlowUpdate", function()
-- runs on a throttled cadence
end)

cheat.Register("onPaint", function() ... end)

Fires once per rendered overlay frame, for draw-related script logic.

cheat.Register("onPaint", function()
-- runs once per overlay paint
end)

cheat.Register("newPlace", function() ... end)

Fires when the game’s DataModel resolves to a new place, e.g. after a server hop or teleport.

cheat.Register("newPlace", function()
print("joined a new place")
end)

cheat.Register("characterAdded", function() ... end)

Fires when the local player’s Character instance appears. Detection is polled and only runs while a handler is registered for this event.

cheat.Register("characterAdded", function()
print("character spawned")
end)

cheat.Register("characterRemoving", function() ... end)

Fires when the local player’s Character instance is about to be removed, detected via polled detection.

cheat.Register("characterRemoving", function()
print("character despawning")
end)

cheat.Register("shutdown", function() ... end)

Fires when the external tool is shutting down, for cleanup work. A shutdown handler on its own does not keep a script resident.

cheat.Register("shutdown", function()
print("cleaning up")
end)

cheat.Register(eventName: string, handler: function): void

Registers a handler function to be called whenever the named event fires; unknown event names raise a Lua error.

cheat.Register("onUpdate", function()
-- handler body
end)

cheat.GetWindowSize(): (width: number, height: number)

Returns the current game camera viewport size in pixels, or (0, 0) if it cannot be resolved.

local w, h = cheat.GetWindowSize()
print(w, h)