developer_center:developer_editor:countdown_time
Countdown time
local start_button = nil --- replace your Start Button here local enter_min = nil --- replace your input box ID here local enter_sec = nil --- replace your input box ID here local display_time = nil --- replace your text here local mins = 0 --- replace the mins you want to countdown local secs = 0 --- replace the secs you want to countdown local uiid = nil --- replace your UI ID here function enter_time_to_countdown_(obj) if obj.uielement == enter_min then mins = tonumber(obj.content) or 0 -- Convert input to number end if obj.uielement == enter_sec then secs = tonumber(obj.content) or 0 -- Convert input to number end Chat:sendSystemMsg(mins .. " and " .. secs) end ScriptSupportEvent:registerEvent("UI.Lost.Focus", enter_time_to_countdown_) function countdown(e) if e.uielement == start_button then repeat if secs == 0 and mins > 0 then mins = mins - 1 secs = 59 elseif secs > 0 then secs = secs - 1 end Customui:setText(e.eventobjid, uiid, display_time, mins .. ":" .. (secs < 10 and "0" or "") .. secs) Trigger:wait(1) until mins == 0 and secs == 0 end end ScriptSupportEvent:registerEvent("UI.Button.Click", countdown)
developer_center/developer_editor/countdown_time.txt · Last modified: 2024/07/03 08:55 by don