Hi all,
I have posted an help / search request in the addons forum looking for addons that can disable the tooltip from the actionbars.
As usual, my question was kindly answered fast and correctly.
Here was the post:
http://www.wowinterface.com/forums/s...ad.php?t=52130
I have tried to go further and create a minimal addon that can automagically swap tooltip state combat base but I really have to understand that I have some limit in understand lua principles and basis :/
Here is the code:
Lua Code:
-- tooltip code by munkdev
-- [url]http://www.wowinterface.com/forums/showthread.php?t=52130[/url]
-- Thanks :-)
local ADDON = ...
local TOOLTIPDISABLED = 0
local prgname = "|cffffd200ToolTipDisable|r"
GameTooltip.HideAction = true
function GameTooltip:ToggleAction()
self.HideAction = not self.HideAction
end
GameTooltip:HookScript("OnShow", function(self)
local actionButton = self:GetOwner() and self:GetOwner().HotKey
if actionButton and self.HideAction then
self:Hide()
end
end)
local f = CreateFrame("Frame")
f:SetScript("OnEvent", function ()
if UnitAffectingCombat("player") == true then
if TOOLTIPDISABLED == 0 then
GameTooltip:ToggleAction()
TOOLTIPDISABLED = 1
end
else
if TOOLTIPDISABLED == 1 then
GameTooltip:ToggleAction()
TOOLTIPDISABLED = 0
end
end
end)
f:RegisterEvent("ACTIONBAR_UPDATE_STATE")
SLASH_TTD1 = "/ttd";
SlashCmdList["TTD"] = function()
if TOOLTIPDISABLED == 1 then
TOOLTIPDISABLED = 0
else
TOOLTIPDISABLED = 1
end
GameTooltip:ToggleAction()
print (prgname .. " ActionsBars Tooltips Switch")
end
The code is very ugly but it works even if half way, and it is a a good thing for now (at least it has no error :-)
1ST Problem:
- When it starts, it starts with tooltips disabled because I have not yet called the GameTooltip:ToggleAction().
Then it works as expected toggling enter/leaving from combat.
So first question is:
Is possible to call the GameTooltip:ToggleAction() only from inside the unit in combat event ?
I was not able to code in this way (but I have not yet fully understood the code by munkdev so :-)
And the choice of the event ACTIONBAR_UPDATE_STATE is the correct one or it is fired too many times ?
2ND Problem:
I am not so confident that the IF statement on the enter combat condition and exit condition are always true and so the conditions are always correctly evaluated. Can you suggest a better practice to manage such conditions ?
Thanks very much for any help or attention.