zebus 0 Report post Posted January 25, 2017 http://addons.us.to/addon/flexbar-0 Action bar addon that has ability to effect buttons based on events, one of those events is cooldown start and finish. However, it is seeing every global cooldown as both a cooldown start and finish for the ability.. making it pretty much useless for this function. The code reads like this, local start = GetActionCooldown(button:GetID()); if start ~= 0 then return true I thought changing it to > 1.5 would fix the issue but it's still doing it, so then decided I just don't know enough about lua and thought I'd ask you guys for help. 0 Share this post Link to post Share on other sites
zebus 0 Report post Posted January 26, 2017 (edited) 1 hour ago, Jorn Skyseer said: Umm... if not(start==0)then ? Which value are you looking for? I fail to find your question. Is it the moment when a cd ends? Basically the addon picks up on events using conditionals which the user can then use to do stuff to his action bars. I set an event to show a button when the ability on it goes on cooldown, and then hide it when it comes off cooldown. However as written it is seeing every global cooldown as the ability both entering and leaving cooldown. So if I was to cast any ability the button would appear for 1.5s then disappear if off cooldown, which is weird because I don't remember having that issue with it back in the day. So I want it to ignore global cooldowns and only trigger when the ability is actually used and goes on cooldown. Like I said, I know nothing about lua, I might not even be looking at the right area of the code as the culprit. Edited January 26, 2017 by zebus 0 Share this post Link to post Share on other sites
sipertruk 0 Report post Posted January 26, 2017 local _, duration = GetActionCooldown(slot) if duration > 1.5 then -- it's not the gcd 0 Share this post Link to post Share on other sites
zebus 0 Report post Posted January 26, 2017 (edited) 1 hour ago, sipertruk said: local _, duration = GetActionCooldown(slot) if duration > 1.5 then -- it's not the gcd Hmm, ok, makes sense, made the following changes but for some reason it's still returning true and showing the button when gcd triggers, does it look right? Here is the entire block from the lua FBConditions["incooldown"] = function(target) if not target then return false end if type(target) ~= "table" then target = { target } end local index, value for index, value in pairs(target) do if type(value) == "number" then local button = FB_GetWidgets(value) local duration = GetActionCooldown(button:GetID()); if duration > 1.5 then return true end end end return false end *edit* Ok got it fixed, for some reason > 2 worked but not 1.5 which is totally fine. Thanks for your help. Edited January 26, 2017 by zebus 0 Share this post Link to post Share on other sites
Gorstavich 1 Report post Posted January 26, 2017 (edited) I will say upfront that it has been literally a decade since I last played with FlexBar, which is a seriously awesome for custom button mapping, and there is a ton that I'm probably not remembering correctly. That said, I was wondering if you've tried using the 'IsUsable' and 'NotUsable' conditions instead of 'Cooldown', or alternatively add in=400 (400 being 40 seconds that the button would be on cooldown, adjust as needed) at the end of the show command? Edited January 26, 2017 by Gorstavich 0 Share this post Link to post Share on other sites
sipertruk 0 Report post Posted January 26, 2017 (edited) In your code you forgot _, You need the second value returned by the function which is the duration, the first being the start time so your code'll return true in a gcd. local _, duration = GetActionCooldown(slot) ^ GetActionCooldown's complete prototype is : start, duration, enable = GetActionCooldown(slot) Edited January 26, 2017 by sipertruk 0 Share this post Link to post Share on other sites