Thread Tools Display Modes
06-12-09, 03:57 PM   #1
Cralor
Mmm... cookies!!!
 
Cralor's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2007
Posts: 772
Rune cooldowns and GetRuneCooldown()

Hey. I'm running into an issue that I'd like to clarify here.

For one, whenever I use a Frost-type spell, it triggers the Unholy rune's cooldown (Blizzard-created). If I use an Unholy-type spell, it triggers the Frost rune's cooldown. And the Blood runes just do not show a cooldown.

At the same time, my addon's function to make the runes darker when they are not usable is working 90% of the time. It might not get darker while a rune is doing its cooldown, or it might. It always works for the Blood runes, and it only works for the Frost ones once I used up my Unholy runes.

To make things shorter: my own addon's function is working fine (but not 100% effectively), but it is interfering with the Blizzard code in some way to make the cooldown frame messed up. I must be interfering with the Blizzard code in some way or another.

Here is my code: http://pastey.net/115911/51:156

If you need to see the addon in action, I can send a PM with an attached file of my current local revision.

Thank you for your time!
__________________
Never be satisfied with satisfactory.
  Reply With Quote
06-15-09, 02:13 PM   #2
Cralor
Mmm... cookies!!!
 
Cralor's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2007
Posts: 772
Anyone got an idea?
__________________
Never be satisfied with satisfactory.
  Reply With Quote
06-15-09, 02:50 PM   #3
Slakah
A Molten Giant
 
Slakah's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 863
Just taking a glance over your code and your doing this:
Code:
runes[rune]:SetScript("OnUpdate", function(self, elapsed) Button_OnUpdate(self, elapsed, runes[rune]:GetID()) end);
Which I have a feeling will be overwriting Blizzards OnUpdate thus causing your problem.

I'll take a deeper look into it tomorrow but I need sleep :P.
  Reply With Quote
06-15-09, 04:34 PM   #4
Akryn
A Firelord
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 479
Originally Posted by Slakah View Post
Just taking a glance over your code and your doing this:
Code:
runes[rune]:SetScript("OnUpdate", function(self, elapsed) Button_OnUpdate(self, elapsed, runes[rune]:GetID()) end);
Which I have a feeling will be overwriting Blizzards OnUpdate thus causing your problem.

I'll take a deeper look into it tomorrow but I need sleep :P.
Oh of course that's it; dunno how I missed that. You'll want to use :HookScript() instead.
  Reply With Quote
06-15-09, 04:38 PM   #5
Cralor
Mmm... cookies!!!
 
Cralor's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2007
Posts: 772
Thanks

I'll see how this pans out.
__________________
Never be satisfied with satisfactory.
  Reply With Quote
06-15-09, 06:40 PM   #6
Cralor
Mmm... cookies!!!
 
Cralor's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2007
Posts: 772
The success rate of the function seems to be better so I think the HookScript helped.

Does anyone happen to know how I can hide the Blizzard cooldown overlay?

I've been trying this:
Code:
local cooldown = _G["RuneButtonIndividual"..i.."Cooldown"]
cooldown:Hide()
Doesn't seem to work.

Also, I'm trying to figure out how to tell if the default runes are active.

I've tried:
if RMDB.images == "0"
local setting
artwork file path check

None seem to work witch is odd. Any ideas? Probably an obvious one I am missing that could be used.

Thanks.
__________________
Never be satisfied with satisfactory.
  Reply With Quote
06-16-09, 02:27 PM   #7
Slakah
A Molten Giant
 
Slakah's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 863
The success rate of the function seems to be better so I think the HookScript helped.

Does anyone happen to know how I can hide the Blizzard cooldown overlay?

I've been trying this:
Code:
local cooldown = _G["RuneButtonIndividual"..i.."Cooldown"]
cooldown:Hide()
Doesn't seem to work.
Blizzard will show the cooldown frame when it goes on cooldown and hide after, so the easiest way to hide it forever is to either turn :Show() into a dummy function:
Code:
_G["RuneButtonIndividual"..i.."Cooldown"].Show = function() end
or Hide it when it's shown via
Code:
local cooldown = _G["RuneButtonIndividual"..i.."Cooldown"]
cooldown:SetScript("OnShow", cooldown.Hide)
Hope this helps.
  Reply With Quote
06-16-09, 02:53 PM   #8
Cralor
Mmm... cookies!!!
 
Cralor's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2007
Posts: 772
Will
Code:
_G["RuneButtonIndividual"..i.."Cooldown"].Show = function() end
Make it so it will only show if I call that function?

Because although I want to hide it, there are times where I want it to still be shown.
__________________
Never be satisfied with satisfactory.
  Reply With Quote
