• 0

    posted a message on tiny addon to swap action bars
    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:SetAttribute("type", "actionbar")
    	function( self, event, ...)
    			SetOverrideBindingClick(frame, 0, key, name, "LeftButton");
    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)

    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. :)
    Posted in: Lua Code Discussion
  • 0

    posted a message on Bartender4 - Official Topic
    Hopefully anyone can help me with this. I'm trying to switch the bars as long as I press a certain mouse button, similar to the modifier keys. Just using the 'standard' macro doesn't work.

    Just a silly example:


    Quote from "WoWWiki" »

    button:1/2/.../5/<virtual click>

    The "virtual click" can usually be ignored, but if you use a bar mod it can be useful. Action bars that respond to various state changes translate clicks to virtual ones that determine which action to use. Because these virtual clicks are addon-specific, I'm not going to go into any further detail here.

    It sounds like the 'virtual click' is the key to the solution for my problem. Unfortunately I don't know what to use as 'virtual click'. So if anyone can come up with an example it would be much appreciated. :)
    Posted in: General AddOns
  • To post a comment, please or register a new account.