For the past 5-6 years I used a simple addon that allowed me to switch the action bar as long as I press a certain mouse button. As soon as I release the mouse button the bar switches back to default. Unfortunately with each new WoW addon my tiny addon becomes useless again as it just stops working. The past two times I managed it to get it somehow working again. But this time... my lack of knowledge of Lua and the WoW UI API doesn't really help me this time. :(
Anyway, I could post the code that I already have for the 'new' version but it's a lot more messy than the one from the old version. So I will just take the old one and hope that someone can give me a hint (or even the solution ;)) what to do.
function NWNBarSetButtonAttributes(name, frame, bar, key)
frame:SetHeight(1);
frame:SetWidth(1);
frame:SetPoint("CENTER")
frame:RegisterForClicks("AnyUp","AnyDown")
frame:EnableMouse(false)
frame:SetMovable(true)
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
frame:RegisterEvent("UPDATE_BINDINGS")
frame:SetAttribute("type", "actionbar")
frame:SetScript("OnEvent",
function( self, event, ...)
SetOverrideBindingClick(frame, 0, key, name, "LeftButton");
end
)
end;
function NWNBar_OnLoad()
local name1 = "NWNButton1"
local name2 = "NWNButton2"
local name3 = "NWNButton3"
local nwnButton1 = CreateFrame("Button", name1, UIParent, "SecureActionButtonTemplate")
local nwnButton2 = CreateFrame("Button", name2, UIParent, "SecureActionButtonTemplate")
local nwnButton3 = CreateFrame("Button", name3, UIParent, "SecureActionButtonTemplate")
NWNBarSetButtonAttributes(name1, nwnButton1, 2, "BUTTON4");
NWNBarSetButtonAttributes(name2, nwnButton2, 3, "BUTTON5");
NWNBarSetButtonAttributes(name3, nwnButton3, 4, "BUTTON3");
SecureHandlerWrapScript(nwnButton1, "OnClick", nwnButton1,
[[
owner:SetAttribute("action", down and 2 or 1)
]]
)
SecureHandlerWrapScript(nwnButton2, "OnClick", nwnButton2,
[[
owner:SetAttribute("action", down and 3 or 1)
]]
)
SecureHandlerWrapScript(nwnButton3, "OnClick", nwnButton3,
[[
owner:SetAttribute("action", down and 4 or 1)
]]
)
end;
A few notes:
There is (was) also an xml file that does nothing than defining the NWNBar_OnLoad() function as 'startup' function. In the new version I just create the frame in the lua file.
I also tried using the 'macro' function of Bartender but without success. I asked yesterday in the bartender topic how to achieve what I want but I guess the addon dev probably missed it as he seems to be quite busy right now. :)
(Oh, and it's called NWNBar because the idea is originated from Neverwinter Nights.)
Any help would be really appreciated. :)
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Anyway, I could post the code that I already have for the 'new' version but it's a lot more messy than the one from the old version. So I will just take the old one and hope that someone can give me a hint (or even the solution ;)) what to do.
A few notes:
There is (was) also an xml file that does nothing than defining the NWNBar_OnLoad() function as 'startup' function. In the new version I just create the frame in the lua file.
I also tried using the 'macro' function of Bartender but without success. I asked yesterday in the bartender topic how to achieve what I want but I guess the addon dev probably missed it as he seems to be quite busy right now. :)
(Oh, and it's called NWNBar because the idea is originated from Neverwinter Nights.)
Any help would be really appreciated. :)