06-16-09, 06:58 PM   #9
Cralor
Mmm... cookies!!!
 
Cralor's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2007
Posts: 772
Ok.

I've added the above code but I cannot figure out how to show the cooldown for when the player is using the Default runes. I've tried adding code to disable the script, but it is not working.

Also, once I use the Unholy runes, they do not come back from "dull" state (when they should go back to VertexColor(1,1,1,1)).

Thanks!
__________________
Never be satisfied with satisfactory.
  Reply With Quote
06-16-09, 09:41 PM   #10
Akryn
A Firelord
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 479
I would probably have used :HookScript to re-hide the frame, to avoid possible tainting issues...but if you want to do it that way:

Code:
local f = _G["RuneButtonIndividual"..i.."Cooldown"]
f.Show_Old = f.Show
f.Show = function(reallyShow)
    if reallyShow then
        self:Show_Old()
    end
end
Note that I actually have no idea if that will work.
  Reply With Quote
06-17-09, 01:20 PM   #11
Cralor
Mmm... cookies!!!
 
Cralor's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2007
Posts: 772
So what would I do when I want to show it? Would I define reallyShow? Or would I call by f.Show(reallyShow);?

Need to understand the code a little bit better.

Thanks.
__________________
Never be satisfied with satisfactory.
  Reply With Quote
06-17-09, 01:26 PM   #12
Slakah
A Molten Giant
 
Slakah's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 863
Code:
local function dummy() end

local cooldown = _G["RuneButtonIndividual"..i.."Cooldown"]
cooldown.Show = dummy
cooldown:Hide()
To Hide

Code:
local cooldown = _G["RuneButtonIndividual"..i.."Cooldown"]
cooldown.Show = nil
cooldown:Show()
To Show

:Show() is kept in an __index metatable for the cooldown frame, so doing cooldown.Show = dummy, doesn't overwrite :Show() it just overrides it, so removing the dummy using cooldown.Show = nil, means that when calling :Show() it will look to the metatable instead of calling dummy and call the real :Show() function.

Hope this helps
  Reply With Quote
06-17-09, 01:43 PM   #13
Cralor
Mmm... cookies!!!
 
Cralor's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2007
Posts: 772
Should it be:
cooldown.Show = dummy()

Because I've added the code you (Slakah) just posted and the "show" code in its correct area, but it continues to show no matter what.

Thanks.
__________________
Never be satisfied with satisfactory.
  Reply With Quote
06-17-09, 02:19 PM   #14
Slakah
A Molten Giant
 
Slakah's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 863
Originally Posted by Cralor View Post
Should it be:
cooldown.Show = dummy()

Because I've added the code you (Slakah) just posted and the "show" code in its correct area, but it continues to show no matter what.

Thanks.
Nope it should be cooldown.Show = dummy, can you post the code please?
  Reply With Quote
06-17-09, 02:42 PM   #15
Cralor
Mmm... cookies!!!
 
Cralor's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2007
Posts: 772
http://pastey.net/116217/29:30:31:115:116

Thanks.
__________________
Never be satisfied with satisfactory.
  Reply With Quote
06-17-09, 02:47 PM   #16
Slakah
A Molten Giant
 
Slakah's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 863
You need to put

local function dummy() end
cooldown.Show = dummy()
cooldown:Hide()

inside the for loop, each of the cooldown frames needs this change applied to it.
  Reply With Quote
06-17-09, 02:58 PM   #17
Cralor
Mmm... cookies!!!
 
Cralor's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2007
Posts: 772
http://pastey.net/116218

Still shows up when not using Default runes.
__________________
Never be satisfied with satisfactory.
  Reply With Quote
06-17-09, 05:10 PM   #18
Akryn
A Firelord
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 479
To answer your question to me, you would just do :Show(true) to make it show, using my code.

As I said originally though, I would really just do a :HookScript on OnShow, and have that function just re-hide the frame unless some variable is set.
  Reply With Quote
06-18-09, 09:10 AM   #19
Cralor
Mmm... cookies!!!
 
Cralor's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2007
Posts: 772
Okay it hides perfectly fine now, but it still won't show up when I use Default runes (which is when I want it to show).

http://pastey.net/116248/19:25:104:113:116

Thanks.
__________________
Never be satisfied with satisfactory.
  Reply With Quote
06-18-09, 11:30 AM   #20
Akryn
A Firelord
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 479
Originally Posted by Cralor View Post
Code:
if ready == true then 
       cooldown:HookScript("OnShow", cooldown.Hide) 
end
should be...

Code:
cooldown:HookScript("OnShow", function(self) if not ready then self:Hide() end end)
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Rune cooldowns and GetRuneCooldown()


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off