1. #1
    The Patient Buttonmasher's Avatar
    10+ Year Old Account
    Join Date
    May 2013
    Location
    Seattle, the land where we have good internet.
    Posts
    278

    Question kgPanels Quick Question

    What's the script for OnLoad in kgPanels to make it only load for, say, example shadow Priest, but not holy Priest? I'm setting up some "combo point" style frames but I only want them on Shadow. Anybody know the script? I know it's sitting right in front of me but I've given up trying to find it.

    I've looked through these, too: http://wowpedia.org/API_GetSpecializationInfoByID http://wowpedia.org/API_GetInspectSpecialization

    But, alas, I must be doing something wrong. Can anybody help? It would be greatly appreciated.

  2. #2
    Deleted
    This returns true if you're currently Shadow:

    Code:
    select(2, GetSpecializationInfo(GetSpecialization())) == "Shadow"

    So in OnLoad you could maybe have this:

    Code:
    if select(2, GetSpecializationInfo(GetSpecialization())) == "Shadow" then
      self:RegisterEvent("UNIT_POWER")
    end

    And then to return your current Shadow Orbs count you want 'UnitPower("player", SPELL_POWER_SHADOW_ORBS)'.

  3. #3
    The Patient Buttonmasher's Avatar
    10+ Year Old Account
    Join Date
    May 2013
    Location
    Seattle, the land where we have good internet.
    Posts
    278
    Not necessarily what I'm looking for... I just want frames to show in a certain spec, and hide for every other case.
    Something like...

    if spec == "specID" then
    self:Show
    else:Hide
    end

    But I have NO idea how or why it isn't this simple.

  4. #4
    Deleted
    This actually appears to work fine for me:

    Code:
    if select(2, GetSpecializationInfo(GetSpecialization())) == "Shadow" then
      self:Show()
    else
      self:Hide()
    end

    Another option is to set up different profiles for different specs and use the dual profile setting: http://i.imgur.com/xNQFHmK.png

  5. #5
    The Patient Buttonmasher's Avatar
    10+ Year Old Account
    Join Date
    May 2013
    Location
    Seattle, the land where we have good internet.
    Posts
    278
    It's... not really working at all for me.
    It'll disappear if I put in the script while in Holy spec, but it will never enable itself ever again.
    I'll log out, and it's just sitting there until I mess with the script again. So it's more likely a broken script causing it to just hide rather than changing into shadow, which I tried several times and it didn't work...

  6. #6
    Did you register for the Talent Spec change event?

  7. #7
    The Patient Buttonmasher's Avatar
    10+ Year Old Account
    Join Date
    May 2013
    Location
    Seattle, the land where we have good internet.
    Posts
    278
    I honestly have no idea how to do that...

  8. #8
    Quote Originally Posted by Buttonmasher View Post
    I honestly have no idea how to do that...
    I've been using this script myself to display a kgpanel on my priest only when he's in disc-spec:

    Code:
    self:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED")
    self:RegisterEvent("PLAYER_LOGIN")
    local class     = UnitClass("player")
    local specId     = GetSpecialization()
    if class == "Priest" then
        if specId == 1 then
            self:Show()
        else
            self:Hide()
        end
    else
        self:Hide()
    end

    Both in OnLoad and OnEvent - I built this myself so it may not be efficient or "good" at all but it does what I want it to do.
    If you take a look at the suggestions above, you may just as well improve upon mine if you want to.

    Edit: incorporated the previous suggestions into my script, should look like that:

    Code:
    self:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED")
    self:RegisterEvent("PLAYER_LOGIN")
    if UnitClass("player") == "Priest" then
        if select(2, GetSpecializationInfo(GetSpecialization())) == "Discipline" then
            self:Show()
        else
            self:Hide()
        end
    else
        self:Hide()
    end

    Just in case and I haven't tested it if it's really an issue (but it would make sense to be one), while the class check may be redundant on certain classes such as rogue (he won't be running around in holy spec), holy as an example can be present on multiple classes so I thought it would make sense to check for class as well.
    Last edited by Chrotesque; 2014-10-23 at 08:02 AM.

  9. #9
    The Patient Buttonmasher's Avatar
    10+ Year Old Account
    Join Date
    May 2013
    Location
    Seattle, the land where we have good internet.
    Posts
    278
    While I can 't test it right now, I'll defintely look into it tomorrow. Thanks in advance if it works.

  10. #10
    Am wondering if you could combine both the conditionals into a single statement

    Code:
    if UnitClass("player") == "Priest" then
        if select(2, GetSpecializationInfo(GetSpecialization())) == "Discipline" then
    AS

    Code:
    if UnitClass("player") == "Priest" and select(2, GetSpecializationInfo(GetSpecialization())) == "Discipline" then

  11. #11
    Quote Originally Posted by palthis View Post
    Am wondering if you could combine both the conditionals into a single statement

    Code:
    if UnitClass("player") == "Priest" then
        if select(2, GetSpecializationInfo(GetSpecialization())) == "Discipline" then
    AS

    Code:
    if UnitClass("player") == "Priest" and select(2, GetSpecializationInfo(GetSpecialization())) == "Discipline" then
    Indeed, works like a charm!

    Code:
    self:RegisterEvent("ACTIVE_TALENT_GROUP_CHANGED")
    self:RegisterEvent("PLAYER_LOGIN")
    if UnitClass("player") == "Priest" and select(2, GetSpecializationInfo(GetSpecialization())) == "Discipline" then
      self:Show()
    else
      self:Hide()
    end

Posting Permissions

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