Ready-to-use Code ExampleSettingDialogRadioGroup

Dialog: Radio Group

Uses RadioGroup to let the user pick one option from multiple choices. Used in mode selection, speed settings, etc. Selected value is read as an index number.

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.

-- Dialog: Tekli secim / Dialog: Radio group
-- RadioGroup ile mod secimi

local cfg = Setting.builder()
cfg:setTitle("Mod Secimi")

cfg:add("mod", RadioGroup({"Yavas", "Normal", "Hizli", "Cok Hizli"}, 1))
cfg:add("bolge", RadioGroup({"Tam Ekran", "Ust Yari", "Alt Yari", "Orta Alan"}, 0))

Setting.setDialog(cfg:build())
Setting.show()

-- Seçimi oku (0-tabanlı indeks)
local modSecim = tonumber(Setting.get("mod")) or 1
local bolgeSecim = tonumber(Setting.get("bolge")) or 0

-- Moda gore gecikme belirle
local gecikmeler = {1000, 500, 200, 50}
local gecikme = gecikmeler[modSecim + 1] or 500

-- Bolgeye gore Region belirle
local tamEkran = Region()
local sw = tamEkran:getW()
local sh = tamEkran:getH()
local bolgeler = {
  {0, 0, sw, sh},
  {0, 0, sw, math.floor(sh / 2)},
  {0, math.floor(sh / 2), sw, sh - math.floor(sh / 2)},
  {math.floor(sw * 0.18), math.floor(sh * 0.20), math.floor(sw * 0.64), math.floor(sh * 0.58)}
}
local b = bolgeler[bolgeSecim + 1]
local region = Region(b[1], b[2], b[3], b[4])

toast("Mod: " .. modSecim .. ", Gecikme: " .. gecikme .. "ms")

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.