1. #1

    KgPanel Script for changing Bartender profiles?

    Hey, is there a script I can use so that on click of a KgPanel it will change my bartender profile? I know there's one for changing my shadowed unit frames which I'll find and post here which changes the shadowed unit frame profiles when you click n a panel using a script so was wondering if it's possible to do the same with Bartender.

    This would be fantastic if it's possible and would help me a lot. Thank you for you're time!

    ---------- Post added 2012-04-06 at 11:22 PM ----------

    This is the one I used for changing the profile of shadowed unit frames:

    if pressed then
    if SecureCmdOptionParse("[btn:1]") then
    local run ShadowUF.db:SetProfile("<name>")
    else
    local run ShadowUF.db:SetProfile("<name>")
    end
    end

  2. #2
    Deleted
    Err...that code works, but only because two errors compensate for each other. ("local run" is a valid Lua statement for defining a local variable "run" with value nil, which I don't think is quite what you intended.)

    Make it look like this:
    Code:
    if pressed then
        if GetMouseButtonClicked() == "LeftButton" then
            ShadowUF.db:SetProfile("<name>")
        else
            ShadowUF.db:SetProfile("<name>")
        end
    end
    For BT4, you can simply substitute the two occurrences of "ShadowUF" with "Bartender4", judging from a quick look at the code.

  3. #3
    Thank you. I never know how to find out what the exact name to use as it can be very picky.

    ---------- Post added 2012-04-07 at 05:44 PM ----------

    Also I was wondering how you find out what name such as Bartender4 for each addon you want to apply this script to would be? I'm planning on doing this for a few addons and was curious on how you find out.[COLOR="red"]
    Last edited by MayronWoW; 2012-04-07 at 04:48 PM.

  4. #4
    Deleted
    I'm no expert but I think you can find that out in the saved variables file. Either that or try just using the name of the toc file maybe.

  5. #5
    Deleted
    Actually, you check the addon's Lua files and check for its AceDB creation call. Related lines in the two addons mentioned here are:

    BT4 4.4.2 Bartender.lua Line 31:
    Code:
    self.db = LibStub("AceDB-3.0"):New("Bartender4DB", defaults)
    As this is defined as a member method of a table (it uses colon syntax in the function definition at line 30), the "self" local is (simply put, it's a bit more complicated technically) the table itself. Line 30:
    Code:
    function Bartender4:OnInitialize()
    This leaves us with "Bartender4.db" as the AceDB db handle (which has the :SetProfile method).


    Same for SUF - ShadowedUnitFrames 3.4.4 - ShadowedUnitFrames.lua line 47:
    Code:
    self.db = LibStub:GetLibrary("AceDB-3.0"):New("ShadowedUFDB", self.defaults, true)
    Function definition in line 27:
    Code:
    function ShadowUF:OnInitialize()


    ---------- Post added 2012-04-09 at 01:47 AM ----------

    For reference, LibStub("AceDB-3.0") is equivalent to LibStub:GetLibrary("AceDB-3.0"), as LibStub has a metatable whose __call is equal to the GetLibrary method.

  6. #6
    Thank you, the reason I wanted to know this is that I want to be able to press a button to add an extra action bar on my ui but to do this I would need my unit frames to move up as well to give my action bar enough room. I thought profile switching would be the easiest way to do this

Posting Permissions

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