Code:
local timer = 0.263local f = CreateFrame("Frame");
f:Hide();
f:SetScript("OnUpdate",function(self,elapsed)
f.delay = f.delay - elapsed;
if f.delay <= 0 then
_G[f.popup.."Button1"]:Click();
f:Hide();
end
end);
hooksecurefunc(StaticPopupDialogs["CONFIRM_BATTLEFIELD_ENTRY"],"OnAccept",function(self,data) f.popup = StaticPopup_Visible("GOSSIP_CONFIRM");
if f.popup then
local _,_,home,world = GetNetStats();
local fps = GetFramerate();
f.delay = timer-(1/fps);
f:Show();
end
end);
The above works. When I press enter battle with the XP elimination confirmation open it clicks both after a .263 second delay.
But the following, for some reason, does not. Why? It's supposed to click "I no longer wish to gain XP" and confirm it at the same time (which works outside of this) after clicking Enter Battle.
Code:
local timer = 0.263local f = CreateFrame("Frame");
f:Hide();
f:SetScript("OnUpdate",function(self,elapsed)
f.delay = f.delay - elapsed;
if f.delay <= 0 then
local g = GetGossipOptions()
if g=="I no longer wish to gain experience." then
SelectGossipOption(1,"",true)
end
f:Hide();
end
end);
hooksecurefunc(StaticPopupDialogs["CONFIRM_BATTLEFIELD_ENTRY"],"OnAccept",function(self,data)
local _,_,home,world = GetNetStats();
local fps = GetFramerate();
f.delay = timer-(1/fps);
f:Show();
end);