• 0

    posted a message on Bartender Bar Toggler
    Still getting the same errors with that change. I've disabled it for the time being. It's not mission critical, just a plaything. :)
    Posted in: Lua Code Discussion
  • 0

    posted a message on BattlefieldMinimap
    Attempting a mild reskin of the Battlefield Minimap (Shift+M) but I'm stumped at a simple little thing.

    The tab highlights on a mouse over and I cannot figure out how to stop that. Everything else has been fairly easy but I've been hunting and trying various things for hours to hide this mean little highlight.

    There are two instances of this texture (UI-Character-Tab-Highlight) being used in http://wowprogramming.com/utils/xmlbrowser/live/AddOns/Blizzard_BattlefieldMinimap/Blizzard_BattlefieldMinimap.xml.

    Any ideas to disable or hide this little bugger? Thanks.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Bartender Bar Toggler
    Getting some errors in combat with this now:

    [ADDON_ACTION_BLOCKED] AddOn "aaaBinds" tried to call the protected function "SecondaryProfession4SpellButtonRight:Show()".
    !BugGrabber-r188\BugGrabber.lua:587: in function <!BugGrabber\BugGrabber.lua:587>
    <in C code>
    FrameXML\SpellBookFrame.lua:1037: in function "FormatProfession"
    FrameXML\SpellBookFrame.lua:1078: in function "SpellBook_UpdateProfTab"
    FrameXML\SpellBookFrame.lua:160: in function <FrameXML\SpellBookFrame.lua:139>
    nil
    [ADDON_ACTION_BLOCKED] AddOn "aaaBinds" tried to call the protected function "PrimaryProfession2SpellButtonBottom:Show()".
    !BugGrabber-r188\BugGrabber.lua:587: in function <!BugGrabber\BugGrabber.lua:587>
    <in C code>
    FrameXML\SpellBookFrame.lua:1040: in function "FormatProfession"
    FrameXML\SpellBookFrame.lua:1074: in function "SpellBook_UpdateProfTab"
    FrameXML\SpellBookFrame.lua:160: in function <FrameXML\SpellBookFrame.lua:139>
    nil
    [ADDON_ACTION_BLOCKED] AddOn "aaaBinds" tried to call the protected function "PrimaryProfession2SpellButtonTop:Show()".
    !BugGrabber-r188\BugGrabber.lua:587: in function <!BugGrabber\BugGrabber.lua:587>
    <in C code>
    FrameXML\SpellBookFrame.lua:1041: in function "FormatProfession"
    FrameXML\SpellBookFrame.lua:1074: in function "SpellBook_UpdateProfTab"
    FrameXML\SpellBookFrame.lua:160: in function <FrameXML\SpellBookFrame.lua:139>
    nil
    [ADDON_ACTION_BLOCKED] AddOn "aaaBinds" tried to call the protected function "SecondaryProfession2SpellButtonLeft:Hide()".
    !BugGrabber-r188\BugGrabber.lua:587: in function <!BugGrabber\BugGrabber.lua:587>
    <in C code>
    FrameXML\SpellBookFrame.lua:1036: in function "FormatProfession"
    FrameXML\SpellBookFrame.lua:1076: in function "SpellBook_UpdateProfTab"
    FrameXML\SpellBookFrame.lua:160: in function <FrameXML\SpellBookFrame.lua:139>
    nil


    Code in its current state:

    local macroBindings = {
    	["F1"] = "",
    	["F2"] = "/use Banquet of the Brew \n/use Banquet of the Oven \n/use Banquet of the Grill",
    	["F3"] = "/CAST Mobile Banking",
    	["F4"] = "/equipset [spec:1] Spec1 \n/cast [spec:1] Defensive Stance \n/equipset [spec:2] Spec2 \n/cast [spec:2] Battle Stance",
    	["F5"] = "/CAST Mass Resurrection",
    	["F6"] = "/readycheck",
    	["F7"] = "",
    	["F8"] = "/run InitiateRolePoll()",
    	["F9"] = "/click PrimaryProfession2SpellButtonBottom",
    	["F10"] = "/click PrimaryProfession1SpellButtonBottom",
    	["F11"] = "/CAST Cooking Fire",
    	["F12"] = "/CAST Cooking",
    	["CTRL-F1"] = "",
    	["CTRL-F2"] = "/bartender",
    	["CTRL-F3"] = "/dbm",
    	["CTRL-F4"] = "/kgpanels config",
    	["CTRL-F5"] = "/macro",
    	["CTRL-F6"] = "/pitbull",
    	["CTRL-F7"] = "/skada toggle",
    	["CTRL-F8"] = "/tptp",
    	["CTRL-F9"] = "/tsm",
    	["CTRL-F10"] = "/ti toggle",
    	["CTRL-F11"] = "/icehud",
    	["CTRL-F12"] = "/framestack",
    	["SHIFT-F1"] = "",
    	["SHIFT-F2"] = "",
    	["SHIFT-F3"] = "",
    	["SHIFT-F4"] = "/run UnitSetRole('player', 'TANK')",
    	["SHIFT-F5"] = "/run ShowCloak(not ShowingCloak())",
    	["SHIFT-F6"] = "/run ShowHelm(not ShowingHelm())",
    	["SHIFT-F7"] = "/run SetCVar(\"UnitNameFriendlyPlayerName\",1-(GetCVar(\"UnitNameFriendlyPlayerName\")))",
    	["SHIFT-F8"] = "/run SetCVar(\"gxWindow\", 1 - GetCVar(\"gxWindow\")); RestartGx();",
    	["SHIFT-F9"] = "/run SetCVar(\"Sound_EnableMusic\",1-(GetCVar(\"Sound_EnableMusic\")))",
    	["SHIFT-F10"] = "/run SetCVar(\"Sound_MasterVolume\", 0.0)",
    	["SHIFT-F11"] = "/run SetCVar(\"Sound_MasterVolume\", 0.1)",
    	["SHIFT-F12"] = "/run SetCVar(\"Sound_MasterVolume\", 1.0)",
    	["CTRL-SHIFT-F1"] = "",
    	["CTRL-SHIFT-F2"] = "",
    	["CTRL-SHIFT-F3"] = "",
    	["CTRL-SHIFT-F4"] = "",
    	["CTRL-SHIFT-F5"] = "",
    	["CTRL-SHIFT-F6"] = "",
    	["CTRL-SHIFT-F7"] = "/",
    	["CTRL-SHIFT-F8"] = "",
    	["CTRL-SHIFT-F9"] = "",
    	["CTRL-SHIFT-F10"] = "",
    	["CTRL-SHIFT-F11"] = "",
    	["CTRL-SHIFT-F12"] = "/reload",
    	["CTRL-MOUSEWHEELUP"] = "/click TSMAuctioningCancelButton\n/click TSMAuctioningPostButton",
    	["CTRL-MOUSEWHEELDOWN"] = "/click TSMAuctioningCancelButton\n/click TSMAuctioningPostButton",
    	["NUMPADPLUS"] = "/focus",
    	["NUMPADMINUS"] = "/clearfocus"
    }
    
    local mouseClicks = { "LeftButton", "RightButton", "MiddleButton", "Button4", "Button5" }
    
    local keyCount = 0
    local setCount = 0
    
    for key, macro in pairs(macroBindings) do
    	local click = ((keyCount % 4) + 1)
    
    	if (keyCount % 4) == 0 then
    		setCount = setCount + 1
    	end
    	
    	if macro == "" then
    		macro = "/run print('NO KEY SET')"
    	end
    	
    	local buttonName = "FuncButSet" .. setCount
    
    	local button = _G[buttonName] or CreateFrame("Button", buttonName, nil, "SecureActionButtonTemplate")
    
    	button:SetAttribute("type"..click, "macro")
    	button:SetAttribute("macrotext"..click, macro)
    
    	SetOverrideBindingClick(button, false, key, buttonName, mouseClicks[click])
    
    	--print(keyCount, key, "click:", mouseClicks[click], "btn:", buttonName)
    
    	keyCount = keyCount + 1
    	
    end
    
    local f = CreateFrame("Frame")
    f:RegisterEvent("PLAYER_LOGIN")
    f:SetScript("OnEvent", function()
        f:UnregisterAllEvents() 
        f:SetScript("OnEvent", nil)
        SpellBookFrame.bookType = BOOKTYPE_PROFESSION 
        ShowUIPanel(SpellBookFrame) 
        HideUIPanel(SpellBookFrame)
    end)


    Not sure why this would be called during combat? The registered event is PLAYER_LOGIN.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Bartender Bar Toggler
    Quote from Phanx
    Why are you using expensive gsub calls instead of just using the actual binding you want as the key?

    ["CTRL-SHIFT-F6"] = "/run print('CTRL-SHIFT-F6')"

    Plus, the way you're doing it prevents binding anything to the C or S keys.


    Yep, I was in a hurry and didn't know you could assign keys that way. I changed it the next day after my post to the way you show here. :P
    Posted in: Lua Code Discussion
  • 0

    posted a message on Bartender Bar Toggler
    Quote from Phanx
    Try adding debug prints inside the for-loop; for example, if you add this line right after the SetOverrideBinding call (but still inside the loop, before the "end"), it will print a message for each binding as it's set, telling you what key is being bound to what:

    print(count, key, "click:", click, "btn:", buttonName)
    


    Also, make sure you have BugSack installed and enabled; generally when some things are working but others are not with no apparent reason, there is a Lua error occurring.


    Yep, I had been trying debug statements like this but I wasn't getting anywhere. Actually the local variable hint above is what got me sorted out.

    Got it working now. Thanks for the breadcrumbs guys!

    local macroBindings = {
    	F1  = "",
    	F2  = "/run print('F2')",
    	F3  = "/run print('F3')",
    	F4  = "/run print('F4')",
    	F5  = "/run print('F5')",
    	F6  = "/run print('F6')",
    	F7  = "/run print('F7')",
    	F8  = "/run print('F8')",
    	F9  = "/run print('F9')",
    	F10  = "/run print('F10')",
    	F11  = "/run print('F11')",
    	F12  = "/run print('F12')",
    	CF1  = "",
    	CF2  = "/run print('CF2')",
    	CF3  = "/run print('CF3')",
    	CF4  = "/run print('CF4')",
    	CF5  = "/run print('CF5')",
    	CF6  = "/run print('CF6')",
    	CF7  = "/run print('CF7')",
    	CF8  = "/run print('CF8')",
    	CF9  = "/run print('CF9')",
    	CF10  = "/run print('CF10')",
    	CF11  = "/run print('CF11')",
    	CF12  = "/run print('CF12')",
    	SF1  = "",
    	SF2  = "/run print('SF2')",
    	SF3  = "/run print('SF3')",
    	SF4  = "/run print('SF4')",
    	SF5  = "/run print('SF5')",
    	SF6  = "/run print('SF6')",
    	SF7  = "/run print('SF7')",
    	SF8  = "/run print('SF8')",
    	SF9  = "/run print('SF9')",
    	SF10  = "/run print('SF10')",
    	SF11  = "/run print('SF11')",
    	SF12  = "/run print('SF12')",
    	CSF1  = "",
    	CSF2  = "/run print('CSF2')",
    	CSF3  = "/run print('CSF3')",
    	CSF4  = "/run print('CSF4')",
    	CSF5  = "/run print('CSF5')",
    	CSF6  = "/run print('CSF6')",
    	CSF7  = "/run print('CSF7')",
    	CSF8  = "/run print('CSF8')",
    	CSF9  = "/run print('CSF9')",
    	CSF10  = "/run print('CSF10')",
    	CSF11  = "/run print('CSF11')",
    	CSF12  = "/run print('CSF12')",
    }
    
    local mouseClicks = { "LeftButton", "RightButton", "MiddleButton", "Button4", "Button5" }
    
    local keyCount = 0
    local setCount = 0
    
    for key, macro in pairs(macroBindings) do
    	local click = ((keyCount % 4) + 1)
    
    	if (keyCount % 4) == 0 then
    		setCount = setCount + 1
    	end
    	
    	key = key:gsub("C", "CTRL-")
    	key = key:gsub("S", "SHIFT-")
    	
    	local buttonName = "FuncButSet" .. setCount
    
    	local button = _G[buttonName] or CreateFrame("Button", buttonName, nil, "SecureActionButtonTemplate")
    
    	button:SetAttribute("type"..click, "macro")
    	button:SetAttribute("macrotext"..click, macro)
    
    	SetOverrideBindingClick(button, false, key, buttonName, mouseClicks[click])
    
    	keyCount = keyCount + 1
    	
    end
    


    Now perhaps I'll work on setting up an in-game config for this.

    Kind of a silly add-on but I needed a project to get me started.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Bartender Bar Toggler
    Quote from MMOSimca
    It's actually a lot easier than you'd think

    local outside
    if pancakes = 5 then
    	outside = 12
    end
    
    print(outside) --> 12


    Basically, just declare a local right before the if statement (outside it). If you want the variable available at the function level, just declare it outside any functions (still with local).


    Wow. Don't know how I missed this... thanks!
    Posted in: Lua Code Discussion
  • 0

    posted a message on Bartender Bar Toggler
    I am following this to a point. I tried out exactly what you have and it was acting funky, so I tried this:

    
    local MacroBindings = {
    	F1  = "/run print('F1')",
    	F2  = "/run print('F2')",
    	F3  = "/run print('F3')",
    	F4  = "/run print('F4')",
    	F5  = "/run print('F5')",
    	F6  = "/run print('F6')",
    	F7  = "/run print('F7')",
    	F8  = "/run print('F8')",
    	F9  = "/run print('F9')",
    	F10  = "/run print('F10')",
    	F11  = "/run print('F11')",
    	F12  = "/run print('F12')",
    }
    
    local ButtonNames = { "LeftButton", "RightButton", "MiddleButton", "Button4", "Button5" }
    
    local count = 0
    for key, macro in pairs(MacroBindings) do
    	-- Increment the count:
    	count = count + 1
    
    	-- Figure out which click to simulate:
    	local click = count - (5 * (count % 5))
    
    	-- Figure out which button to use
    	local buttonName = "FuncButSet" .. (1 + (count % 5))
    
    	-- Get a reference to the button, or create it if needed:
    	local button = _G[buttonName] or CreateFrame("Button", buttonName, nil, "SecureActionButtonTemplate")
    
    	-- Set the attributes:
    	button:SetAttribute("type"..click, "macro")
    	button:SetAttribute("macrotext"..click, macro)
    
    	-- Set the binding:
    	SetOverrideBindingClick(button, false, key, buttonName, ButtonNames[click])
    end
    


    When I press the buttons, this is what happens:

    F1: Nothing
    F2: Nothing
    F3: Nothing
    F4: Prints "F4"
    F5: Prints "F5"
    F6: Nothing
    F7: Nothing
    F8: Prints "F4"
    F9: Prints "F9"
    F10: Nothing
    F11: Prints "F4"
    F12: Nothing

    (Yes, globals bad. I'm still trying to figure out how to set variables in an if statement without using globals... I'm used to dabbling in PHP.)
    Posted in: Lua Code Discussion
  • 0

    posted a message on Bartender Bar Toggler
    There we go. That was the direction I was heading... I just had no idea how to get there.

    I'm still learning here but I'd like to go a step further:

    
    FuncButton = {}
    FuncButton["custom_keybind_F1"]	= "";
    FuncButton["custom_keybind_F2"]	= "/use Banquet of the Brew \n/use Banquet of the Oven \n/use Banquet of the Grill";
    FuncButton["custom_keybind_F3"]	= "/CAST Mobile Banking";
    FuncButton["custom_keybind_F4"]	= "";
    FuncButton["custom_keybind_F5"]	= "/CAST Mass Resurrection";
    FuncButton["custom_keybind_F6"]	= "/readycheck";
    FuncButton["custom_keybind_F7"]	= "";
    FuncButton["custom_keybind_F8"]	= "/run InitiateRolePoll()";
    FuncButton["custom_keybind_F9"]	= "/click PrimaryProfession2SpellButtonBottom"
    FuncButton["custom_keybind_F10"]	= "/click PrimaryProfession1SpellButtonBottom"
    FuncButton["custom_keybind_F11"]	= "/CAST Prospecting \n/run ChatFrame4:AddMessage('Prospecting')"
    FuncButton["custom_keybind_F12"]	= "/CAST Disenchant \n/run ChatFrame4:AddMessage('Disenchanting')"
    
    for i=1,12,1 do
    	if i == 1 or i == 5 or i == 9 then
    		FuncButSetName = "FuncButSet"..i
    		button = CreateFrame("Button",FuncButSetName,nil,"SecureActionButtonTemplate")
    	end   
    	button:SetAttribute("type"..i,"macro")
    	button:SetAttribute("macrotext"..i, FuncButton["custom_keybind_F"..i] )
    	SetOverrideBindingClick(FuncButSetName, false, "F"..i, FuncButSetName, "LeftButton")
    end
    
    


    How do I set the "owner" argument in SetOverrideBindingClick from a variable?

    That seems to be the only sticking point here at the moment.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Bartender Bar Toggler
    Okay, this works but it throws an error unless I've opened the Profession Book first:

    local button = CreateFrame("Button","MacroTest0",nil,"SecureActionButtonTemplate")
    
    button:SetAttribute("type1","macro")
    button:SetAttribute("macrotext1","/click PrimaryProfession1SpellButtonBottom")
    SetOverrideBindingClick(MacroTest0, false, "F9", "MacroTest0", "LeftButton")
    
    Posted in: Lua Code Discussion
  • 0

    posted a message on Bartender Bar Toggler
    Continuing to add some bindings...

    I'm trying to assign profession windows to a keybind. I tried this in game and it worked perfectly:

    /run SetBindingClick("F9", "PrimaryProfession1SpellButtonBottom")


    In my code I tried this and it didn't work:

    SetBindingClick("F9", "PrimaryProfession1SpellButtonBottom")


    Also tried:

    local button = CreateFrame("Button","Professions1",nil,"SecureActionButtonTemplate")
    
    button:SetAttribute("type1","click")
    button:SetAttribute("clickbutton","PrimaryProfession1SpellButtonBottom")
    SetOverrideBindingClick(Professions1, false, "F9", "Professions1", "LeftButton")
    


    Any suggestions? Thanks!
    Posted in: Lua Code Discussion
  • 0

    posted a message on Masque - Official Thread
    Quote from StormFX
    You were never able to modify the fonts, only enable whatever font the skin specified.


    Not sure what the difference is here.

    Quote from StormFX
    A font add-on. (Hint Tekticles)


    Yep, thanks. I inserted a line or two into bartender myself to handle it.
    Posted in: General AddOns
  • 0

    posted a message on Bartender Bar Toggler
    Glad I could help. :)
    Posted in: Lua Code Discussion
  • 0

    posted a message on Bartender Bar Toggler
    Quote from tempest420
    Followed your link here but I have no clue what is going on! Do I put this in a macro or is this some lua wizardry? I hate sounding like an idiot but while I can follow the code, I have no clue how to implement it. Any direction would be appreciated.


    Link Removed: http://www.mediafire.com/?e2mxftr29qf66es

    I uploaded what will hopefully work for you. Just install it like any addon.

    The one file with lua code in it is fairly self explanatory.

    Just change the bar numbers to match the ones you want. I set it to 2-10 assuming you only want bar 1 visible.

    One thing that I do is to set the bars I want to toggle to hidden in each of their visibility settings. This way they're automatically hidden when I log in.

    Also, toggling visibility does not work in combat so make sure they're off the side somewhere in case you forget to toggle them off before your tank pulls or you get ganked. :P


    The slash command is /togglebars and it's bound to SHIFT+B in my script. You can also change these to whatever you like within the one lua file.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Bartender4 - Official Topic
    Quote from tempest420
    I play with 9/10 bars set to always hide since I've had the same binds for years now. My question is, is it possible to make all the bars visible with a /bar command? Going to through the settings and disabling the always hide option on each bar is very tedious.


    Check out my Bartender Bar Toggler post. If you need help getting it to work, just post there and I can give you some direction.
    Posted in: General AddOns
  • 0

    posted a message on Bartender4 - Official Topic
    Thanks Phanx! Always ready with an answer :)

    I had found the list in that library but didn't think any of those were the answer. I knew it was the right place, though.

    Thanks again.
    Posted in: General AddOns
  • To post a comment, please or register a new account.