-
Posted by bigglesw0rth on Thu, 17 Feb 2011 05:34:32
So, first addon, I used one of the snippets to check the time on Tol Barad every second, wne when it gets to a certain threshold it triggers a message. I cant help feeling this is a brute-force way to go about checking the timer though. I understand I have "canQueue, startTime, canEnter" info that is returned when I ask for GetWorldPVPAreaInfo(2). What im not sure how to do is, say, trigger the script I want when 'startTime' is between two numbers without having to force-look at it every 1 second like below.
local total = 0 local function onUpdate(self,elapsed) total = total + elapsed if total >= 1 then local _, localizedName, _, canQueue, startTime, canEnter = GetWorldPVPAreaInfo(2) remain = startTime if remain > 903 and remain < 905 then DEFAULT_CHAT_FRAME:AddMessage("Game starts in " .. remain .. " seconds!") RaidWarningFrame_OnEvent(RaidBossEmoteFrame, "CHAT_MSG_RAID_WARNING", format(_G.NEXT_BATTLE, 0, 15, 0)) elseif remain > 303 and remain < 305 then DEFAULT_CHAT_FRAME:AddMessage("Game starts in " .. remain .. " seconds!") RaidWarningFrame_OnEvent(RaidBossEmoteFrame, "CHAT_MSG_RAID_WARNING", format(_G.NEXT_BATTLE, 0, 5, 0)) end total = 0 end end local f = CreateFrame("frame") f:SetScript("OnUpdate", onUpdate)
-
Posted by jnwhiteh on Thu, 17 Feb 2011 14:02:21
You can check startTime, and then start your timer so it counts down from that value until it reaches 0. You can also check every few minutes or so to make sure the time hasn't drifted at all.
-
Posted by bigglesw0rth on Thu, 17 Feb 2011 20:35:05
Thanks, that would be what I was trying to think of, maybe.
Messing around with this, the way you suggested is smiler to this, it basically relies on a looped timer checked against the internal TB clock.
Is there no way to cause some sort of event to trigger when the internal TB clock gets to a certain point without checking it this way? Or is this the best way to go about it?
Thanks for the input.
-
Posted by jnwhiteh on Fri, 18 Feb 2011 20:19:18
No, you'd have to check it. It's slightly possible that an event fires when you can queue for WG.. since the popup happens if you're in the zone. Look at that popup, and see how its triggered.
-
Posted by bigglesw0rth on Sat, 19 Feb 2011 21:35:25
I found http://www.wowpedia.org/Dongle/Timer_API last night. Witch is an improvement over what I was doing, and I assume thats what you had in mind too.
Im going to download DevTools from the utilities section here and see if I cant track down an event that triggers the allowance of TB queueing.
Thanks again.
-
Posted by jnwhiteh on Sat, 19 Feb 2011 22:31:19
You don't need DevTools.. most of them are included natively in the game. You also don't need to use DongleTimer, but given that I wrote it, I won't be offended =)