Thread Tools Display Modes
03-28-15, 11:52 PM   #1
10leej
A Molten Giant
 
10leej's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 583
Skinning default raid frames

So my skin works but it produces this error regardlkess of whether Im in a raid or party. I remember this running with no issue in the past though that was back in cataclysm. Have things changed since? (likely yes)

Code:
1x BobRaid\core.lua:123: attempt to index field '?' (a nil value)
BobRaid\core.lua:123: in function <BobRaid\core.lua:117>
Code:
Lua Code:
  1. local _, cfg = ... --import config
  2.  
  3. --[[
  4. Cause I wanted to do it!
  5.  --10leej
  6. ]]
  7.  
  8. local function CreateBackdrop(frame)
  9.     frame:SetBackdrop({bgFile = cfg.backdrop, edgeFile = "Interface\\Buttons\\WHITE8x8", edgeSize = cfg.pixelbordersize,
  10.         insets = {top = 2, left = 2, bottom = 2, right = 2}})
  11.     frame:SetBackdropColor(unpack(cfg.bColor))
  12.     frame:SetBackdropBorderColor(unpack(cfg.bColor))
  13.     if isBeautiful then
  14.         frame:CreateBeautyBorder(cfg.border.size.large)
  15.         frame:SetBeautyBorderTexture(cfg.border.texture)
  16.         frame:SetBeautyBorderColor(unpack(cfg.border.color))
  17.     end
  18. end
  19.  
  20. --Hide Group # tag on raid frames
  21. local inInstanceGroup = IsInGroup(LE_PARTY_CATEGORY_INSTANCE)
  22. if inInstanceGroup then
  23.     print("DEBUG: Player is in an instance group!")
  24. elseif IsInGroup() then
  25.     print("DEBUG: Player is in a normal group!")
  26. elseif IsInRaid() then
  27.     print("DEBUG: Player is in a raid group!")
  28.     b = CreateFrame("Frame")
  29.     b:SetScript("OnEvent", function(self, event, ...)
  30.         if event == "GROUP_ROSTER_UPDATE" then
  31.             CompactRaidGroup1Title:Hide()
  32.             CompactRaidGroup2Title:Hide()
  33.             CompactRaidGroup3Title:Hide()
  34.             CompactRaidGroup4Title:Hide()
  35.             CompactRaidGroup5Title:Hide()
  36.             CompactRaidGroup6Title:Hide()
  37.             CompactRaidGroup7Title:Hide()
  38.             CompactRaidGroup8Title:Hide()
  39.         end
  40.     end)
  41.     b:RegisterEvent("PLAYER_LOGIN")
  42.     b:RegisterEvent("GROUP_ROSTER_UPDATE")
  43.     b:RegisterEvent("ADDON_LOADED")
  44. end
  45.  
  46. --Make frames more resizable (RaidFrameResizer)
  47. local n,w,h="CompactUnitFrameProfilesGeneralOptionsFrame" h,w=
  48. _G[n.."HeightSlider"],
  49. _G[n.."WidthSlider"]
  50. h:SetMinMaxValues(1,150) --height
  51. w:SetMinMaxValues(1,150) --width
  52.  
  53. --Skin the RaidManager
  54. if not CompactRaidFrameManager then LoadAddOn("Blizzard_CompactRaidFrames") end
  55.  
  56. --hide stuff
  57. local buttons = {
  58.     CompactRaidFrameManagerDisplayFrameFilterOptionsFilterRoleTank,
  59.     CompactRaidFrameManagerDisplayFrameFilterOptionsFilterRoleHealer,
  60.     CompactRaidFrameManagerDisplayFrameFilterOptionsFilterRoleDamager,
  61.     CompactRaidFrameManagerDisplayFrameFilterOptionsFilterGroup1,
  62.     CompactRaidFrameManagerDisplayFrameFilterOptionsFilterGroup2,
  63.     CompactRaidFrameManagerDisplayFrameFilterOptionsFilterGroup3,
  64.     CompactRaidFrameManagerDisplayFrameFilterOptionsFilterGroup4,
  65.     CompactRaidFrameManagerDisplayFrameFilterOptionsFilterGroup5,
  66.     CompactRaidFrameManagerDisplayFrameFilterOptionsFilterGroup6,
  67.     CompactRaidFrameManagerDisplayFrameFilterOptionsFilterGroup7,
  68.     CompactRaidFrameManagerDisplayFrameFilterOptionsFilterGroup8,
  69.     CompactRaidFrameManagerDisplayFrameLeaderOptionsInitiateRolePoll,
  70.     CompactRaidFrameManagerDisplayFrameLeaderOptionsInitiateReadyCheck,
  71.     CompactRaidFrameManagerDisplayFrameLeaderOptionsRaidWorldMarkerButton,
  72.     CompactRaidFrameManagerDisplayFrameLockedModeToggle,
  73.     CompactRaidFrameManagerDisplayFrameHiddenModeToggle,
  74.     CompactRaidFrameManagerDisplayFrameConvertToRaid
  75. }
  76. CompactRaidFrameManagerDisplayFrameLeaderOptionsRaidWorldMarkerButton.SetNormalTexture = function() end
  77. for _, button in pairs(buttons) do
  78.     for i = 1, 3 do
  79.         select(i, button:GetRegions()):SetAlpha(0)
  80.     end
  81. end
  82.  
  83. for i = 1, 8 do
  84.     select(i, CompactRaidFrameManager:GetRegions()):Hide()
  85. end
  86. select(1, CompactRaidFrameManagerDisplayFrameFilterOptions:GetRegions()):Hide()
  87. select(1, CompactRaidFrameManagerDisplayFrame:GetRegions()):Hide()
  88. select(4, CompactRaidFrameManagerDisplayFrame:GetRegions()):Hide()
  89.  
  90. local bd = CreateFrame("Frame", nil, CompactRaidFrameManager)
  91. bd:SetPoint("TOPLEFT", CompactRaidFrameManager, "TOPLEFT")
  92. bd:SetPoint("BOTTOMRIGHT", CompactRaidFrameManager, "BOTTOMRIGHT", -9, 9)
  93.  
  94. --now we skin it and yes it's really this simple :)
  95. CreateBackdrop(CompactRaidFrameManagerDisplayFrameFilterOptionsFilterRoleTank)
  96. CreateBackdrop(CompactRaidFrameManagerDisplayFrameFilterOptionsFilterRoleHealer)
  97. CreateBackdrop(CompactRaidFrameManagerDisplayFrameFilterOptionsFilterRoleDamager)
  98. CreateBackdrop(CompactRaidFrameManagerDisplayFrameFilterOptionsFilterGroup1)
  99. CreateBackdrop(CompactRaidFrameManagerDisplayFrameFilterOptionsFilterGroup2)
  100. CreateBackdrop(CompactRaidFrameManagerDisplayFrameFilterOptionsFilterGroup3)
  101. CreateBackdrop(CompactRaidFrameManagerDisplayFrameFilterOptionsFilterGroup4)
  102. CreateBackdrop(CompactRaidFrameManagerDisplayFrameFilterOptionsFilterGroup5)
  103. CreateBackdrop(CompactRaidFrameManagerDisplayFrameFilterOptionsFilterGroup6)
  104. CreateBackdrop(CompactRaidFrameManagerDisplayFrameFilterOptionsFilterGroup7)
  105. CreateBackdrop(CompactRaidFrameManagerDisplayFrameFilterOptionsFilterGroup8)
  106. CreateBackdrop(CompactRaidFrameManagerDisplayFrameLeaderOptionsInitiateRolePoll)
  107. CreateBackdrop(CompactRaidFrameManagerDisplayFrameLeaderOptionsInitiateReadyCheck)
  108. CreateBackdrop(CompactRaidFrameManagerDisplayFrameLeaderOptionsRaidWorldMarkerButton)
  109. CreateBackdrop(CompactRaidFrameManagerDisplayFrameLockedModeToggle)
  110. CreateBackdrop(CompactRaidFrameManagerDisplayFrameHiddenModeToggle)
  111. CreateBackdrop(CompactRaidFrameManagerDisplayFrameConvertToRaid)
  112. CreateBackdrop(CompactRaidFrameManager)
  113. CompactRaidFrameManagerToggleButton:SetNormalTexture("Interface\\AddOns\\BobUI\\media\\buttons\\RaidPanel-Toggle")
  114.  
  115. --This is how you skin the default raid frames
  116. f = CreateFrame("Frame")
  117. f:SetScript("OnEvent", function(self, event, ...)
  118.     if event == "GROUP_ROSTER_UPDATE" then
  119.         for i = 1, 5 do -- Party Frames
  120.             _G["CompactPartyFrameMember" .. i]:CreateBeautyBorder(12)
  121.         end
  122.         for i = 1, 80 do -- Raid Frames, do we really have 80 of them? Don't remember
  123.             _G["CompactRaidFrame" .. i]:CreateBeautyBorder(12)
  124.         end
  125.         for i = 1, 5 do -- Raid Frames Group 1
  126.             _G["CompactRaidGroup1Member" .. i]:CreateBeautyBorder(12)
  127.         end
  128.         for i = 1, 5 do -- Raid Frames Group 2
  129.             _G["CompactRaidGroup2Member" .. i]:CreateBeautyBorder(12)
  130.         end
  131.         for i = 1, 5 do -- Raid Frames Group 3
  132.             _G["CompactRaidGroup3Member" .. i]:CreateBeautyBorder(12)
  133.         end
  134.         for i = 1, 5 do -- Raid Frames Group 5
  135.             _G["CompactRaidGroup4Member" .. i]:CreateBeautyBorder(12)
  136.         end
  137.         for i = 1, 5 do -- Raid Frames Group 6
  138.             _G["CompactRaidGroup5Member" .. i]:CreateBeautyBorder(12)
  139.         end
  140.         --Set the default raid frame options to how we want them
  141.         --apparently doesn't work?
  142.         SetCVar("useCompactPartyFrames", 1)
  143.         SetCVar("raidOptionShowBorders", 0)
  144.         SetCVar("raidFramesDisplayPowerBars", 1)
  145.         SetCVar("raidFramesDisplayClassColor", 1)
  146.  
  147.     end
  148. end)
  149. f:RegisterEvent("PLAYER_LOGIN")
  150. f:RegisterEvent("GROUP_ROSTER_UPDATE")
  151. f:RegisterEvent("ADDON_LOADED")
