Skip to main content

Inspecting a GUI Safely

GUI workflows should stop movement and combat before interacting with a container. This example inspects an already-opening screen without clicking:

local function inspect_screen(title)
hexis.gui.safe_mode()

if not hexis.gui.wait_for({title = title, timeout = 5}) then
return nil, "screen_not_found"
end

local size = hexis.gui.get_container_size()
local slots = hexis.gui.get_slots(0, math.max(0, size - 1))

for _, slot in ipairs(slots) do
if not slot.empty then
hexis.log.info(slot.id .. ": " .. slot.name)
end
end

hexis.gui.close()
return slots, nil
end

Before adding click() or click_item(), document the expected screen title, slot evidence, confirmation state, timeout, and what happens if the server changes the menu.