• 0

    posted a message on A better way to get number of party/raid members?
    Thanks for the reply tekkub,

    I see where you are going with your examples. Could you tell me how I would integrate the

    local myPanel[n] = kgPanels:FetchFrame("what you named the panel")


    with your

    local frames = {frame1, frame2, frame3, frame4}
    for i=1,GetNumPartyMembers() do
      local f = frames[i]
      -- do crap
    end
    


    Add to make this code work with each raid members frame would I have to store 40 frames in the table?

    Again thank you very much.
    Posted in: Lua Code Discussion
  • 0

    posted a message on A better way to get number of party/raid members?
    Hello,

    Got a question for anyone kind enough to provide me with a little guidance. I am trying to tweak my UI from this example. Instead of using eePanels I am using kgPanels now. I want to achieve the same class-colored border with my party and raid frames. Looking at this code

        -- Just you / not in a party
        if GetNumPartyMembers() < 1 then
          eePanel13:Hide()
          eePanel14:Hide()
          eePanel15:Hide()
          eePanel16:Hide()
        -- You plus 1 other person
        elseif GetNumPartyMembers() == 1 then
          eePanel13:Show()
          eePanel14:Hide()
          eePanel15:Hide()
          eePanel16:Hide()
        -- You plus 2 other people
        elseif GetNumPartyMembers() == 2 then
          eePanel13:Show()
          eePanel14:Show()
          eePanel15:Hide()
          eePanel16:Hide()
        -- You plus 3 other people
        elseif GetNumPartyMembers() == 3 then
          eePanel13:Show()
          eePanel14:Show()
          eePanel15:Show()
          eePanel16:Hide()
        -- You in a full group
        elseif GetNumPartyMembers() == 4 then
          eePanel13:Show()
          eePanel14:Show()
          eePanel15:Show()
          eePanel16:Show()
      end
    


    I was wondering if a for loop would work better than the current if-elseif in determining the number of members in your party/raid and then also determining the proper class RGB color for the border. The only thing is that my knowledge of LUA is poor and my coding skills are even worse. Could anyone set me off in the right direction with the proper coding syntax, events, vars, etc?

    So far I know that to reference the kgPanel you use this code:

    local myPanel = kgPanels:FetchFrame("what you named the panel")


    I figure that there could be some var number [n] that could be set in a for loop depending on the party/raid roster. Using that number I could reference each kgPanel as

    local myPanel[n] = kgPanels:FetchFrame("what you named the panel")


    Then each panel could be checked with something like

    local _, class = UnitClass("party"+[n]);
    


    To determine the unit's class and then colored based on that value.

    Am I on the right track?

    I have sort of Frankenstein-ed all this code together from searching through the forums on wowace. I am hoping there is a more "automated" way to check for party/raid members then having to create 40 kgPanels and reference them all individually; that seems like a lot of code.

    I appreciate the help in advance. Thanks :)
    Posted in: Lua Code Discussion
  • 0

    posted a message on kgPanels Offical Thread
    Hello,

    I recently started using KGPanels and have been trying to adapt these unit frames. Using this forum I have gotten the Player, Target, ToT, and Focus frames working by coloring the border based on the unit's class. I am running into a problem with this code for the player and raid frames.

    function eePanels2:RaidPanelVisibility(self, event, ...)
      
      if GetNumPartyMembers() > 4 or GetNumRaidMembers() > 0 then    
        eePanel13:Show()
        eePanel14:Show()  
        eePanel15:Show()
        eePanel16:Show() 
       else
        eePanel13:Hide()
        eePanel14:Hide()
        eePanel15:Hide()
        eePanel16:Hide()
      end
      
        -- Just you / not in a party
        if GetNumPartyMembers() < 1 then
          eePanel13:Hide()
          eePanel14:Hide()
          eePanel15:Hide()
          eePanel16:Hide()
        -- You plus 1 other person
        elseif GetNumPartyMembers() == 1 then
          eePanel13:Show()
          eePanel14:Hide()
          eePanel15:Hide()
          eePanel16:Hide()
        -- You plus 2 other people
        elseif GetNumPartyMembers() == 2 then
          eePanel13:Show()
          eePanel14:Show()
          eePanel15:Hide()
          eePanel16:Hide()
        -- You plus 3 other people
        elseif GetNumPartyMembers() == 3 then
          eePanel13:Show()
          eePanel14:Show()
          eePanel15:Show()
          eePanel16:Hide()
        -- You in a full group
        elseif GetNumPartyMembers() == 4 then
          eePanel13:Show()
          eePanel14:Show()
          eePanel15:Show()
          eePanel16:Show()
      end
      
      local _, class = UnitClass("party1");
      if class == "WARRIOR" then
        eePanel13:SetBackdropBorderColor(0.780,0.611,0.431,1)
      elseif class == "PRIEST" then
        eePanel13:SetBackdropBorderColor(1,1,1,1)
      elseif class == "DRUID" then
        eePanel13:SetBackdropBorderColor(1,0.490,0.0392,1)
      elseif class == "HUNTER" then
        eePanel13:SetBackdropBorderColor(0.6705,0.8313,0.4509,1)
      elseif class == "MAGE" then
        eePanel13:SetBackdropBorderColor(0.4117,0.8,0.9411,1)
      elseif class == "PALADIN" then
        eePanel13:SetBackdropBorderColor(0.9607,0.5490,0.7294,1)
      elseif class == "SHAMAN" then
        eePanel13:SetBackdropBorderColor(0.1411,0.3490,1,1)
      elseif class == "WARLOCK" then
        eePanel13:SetBackdropBorderColor(0.580,0.5098,0.7882,1)
      elseif class == "ROGUE" then
        eePanel13:SetBackdropBorderColor(1,0.9607,0.4117,1)
      end
    
      local _, class = UnitClass("party2");
      if class == "WARRIOR" then
        eePanel14:SetBackdropBorderColor(0.780,0.611,0.431,1)
      elseif class == "PRIEST" then
        eePanel14:SetBackdropBorderColor(1,1,1,1)
      elseif class == "DRUID" then
        eePanel14:SetBackdropBorderColor(1,0.490,0.0392,1)
      elseif class == "HUNTER" then
        eePanel14:SetBackdropBorderColor(0.6705,0.8313,0.4509,1)
      elseif class == "MAGE" then
        eePanel14:SetBackdropBorderColor(0.4117,0.8,0.9411,1)
      elseif class == "PALADIN" then
        eePanel14:SetBackdropBorderColor(0.9607,0.5490,0.7294,1)
      elseif class == "SHAMAN" then
        eePanel14:SetBackdropBorderColor(0.1411,0.3490,1,1)
      elseif class == "WARLOCK" then
        eePanel14:SetBackdropBorderColor(0.580,0.5098,0.7882,1)
      elseif class == "ROGUE" then
        eePanel14:SetBackdropBorderColor(1,0.9607,0.4117,1)
      end
    
      local _, class = UnitClass("party3");
      if class == "WARRIOR" then
        eePanel15:SetBackdropBorderColor(0.780,0.611,0.431,1)
      elseif class == "PRIEST" then
        eePanel15:SetBackdropBorderColor(1,1,1,1)
      elseif class == "DRUID" then
        eePanel15:SetBackdropBorderColor(1,0.490,0.0392,1)
      elseif class == "HUNTER" then
        eePanel15:SetBackdropBorderColor(0.6705,0.8313,0.4509,1)
      elseif class == "MAGE" then
        eePanel15:SetBackdropBorderColor(0.4117,0.8,0.9411,1)
      elseif class == "PALADIN" then
        eePanel15:SetBackdropBorderColor(0.9607,0.5490,0.7294,1)
      elseif class == "SHAMAN" then
        eePanel15:SetBackdropBorderColor(0.1411,0.3490,1,1)
      elseif class == "WARLOCK" then
        eePanel15:SetBackdropBorderColor(0.580,0.5098,0.7882,1)
      elseif class == "ROGUE" then
        eePanel15:SetBackdropBorderColor(1,0.9607,0.4117,1)
      end
    
      local _, class = UnitClass("party4");
      if class == "WARRIOR" then
        eePanel16:SetBackdropBorderColor(0.780,0.611,0.431,1)
      elseif class == "PRIEST" then
        eePanel16:SetBackdropBorderColor(1,1,1,1)
      elseif class == "DRUID" then
        eePanel16:SetBackdropBorderColor(1,0.490,0.0392,1)
      elseif class == "HUNTER" then
        eePanel16:SetBackdropBorderColor(0.6705,0.8313,0.4509,1)
      elseif class == "MAGE" then
        eePanel16:SetBackdropBorderColor(0.4117,0.8,0.9411,1)
      elseif class == "PALADIN" then
        eePanel16:SetBackdropBorderColor(0.9607,0.5490,0.7294,1)
      elseif class == "SHAMAN" then
        eePanel16:SetBackdropBorderColor(0.1411,0.3490,1,1)
      elseif class == "WARLOCK" then
        eePanel16:SetBackdropBorderColor(0.580,0.5098,0.7882,1)
      elseif class == "ROGUE" then
        eePanel16:SetBackdropBorderColor(1,0.9607,0.4117,1)
      end
    end
    
    -- Ace2 event listeners; can't do this in more than one script
    eePanels2:RegisterEvent("PLAYER_ENTERING_WORLD", eePanels2.RaidPanelVisibility)
    eePanels2:RegisterEvent("PARTY_MEMBERS_CHANGED", eePanels2.RaidPanelVisibility)
    eePanels2:RegisterEvent("RAID_ROSTER_UPDATE", eePanels2.RaidPanelVisibility)


    How would this be converted from eePanels to KgPanels? I know I have to register the appropriate events in onLoad. My confusion begins with the eePanels specific calls. How/Can I do this in kgPanels? Do I need an individual KgPanel for each party and/or raid frame like the above code uses? This code also seems to be redundant; isn't there a for loop that could accomplish the same scripting with out having to check if each party member exists? I have been looking at some of the data types at wowwiki.com but my lack of knowledge with LUA and Warcraft's API really hampers my success. I am very particular about my UI and I am excited about getting it back to the way I like it. I look forward and appreciate any help/guidance that anyone can provide in converting this eePanels code to KgPanels. Thanks.
    Posted in: General AddOns
  • To post a comment, please or register a new account.