Ready-to-use Code ExamplePanelDebuggingHUDState

Floating Debug HUD (Panel)

Uses Panel as a debug HUD: it shows live script state, remembers the user’s drag position, and stops the macro when the panel is closed. `Panel.isVisible`, `Panel.isAvailable`, `Panel.getX` and `Panel.getY` only read state and are safe in tight loops.

Completion, parameter hints and type checking. Installation instructions and downloads are hosted on GitHub.

Copyable Example Code

You can paste this into the code editor; still verify target image, region, color, text, and timing values in your own device flow.

-- Floating debug panel

Panel.show()
Panel.setOpacity(0.85)

-- Restore the saved position
local savedX = KV.getNumber("panel_x", 100)
local savedY = KV.getNumber("panel_y", 200)
Panel.setPosition(savedX, savedY)

for iteration = 1, 50 do
  -- Stop when the user closed the panel
  if not Panel.isAvailable() then
    toast("Panel closed, stopping")
    break
  end

  -- Save the position when the user moved the panel
  local currentX = Panel.getX()
  local currentY = Panel.getY()
  if currentX ~= savedX or currentY ~= savedY then
    KV.set("panel_x", currentX)
    KV.set("panel_y", currentY)
    savedX, savedY = currentX, currentY
  end

  -- Scan only while the panel is visible
  if Panel.isVisible() then
    -- ... your scan logic ...
  end

  wait(500)
end

Panel.hide()

Implementation and Adaptation Notes

  • Before running, replace sample values such as image names, text, colors, coordinates, and file paths with your own macro values.
  • For examples that use Region or coordinates, retest the target area on different resolutions and DPI values.
  • Tune mScore, timeout, and scan rate in a test macro first, then move the verified values into the production macro.