Count Down Timer
I was wondering if there is a way to add a count down timer to the frame that you click enter dungeon on to show exactly how long you have. Lately ive qued for ramdoms and been in the middle of a quest and would like to lnow how long I have u ntill the window closes.
I am on my phone right now but with /fstack I was able to get the frame name. I would something like Code:
countdowntimer = CreateFrame ("Frame", nil, (the frames name)) Ive seen DBM have a count down stays bar show. But I'm just looking for a numeric count down nothing dance. Ill look threw DBM maybe I can find how they get the timer info. Coke |
Quote:
Lua Code:
just replace SendChatMessage and a few other things with a status bar fill I imagine. |
Quote:
Code:
local PROPOSAL_DURATION = 40 Code:
local PROPOSAL_DURATION = 40 |
Thank you for both versions, ill test it tonight. Now if the 40 seconds is to long all ill need to change is the 40 at the top correct?
Coke EDIT: Will this also work for PvP, or is that a different frame? |
PvP is a different frame, a different event, and possibly a different duration, but the general idea should be the same.
|
Quote:
Code:
local PROPOSAL_DURATION = 90 But the time keeps reseting, I don't think I have the correct event. There are like 6 of them but in the event doc page the other ones are for like World PvP not battlegrounds. Thanks for any help. Coke |
I don't think the event is the issue here, more like the timer onupdate. Elapsed is a time in miliseconds, and the 90 sec timer is a decimal. I can make an example tonight how do it, if noone will do it faster, but i have to leave now.
|
No, elapsed is in seconds.
You could try the BATTLEFIELD_MGR_ENTRY_INVITE event. |
Quote:
Is it something that you plan to release as a standalone addon? |
Quote:
Personally I still need to test the LFG and LFR to see if the time matches. When I'm done ill post the code here if Phanx chooses not to make a stand alone. Coke |
Based on a quick glance at the code in FrameXML\PVPHelper.lua, I'd guess you want BATTLEFIELD_MGR_ENTRY_INVITE as Lombra suggested.
Also, be careful with your global names. "PVPTimerFrame" is already used by a default UI frame, so overwriting it with your own frame is likely to cause some issues. |
Quote:
|
Quote:
However, in addition to your globals being unique, you should also make them identifiable as belonging to your addon -- this way you don't have to check if they're already used by some other addon, and other authors following the same best practice also don't have to check other addons to see if the name is in use. However #2, there's no reason to give these things you're creating global names at all, since you're not using Blizzard templates that require them. |
BATTLEFIELD_MGR_ENTRY_INVITE doesn't seem to work. If I select "Leave Queue" then sign up again it continues to count down from were it left off.
Will look go hunting around the interweb to see if I can find a solution. Coke |
Upon further reading in the default UI code, you probably want UPDATE_BATTLEFIELD_STATUS after all, but you need to do an additional check to see whether the event is relevant:
Code:
f:RegisterEvent("UPDATE_BATTLEFIELD_STATUS") |
Quote:
This addon is called SafeQueue. Here is the new code im using. Code:
-- Provided by Phanx from WoWInterface Now just if I can figure out where wow pulls the time to close the LFG popup like they do for the Battleground. Thanks Coke |
I believe Phanx mentioned at the start of the thread that there is no API to derive the timeout for LFR/LFD. You can surely adapt the code you borrowed from SafeQueue to use the 40 second time-frame (also mentioned by Phanx) instead of a time returned by a function call.
|
The popup is closed in response to other events. There is no timer.
|
Quote:
Sources are: http://wowprogramming.com/utils/xmlb...L/LFGFrame.lua In this function: Code:
function LFGInvitePopup_Update(inviter, roleTankAvailable, roleHealerAvailable, roleDamagerAvailable) Code:
self.timeOut = STATICPOPUP_TIMEOUT; Code:
function LFGInvitePopup_OnUpdate(self, elapsed) Now in this file:http://wowprogramming.com/utils/xmlb...taticPopup.lua This is at the top of the file: Code:
STATICPOPUP_TIMEOUT = 60; The one thing im not sure of would be the f:SetScript("OnEvent" function(self, event) -- code) In the Phanx example I got is show a self:Show() and a self.Hide() would that be all that is needed? Here is my proposed code for the LFG (also while scrolling threw those codes I notice that this was at the top of the code --LFG is used for for generic functions/values that may be used for LFD, LFR, and any other LF_ system we may implement in the future. so it should work on raids as well) Here is the code: Code:
local PROPOSAL_DURATION = 60 Coke |
You're not using OnUpdate correctly. You're setting your "remaining" variable to 0 every time your script runs, and setting "sec" to 60, and then checking a variable named "secs" that isn't defined anywhere, and then checking if "remaining" and "secs" are not equal which (assuming the "sec" definition is actually meant to be "sec") will always pass because 0 will never be equal to 60 and those are the only values those variables can ever have, and you're not actually keeping track of how much time has elapsed at all.
Code:
-- This variable needs to be outside of the OnUpdate so it persists between executions: |
All times are GMT -6. The time now is 08:43 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI