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))
local result = cfg:build():show()
if type(result) ~= "table" then return end
-- Selection controls return the selected option text.
local modSecim = result["mod"] or "Normal"
local bolgeSecim = result["bolge"] or "Tam Ekran"
-- Moda gore gecikme belirle
local gecikmeler = {Yavas = 1000, Normal = 500, Hizli = 200, ["Cok Hizli"] = 50}
local gecikme = gecikmeler[modSecim] 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 bolgeIndeksleri = {
["Tam Ekran"] = 1,
["Ust Yari"] = 2,
["Alt Yari"] = 3,
["Orta Alan"] = 4
}
local b = bolgeler[bolgeIndeksleri[bolgeSecim] or 1]
local region = Region(b[1], b[2], b[3], b[4])
toast("Mod: " .. modSecim .. ", Gecikme: " .. gecikme .. "ms")