1. #1
    Deleted

    Need help with making a simple add-on (Bartender related)

    I'm trying to make a small add-on that would enable me to show/hide certain bartender bars through a slash command.
    Here is what I've done so far.

    Code:
    --BartenderToggle.lua
    SLASH_TOGGLEBARS1 = '/togglebars';
    local function toggler()
    if (BT4Bar1:IsVisible()) then
            BT4Bar1:Hide()
    	BT4Bar2:Hide()
    	BT4Bar3:Hide()
        else
            BT4Bar1:Show()
    	BT4Bar2:Show()
    	BT4Bar3:Show()
    
        end
    end
    SlashCmdList["TOGGLEBARS"] = toggler;
    Code:
    --BartenderToggle.toc
    ## Interface: 40300
    ## Title: |cffFF0088BartenderToggle
    The slash command is not working and I can't figure out what is wrong with it. I'm not sure if the rest of the LUA is correct or not because I can't test it.
    Any help is appreciated.

  2. #2
    Shouldn't the title in the toc be named "TOGGLEBARS"?

  3. #3
    Deleted
    /facepalm, the .toc doesn't reference the .lua file...

    Quote Originally Posted by palthis View Post
    Shouldn't the title in the toc be named "TOGGLEBARS"?
    That's just the name shown in the add-on manager.

  4. #4
    Deleted
    The command looks good (except for the .toc issue mentioned above), however using :Show and :Hide will likely conflict with BT4 itself as well as not working in combat.

    I'd suggest using either this if you want to really "hide" it (but this won't work in combat) or this if you want it to work in combat but not make the bar unclickable (only invisible).

  5. #5
    Deleted
    Quote Originally Posted by Treeston View Post
    The command looks good (except for the .toc issue mentioned above), however using :Show and :Hide will likely conflict with BT4 itself as well as not working in combat.

    I'd suggest using either this if you want to really "hide" it (but this won't work in combat) or this if you want it to work in combat but not make the bar unclickable (only invisible).
    Only needs to work out of combat. I'm using it to show/hide all my binding bars so I can easily move spells in the bars that are normally hidden.
    Do I need to edit bartender or my own add-on to include the line you mentioned? I would rather not touch Bartenders files so I can update it with out a hassle.
    Code:
    Bartender4.Bar.barregistry["4"]:SetVisibilityOption("always",not Bartender4.Bar.barregistry["4"]:GetVisibilityOption("always"))

  6. #6
    Deleted
    No, it accesses the global BT4 addon variable. Just replace the "4"s (and replicate the line for every bar you want to toggle).

  7. #7
    Deleted
    Working perfectly now, thank you.

    I tried to find the function that enables key binding mode in bartender from it's files but had no luck with that.
    Can it be accessed the same way? Would be nice to toggle that when clicking the macro with the right mouse button for example.

  8. #8
    Deleted
    Do this first:
    Code:
    /run for k in pairs(SlashCmdList) do local n,c=1,_G["SLASH_"..k.."1"] while c do if c:lower() == "/kb" then print(k) end n=n+1 c=_G["SLASH_"..k..n] end end
    It will report a slash command key.

    Code:
    SlashCmdList["SLASHKEY"]()
    to enable key binding mode in your addon.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •