Game windows and controlsLua table
Inspect current game dialogs and controls, click a live control, and switch control modes.
These experimental calls operate on the game's existing windows. They are separate from the ui and ui_sdk functions that draw your own module window. Check availability in the installed runtime and handle nil, error.
Dialog and control records
game._dialog_window_rows()
No arguments. Returns an ordered array of {object, id, status, name} or nil, error. object, id, and status are integers; name is a string. object is an opaque short-lived token. id and status are game-defined values, not an enumeration documented here. Do not interpret every nonzero status as visible or enabled.
game._control_rows()
No arguments. Returns an ordered array of {recursive_object, x, y, w, h, type, label} or nil, error. The first six fields are integers and label is a string. The rectangle describes the captured control geometry; no conversion to monitor pixels is promised. type is a game-defined category code.
recursive_object is an opaque control token for the click function below. Do not construct it, modify it, save it, or reuse it across character/area/window changes. The function fails rather than publishing a detected changing control collection.
game._click_control(recursiveObject)
Requires exactly one integer control token from a fresh _control_rows() capture. Returns true when a supported button click is dispatched, or nil, error for a stale or unsupported control. A control row is not necessarily clickable. This does not move the cursor or guarantee that a dialog closes; inspect the game window state on a later tick.
Keep consequential clicks tied to explicit user intent. Do not repeatedly click a purchase, deletion, reward, or confirmation control while waiting for the result.
function on_start()
if type(game._dialog_window_rows) ~= "function" then
return
end
local windows, err = game._dialog_window_rows()
if not windows then
log.warn(err)
return
end
for _, window in ipairs(windows) do
log.info(string.format("%s: status %d", window.name, window.status))
end
endInput modes
game.control_mode()
No arguments. Returns integer 1 for Action or 2 for Classic, or nil, error when unavailable. The existing facade also provides sdk.control_mode().
game.set_control_mode(mode)
Requires one integer, 1 for Action or 2 for Classic. Returns true when already in that mode or when the mode changes and a read confirms it, otherwise nil, error. A script should remember the previous mode before changing it and handle restoration failure. The existing facade also provides sdk.set_control_mode().
Combat documents skill shortcuts; hotkeys reads user key state without generating game input.