diff --git a/api/ui-widgets.lua b/api/ui-widgets.lua index 4d695613..40e2b822 100644 --- a/api/ui-widgets.lua +++ b/api/ui-widgets.lua @@ -1172,10 +1172,9 @@ function pfUI.api.CreateQuestionDialog(text, yes, no, editbox, onclose) local width = 200 -- delay the auto sizing, to make sure the font rendering happened - question:SetScript("OnUpdate", function() + RunNextFrame(function() if question.text:GetStringWidth() > width then width = question.text:GetStringWidth() end - question:SetWidth( width + 2*padding) - this:SetScript("OnUpdate", nil) + question:SetWidth(width + 2*padding) end) end diff --git a/libs/libdebuff.lua b/libs/libdebuff.lua index bcafd453..64657b02 100644 --- a/libs/libdebuff.lua +++ b/libs/libdebuff.lua @@ -44,15 +44,13 @@ if GetNampowerVersion then end -- Nampower startup check: show version info and ensure CVars are set. --- Runs on first OnUpdate after PLAYER_ENTERING_WORLD to give Nampower time to initialize. +-- Runs the frame after PLAYER_ENTERING_WORLD so Nampower has finished initializing. local nampowerCheckFrame = CreateFrame("Frame") nampowerCheckFrame:RegisterEvent("PLAYER_ENTERING_WORLD") nampowerCheckFrame:SetScript("OnEvent", function() - -- Defer to next frame so Nampower is fully initialized - this:SetScript("OnUpdate", function() - this:SetScript("OnUpdate", nil) - this:UnregisterAllEvents() - this:SetScript("OnEvent", nil) + this:UnregisterAllEvents() + this:SetScript("OnEvent", nil) + RunNextFrame(function() if GetNampowerVersion then local major, minor, patch = GetNampowerVersion() diff --git a/modules/autovendor.lua b/modules/autovendor.lua index 397a0ec2..68dcccc6 100644 --- a/modules/autovendor.lua +++ b/modules/autovendor.lua @@ -19,12 +19,7 @@ pfUI:RegisterModule("autovendor", function () local startGold = GetMoney() C_MerchantFrame.SellAllJunkItems() - local reporter = CreateFrame("Frame") - reporter.deadline = GetTime() + 0.3 - reporter:SetScript("OnUpdate", function() - if GetTime() < this.deadline then return end - this:SetScript("OnUpdate", nil) - this:Hide() + C_Timer.After(0.3, function() local income = GetMoney() - startGold if income > 0 then DEFAULT_CHAT_FRAME:AddMessage(T["Your vendor trash has been sold and you earned"] .. " " .. CreateGoldString(income)) diff --git a/modules/bubbles.lua b/modules/bubbles.lua index 692882ea..302075cb 100644 --- a/modules/bubbles.lua +++ b/modules/bubbles.lua @@ -12,7 +12,9 @@ pfUI:RegisterModule("bubbles", function () pfUI.bubbles:RegisterEvent("CHAT_MSG_MONSTER_PARTY") pfUI.bubbles:SetScript("OnEvent", function() - pfUI.bubbles:SetScript("OnUpdate", pfUI.bubbles.ScanBubbles) + -- Bubble frames are attached to WorldFrame after the chat event fires, + -- so wait one tick before scanning. + RunNextFrame(function() pfUI.bubbles:ScanBubbles() end) end) function pfUI.bubbles:IsBubble(f) @@ -66,7 +68,5 @@ pfUI:RegisterModule("bubbles", function () end) end end - - pfUI.bubbles:SetScript("OnUpdate", nil) end end) diff --git a/modules/focus.lua b/modules/focus.lua index 22c8db9c..abacb340 100644 --- a/modules/focus.lua +++ b/modules/focus.lua @@ -50,10 +50,8 @@ function SlashCmdList.PFFOCUSNAME(msg) FocusUnit("target") end - local restore = CreateFrame("Frame") - restore:SetScript("OnUpdate", function() + RunNextFrame(function() UIErrorsFrame:RegisterEvent("UI_ERROR_MESSAGE") - restore:SetScript("OnUpdate", nil) end) if prevGUID and prevGUID ~= "0x0000000000000000" then diff --git a/modules/innervatecall.lua b/modules/innervatecall.lua index f6f44fa3..4ae3ebd0 100644 --- a/modules/innervatecall.lua +++ b/modules/innervatecall.lua @@ -96,14 +96,10 @@ pfUI:RegisterModule("innervatecall", function () end end - local readyAt = GetTime() + cdRemaining - frame:SetScript("OnUpdate", function() - if GetTime() >= readyAt then - frame:SetScript("OnUpdate", nil) - local ch = GetAnnounceChannel() - if ch then - SendChatMessage(">> Innervate is ready <<", ch) - end + C_Timer.After(cdRemaining, function() + local ch = GetAnnounceChannel() + if ch then + SendChatMessage(">> Innervate is ready <<", ch) end end) end) diff --git a/modules/macrotweak.lua b/modules/macrotweak.lua index 7fc2657f..026ce3dc 100644 --- a/modules/macrotweak.lua +++ b/modules/macrotweak.lua @@ -66,9 +66,5 @@ pfUI:RegisterModule("macrotweak", function () end) -- Check conflicts after one tick so all addons have finished loading - local watcher = CreateFrame("Frame") - watcher:SetScript("OnUpdate", function() - this:SetScript("OnUpdate", nil) - CheckConflicts() - end) + RunNextFrame(CheckConflicts) end) \ No newline at end of file