__________________
Tweets YouTube Website
  Reply With Quote
03-29-15, 12:08 AM   #2
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,240
Just my ignorance about playing with the default settings, so throwing this out there: how do you know the raid frames are compacted? What if they are not? Same with party frames. Wouldn't it be true that if you tried to skin the compact frames, yet the frames are normal sized, it would throw an error?

Something like "I can't find your compact frames because they don't exist, so here's an error!"
  Reply With Quote
03-29-15, 09:15 AM   #3
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 431
Created a simple frame to check loaded addons and it doesn't seem to register Blizzard_CompactRaidFrames.

I might be completely wrong on this, but maybe this is what you're looking for:
Lua Code:
  1. LoadAddOn("Blizzard_RaidUI")
__________________

Last edited by MunkDev : 03-29-15 at 09:18 AM.
  Reply With Quote
03-29-15, 12:31 PM   #4
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
This is line 123; the error is saying that _G["CompactRaidFrame" .. i] doesn't exist, so it's the same as calling nil:CreateBeautyBorder(12).
Lua Code:
  1. for i = 1, 80 do -- Raid Frames, do we really have 80 of them? Don't remember
  2.     _G["CompactRaidFrame" .. i]:CreateBeautyBorder(12)
  3. end
You need to add a check that the frame you're trying to access has been created, and you may as well make a function for it since you call it so many times.

Something like this..
Lua Code:
  1. local function Borderize(frame) -- style our frame
  2.     if frame then
  3.         frame:CreateBeautyBorder(12)
  4.     end
  5. end
  6.  
  7. -- ...
  8.  
  9. for i = 1, 5 do -- Party Frames
  10.     Borderize(_G["CompactPartyFrameMember" .. i])
  11. end
  12.  
  13. for i = 1, 80 do -- Raid Frames
  14.     Borderize(_G["CompactRaidFrame" .. i])
  15. end
  16. -- etc.

You should probably also have checks preventing you from styling the same frame more than once (I have no idea what CreateBeautyBorder does), and you have globals like "b" and "f", but that should at least fix your error.
  Reply With Quote
03-29-15, 12:39 PM   #5
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Don't force load Blizzard addons. You'll likely mess something totally up, including other addons that hook into them.

You need to watch ADDON_LOADED for the Blizzard addon and run your code then.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Skinning default raid frames

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off