Thread Tools Display Modes
02-19-12, 06:14 PM   #1
Othgar
"That" Guy
 
Othgar's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2010
Posts: 228
Class coloring panels

I wrote this little addon a while ago to add some panels to my UI just to pretty things up a little, I've been trying to get them class colored off and on for a while now and can't figure out what I'm doing wrong. I'd really appreciate any help I can get here, for some reason today it's driving me a little nuts.

Here's the code:

LUA Code:
  1. --Functions
  2. local _, class = UnitClass("player")
  3. local r,g,b = RAID_CLASS_COLORS[class].r, RAID_CLASS_COLORS[class].g, RAID_CLASS_COLORS[class].b
  4. local UnitAffectingCombat = UnitAffectingCombat
  5. local UnitExists = UnitExists
  6.  
  7.  
  8.  
  9. --Panels of Lustiness
  10.  
  11. --MiniMap Panel
  12.  
  13. local m = CreateFrame("frame","mpanel",UIParent)
  14. m:SetWidth(256);
  15. m:SetHeight(256);
  16. m:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", 0, 0);
  17. m:SetFrameStrata("LOW");   
  18. m:SetClampedToScreen(1);
  19. m:SetBackdrop({bgFile="Interface\\Addons\\Lust Panels\\media\\corner"});
  20. m:SetBackdropColor(r,g,b,.5);
  21.  
  22. --Actionbar Panel
  23.  
  24.  
  25. --[[if IsAddOnLoaded("Bartender4") then
  26.     local a = CreateFrame("frame","apanel",UIParent);
  27.     a:SetWidth(575);
  28.     a:SetHeight(100);
  29.     a:SetPoint("CENTER", UIParent, "TOP", 0, -80);
  30.     a:SetFrameStrata("MEDIUM");
  31.     a:SetClampedToScreen(1);
  32.     a:SetBackdrop({bgFile="Interface\\Addons\\Lust Panels\\media\\bpanel"});
  33.     a:SetScript("OnUpdate", function(self, elapsed)
  34.         if UnitAffectingCombat(1) then
  35.             a:SetAlpha(.5)
  36.         elseif UnitExists("target") then
  37.             a:SetAlpha(.5)
  38.         else
  39.             a:SetAlpha(.1)
  40.            
  41.         end
  42.     end)
  43. else return
  44. end]]--
  45.  
  46. --Guild Chat
  47.  
  48. local g = CreateFrame("frame","mpanel",UIParent)
  49. g:SetWidth(256);
  50. g:SetHeight(350);
  51. g:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", 0, 0);
  52. g:SetFrameStrata("BACKGROUND");
  53. g:SetClampedToScreen(1);
  54. g:SetBackdrop({bgFile="Interface\\Addons\\Lust Panels\\media\\lchat"});
  55. g:SetBackdropColor(r,g,b,.5);
  56.  
  57. --Trade Chat
  58.  
  59. local t = CreateFrame("frame","mpanel",UIParent)
  60. t:SetWidth(256);
  61. t:SetHeight(350);
  62. t:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", 0, 0);
  63. t:SetFrameStrata("BACKGROUND");
  64. t:SetClampedToScreen(1);
  65. t:SetBackdrop({bgFile="Interface\\Addons\\Lust Panels\\media\\rchat"});
  66. t:SetBackdropColor(r,g,b, .5);
  67.  
  68.  
  69. --Top left panel
  70.  
  71. local q = CreateFrame("frame","mpanel",UIParent)
  72. q:SetWidth(256);
  73. q:SetHeight(256);
  74. q:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 0, 0);
  75. q:SetFrameStrata("MEDIUM");
  76. q:SetClampedToScreen(1);
  77. q:SetBackdrop({bgFile="Interface\\Addons\\Lust Panels\\media\\tlcorner"});
  78. q:SetBackdropColor(r,g,b,.5);
__________________


  Reply With Quote
02-19-12, 06:52 PM   #2
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
Originally Posted by Othgar View Post
I wrote this little addon a while ago to add some panels to my UI just to pretty things up a little, I've been trying to get them class colored off and on for a while now and can't figure out what I'm doing wrong. I'd really appreciate any help I can get here, for some reason today it's driving me a little nuts.

Here's the code:

LUA Code:
  1. --Functions
  2. local _, class = UnitClass("player")
  3. local r,g,b = RAID_CLASS_COLORS[class].r, RAID_CLASS_COLORS[class].g, RAID_CLASS_COLORS[class].b
  4. local UnitAffectingCombat = UnitAffectingCombat
  5. local UnitExists = UnitExists
  6.  
  7.  
  8.  
  9. --Panels of Lustiness
  10.  
  11. --MiniMap Panel
  12.  
  13. local m = CreateFrame("frame","mpanel",UIParent)
  14. m:SetWidth(256);
  15. m:SetHeight(256);
  16. m:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", 0, 0);
  17. m:SetFrameStrata("LOW");   
  18. m:SetClampedToScreen(1);
  19. m:SetBackdrop({bgFile="Interface\\Addons\\Lust Panels\\media\\corner"});
  20. m:SetBackdropColor(r,g,b,.5);
  21.  
  22. --Actionbar Panel
  23.  
  24.  
  25. --[[if IsAddOnLoaded("Bartender4") then
  26.     local a = CreateFrame("frame","apanel",UIParent);
  27.     a:SetWidth(575);
  28.     a:SetHeight(100);
  29.     a:SetPoint("CENTER", UIParent, "TOP", 0, -80);
  30.     a:SetFrameStrata("MEDIUM");
  31.     a:SetClampedToScreen(1);
  32.     a:SetBackdrop({bgFile="Interface\\Addons\\Lust Panels\\media\\bpanel"});
  33.     a:SetScript("OnUpdate", function(self, elapsed)
  34.         if UnitAffectingCombat(1) then
  35.             a:SetAlpha(.5)
  36.         elseif UnitExists("target") then
  37.             a:SetAlpha(.5)
  38.         else
  39.             a:SetAlpha(.1)
  40.            
  41.         end
  42.     end)
  43. else return
  44. end]]--
  45.  
  46. --Guild Chat
  47.  
  48. local g = CreateFrame("frame","mpanel",UIParent)
  49. g:SetWidth(256);
  50. g:SetHeight(350);
  51. g:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", 0, 0);
  52. g:SetFrameStrata("BACKGROUND");
  53. g:SetClampedToScreen(1);
  54. g:SetBackdrop({bgFile="Interface\\Addons\\Lust Panels\\media\\lchat"});
  55. g:SetBackdropColor(r,g,b,.5);
  56.  
  57. --Trade Chat
  58.  
  59. local t = CreateFrame("frame","mpanel",UIParent)
  60. t:SetWidth(256);
  61. t:SetHeight(350);
  62. t:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", 0, 0);
  63. t:SetFrameStrata("BACKGROUND");
  64. t:SetClampedToScreen(1);
  65. t:SetBackdrop({bgFile="Interface\\Addons\\Lust Panels\\media\\rchat"});
  66. t:SetBackdropColor(r,g,b, .5);
  67.  
  68.  
  69. --Top left panel
  70.  
  71. local q = CreateFrame("frame","mpanel",UIParent)
  72. q:SetWidth(256);
  73. q:SetHeight(256);
  74. q:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 0, 0);
  75. q:SetFrameStrata("MEDIUM");
  76. q:SetClampedToScreen(1);
  77. q:SetBackdrop({bgFile="Interface\\Addons\\Lust Panels\\media\\tlcorner"});
  78. q:SetBackdropColor(r,g,b,.5);
AftermathhUI.Class = select(2, UnitClass('player'))
AftermathhUI.Classcolor = RAID_CLASS_COLORS[AftermathhUI.Class]

This what i use
  Reply With Quote
02-19-12, 06:58 PM   #3
Haleth
This Space For Rent
 
Haleth's Avatar
Featured
Join Date: Sep 2008
Posts: 1,173
Actually your code should work... not sure what's wrong with it.

Try printing it and see what it returns.

Are you getting any lua errors? Maybe the texture is invalid. I'm not sure if textures with spaces in them are allowed.

Last edited by Haleth : 02-19-12 at 07:13 PM.
  Reply With Quote
02-19-12, 07:07 PM   #4
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
Originally Posted by Haleth View Post
Actually your code should work... not sure what's wrong with it.

Try printing it and see what it returns.

Are you getting any lua errors? Maybe the texture is invalid.
local r,g,b = RAID_CLASS_COLORS[class].r, RAID_CLASS_COLORS[class].g, RAID_CLASS_COLORS[class].b

is wrong

should be

RAID_CLASS_COLORS[AftermathhUI.Class]

only
  Reply With Quote
02-19-12, 07:09 PM   #5
Haleth
This Space For Rent
 
Haleth's Avatar
Featured
Join Date: Sep 2008
Posts: 1,173
You shouldn't assume that everyone uses your UI.
  Reply With Quote
02-19-12, 07:14 PM   #6
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
Originally Posted by Haleth View Post
You shouldn't assume that everyone uses your UI.
It's an example.. how i am using it..
  Reply With Quote
02-19-12, 07:17 PM   #7
Haleth
This Space For Rent
 
Haleth's Avatar
Featured
Join Date: Sep 2008
Posts: 1,173
The thing is that his code works so there is no reason to change it. Your code is actually exactly the same, just written in a different way.
  Reply With Quote
02-19-12, 07:24 PM   #8
Othgar
"That" Guy
 
Othgar's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2010
Posts: 228
I tried printing it and got nothing. I'm lost here lol I use the same method to class color my XP bar addon and it works fine for that.

This is the relevant code from my XP Bar addon:
LUA Code:
  1. local ThousandSeparator = ","
  2. local TipTitle = "Tribal XP"
  3. local _, class = UnitClass("player")
  4. local r,g,b = RAID_CLASS_COLORS[class].r, RAID_CLASS_COLORS[class].g, RAID_CLASS_COLORS[class].b
  5.  
  6.  
  7. local function FmtBigNum(n)
  8.         local left, num, right = string.match(n .. "", '^([^%d]*%d)(%d*)(.-)')
  9.         return left..(num:reverse():gsub('(%d%d%d)', '%1'.. ","):reverse())..right
  10. end
  11.  
  12. local TribalExperienceBar = CreateFrame("StatusBar","TribalExperienceBar",UIParent)
  13. TribalExperienceBar:SetWidth(95);
  14. TribalExperienceBar:SetHeight(50);
  15. TribalExperienceBar:SetPoint("CENTER", UIParent, "CENTER", 0, 0);
  16. TribalExperienceBar:SetFrameStrata("MEDIUM");  
  17. TribalExperienceBar:SetClampedToScreen(1);
  18. TribalExperienceBar:SetBackdrop({bgFile="Interface\\Tooltips\\UI-Tooltip-Background", edgeFile="", tile=1, tileSize=10, edgeSize=10, insets={left=2, right=2, top=2, bottom=2}});
  19. TribalExperienceBar:SetBackdropColor(r,g,b,0)
  20. TribalExperienceBar:SetMovable(1);
  21. TribalExperienceBar:EnableMouse(1);
  22.  
  23. TribalExperienceBar:SetStatusBarTexture("Interface\\AddOns\\TXP\\media\\xptexture_rentaire")
  24. TribalExperienceBar:SetStatusBarColor(r,g,b)
  25. TribalExperienceBar:SetAlpha(.5)
__________________



Last edited by Othgar : 02-19-12 at 07:31 PM. Reason: added info
  Reply With Quote
02-19-12, 07:32 PM   #9
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Game92 View Post
local r,g,b = RAID_CLASS_COLORS[class].r, RAID_CLASS_COLORS[class].g, RAID_CLASS_COLORS[class].b

is wrong

should be

RAID_CLASS_COLORS[AftermathhUI.Class]

only
It's not wrong, actually.

1. He clearly defined the variable class on the line before the one you're claiming is wrong.

2. Later in the code, he is clearly using three separate variables r, g, and b, instead of looking them up every time he wants to use them (eg. color.r and so forth) which would be a pointless waste of CPU time anyway. The only reason to look up the values "on demand" instead of upvaluing them at runtime is if you expect them to change at unpredictable times while you are logged in, or if they change at predictable times (eg. an event fires to indicate that they've changed) but change more often than you need to use them (so it's more efficient to just look them up on use instead of every time they change).

I don't even know how you looked at any of the code he posted and picked out that one, obviously-correct line and decided it was wrong...
  Reply With Quote
02-19-12, 07:38 PM   #10
Haleth
This Space For Rent
 
Haleth's Avatar
Featured
Join Date: Sep 2008
Posts: 1,173
Othgar; Try using a texture without a space in its name, I'm fairly convinced that's the problem because the code in your OP works for me (using a different texture though ofc).
  Reply With Quote
02-19-12, 07:39 PM   #11
Othgar
"That" Guy
 
Othgar's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2010
Posts: 228
Originally Posted by Phanx View Post
It's not wrong, actually.

1. He clearly defined the variable class on the line before the one you're claiming is wrong.

2. Later in the code, he is clearly using three separate variables r, g, and b, instead of looking them up every time he wants to use them (eg. color.r and so forth) which would be a pointless waste of CPU time anyway. The only reason to look up the values "on demand" instead of upvaluing them at runtime is if you expect them to change at unpredictable times while you are logged in, or if they change at predictable times (eg. an event fires to indicate that they've changed) but change more often than you need to use them (so it's more efficient to just look them up on use instead of every time they change).

I don't even know how you looked at any of the code he posted and picked out that one, obviously-correct line and decided it was wrong...
So then I guess it's right (?)... but it still doesn't work.
__________________


  Reply With Quote
02-19-12, 07:40 PM   #12
Othgar
"That" Guy
 
Othgar's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2010
Posts: 228
Originally Posted by Haleth View Post
Othgar; Try using a texture without a space in its name, I'm fairly convinced that's the problem because the code in your OP works for me (using a different texture though ofc).
OK I'll rename the textures and see if that does the trick. Thanks Haleth.

Wait none of the textures have names with spaces... corner, lchat, rchat and tlcorner are the texture names.
__________________



Last edited by Othgar : 02-19-12 at 07:44 PM.
  Reply With Quote
02-19-12, 07:47 PM   #13
Haleth
This Space For Rent
 
Haleth's Avatar
Featured
Join Date: Sep 2008
Posts: 1,173
"Lust Panels" has a space.
  Reply With Quote
02-19-12, 07:48 PM   #14
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
On the other hand, there are several actual issues with your code. In no particular order:

#1 - I can't see your actual textures, but in your code, you specify something like "width = 256, height = 350". If the actual pixel dimensions of your texture are 256 x 350, this is why it does not work. WoW will only recognize texture files whose pixel dimensions are powers of 8. To get a different size in-game, you can either resize the texture with SetSize (or SetWidth and SetHeight if you don't like shortcuts), or you can use multiple textures and position them adjacent to each other if you see too much distortion through resizing.

#2 - You give every panel frame the same global name, "mpanel". If you want the panels to be accessible from outside the file, you need to give them unique names, and I'd suggest something more descriptive, like "LustMinimapPanel" or "LustGuildChatPanel". If you don't need them to be accessible from outside, don't give them global names at all.

#3 - Using an OnUpdate script to watch for changes which have an associated event is hugely inefficient. Instead, use an OnEvent script, and register the frame for the relevant events (eg. PLAYER_TARGET_CHANGED fires when your target changes, including when you no longer have one, and PLAYER_REGEN_DISABLED and PLAYER_REGEN_ENABLED fire when you enter or leave combat, respectively).

#4 - Using a space in your addon's folder name is not recommended, due to the way operating systems handle spaces in file paths. I can't say for sure that this will cause any problems, but you should just stick to convention and rename your addon folder and TOC from "Lust Panels" to "LustPanels".

#5 - You should probably just parent some of these panels to the frame they're relevant to. The minimap panel, for example, should probably be parented to the minimap. This way, if someone moves the minimap, the panel will move with it.

#6 - For panels that do not need any scripts or mouse interactivity, you should just use a texture instead of a frame.
  Reply With Quote
02-19-12, 08:04 PM   #15
Othgar
"That" Guy
 
Othgar's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2010
Posts: 228
Originally Posted by Haleth View Post
"Lust Panels" has a space.
Ok so rename the main folder and TOC then got it.

Originally Posted by Phanx View Post
On the other hand, there are several actual issues with your code. In no particular order:

#1 - I can't see your actual textures, but in your code, you specify something like "width = 256, height = 350". If the actual pixel dimensions of your texture are 256 x 350, this is why it does not work. WoW will only recognize texture files whose pixel dimensions are powers of 8. To get a different size in-game, you can either resize the texture with SetSize (or SetWidth and SetHeight if you don't like shortcuts), or you can use multiple textures and position them adjacent to each other if you see too much distortion through resizing.

#2 - You give every panel frame the same global name, "mpanel". If you want the panels to be accessible from outside the file, you need to give them unique names, and I'd suggest something more descriptive, like "LustMinimapPanel" or "LustGuildChatPanel". If you don't need them to be accessible from outside, don't give them global names at all.

#3 - Using an OnUpdate script to watch for changes which have an associated event is hugely inefficient. Instead, use an OnEvent script, and register the frame for the relevant events (eg. PLAYER_TARGET_CHANGED fires when your target changes, including when you no longer have one, and PLAYER_REGEN_DISABLED and PLAYER_REGEN_ENABLED fire when you enter or leave combat, respectively).

#4 - Using a space in your addon's folder name is not recommended, due to the way operating systems handle spaces in file paths. I can't say for sure that this will cause any problems, but you should just stick to convention and rename your addon folder and TOC from "Lust Panels" to "LustPanels".

#5 - You should probably just parent some of these panels to the frame they're relevant to. The minimap panel, for example, should probably be parented to the minimap. This way, if someone moves the minimap, the panel will move with it.

#6 - For panels that do not need any scripts or mouse interactivity, you should just use a texture instead of a frame.
#1 The panels all work and the sizes are set to make them fit my UI. The only problem I am having is Class coloring the textures, they show up fine as they are just not colored.

#2 Honestly didn't even notice that I did that but I'll take a look at fixing it when I get them class colored.

#3 The on update script was the only way I could get the alpha to change with my Bartender4 bars. It is commented out because I have since moved the bars and that texture is no longer used. I tried to find a better method of doing this but was unable to do so See here

#4 Will be fixing this after I finish this post.

#5 I'm not really worried about anyone else moving the panels since I will probably never release this addon unless I include it as part of a full UI. And these textures won't look very good anywhere but where they are anyways.

#6 This is probably true, but since I'm pretty new to Lua and was a lot newer when I wrote it, this was the only way I knew how to do it. It works so I'm not worried about changing it unless I decide to release it as a complete UI.
__________________


  Reply With Quote
02-19-12, 08:26 PM   #16
Othgar
"That" Guy
 
Othgar's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2010
Posts: 228
I changed the addon name to LustPanels, changed the name of its folder to LustPanels, and Changed the TOC to LustPanels, gave each frame a unique name, and disabled everything but LustPanels and ACP and still no dice. all I get when I print the r, g, b is 0.96 ...grrr.. so here's the TOC and the Lua for the whole addon.

Lua:
LUA Code:
  1. -- Lust Panels, and some other neat UI stuff gathered from various sources to make my life easier.
  2.  
  3. --Functions
  4. local _, class = UnitClass("player")
  5. local r,g,b = RAID_CLASS_COLORS[class].r, RAID_CLASS_COLORS[class].g, RAID_CLASS_COLORS[class].b
  6. local UnitAffectingCombat = UnitAffectingCombat
  7. local UnitExists = UnitExists
  8.  
  9.  
  10.  
  11.  
  12. --Panels of Lustiness
  13.  
  14. --MiniMap Panel
  15.  
  16. local m = CreateFrame("frame","LustMinimapPanel",UIParent)
  17. m:SetWidth(256);
  18. m:SetHeight(256);
  19. m:SetPoint("TOPRIGHT", UIParent, "TOPRIGHT", 0, 0);
  20. m:SetFrameStrata("LOW");   
  21. m:SetClampedToScreen(1);
  22. m:SetBackdrop({bgFile="Interface\\Addons\\LustPanels\\media\\corner"});
  23. m:SetBackdropColor(r,g,b);
  24. m:SetAlpha(.5);
  25.  
  26. --Actionbar Panel
  27.  
  28.  
  29. --[[if IsAddOnLoaded("Bartender4") then
  30.     local a = CreateFrame("frame","LustBT4Panel",UIParent);
  31.     a:SetWidth(575);
  32.     a:SetHeight(100);
  33.     a:SetPoint("CENTER", UIParent, "TOP", 0, -80);
  34.     a:SetFrameStrata("MEDIUM");
  35.     a:SetClampedToScreen(1);
  36.     a:SetBackdrop({bgFile="Interface\\Addons\\LustPanels\\media\\bpanel"});
  37.     a:SetScript("OnUpdate", function(self, elapsed)
  38.         if UnitAffectingCombat(1) then
  39.             a:SetAlpha(.5)
  40.         elseif UnitExists("target") then
  41.             a:SetAlpha(.5)
  42.         else
  43.             a:SetAlpha(.1)
  44.            
  45.         end
  46.     end)
  47. else return
  48. end]]--
  49.  
  50. --Guild Chat
  51.  
  52. local g = CreateFrame("frame","LustGChatPanel",UIParent)
  53. g:SetWidth(256);
  54. g:SetHeight(350);
  55. g:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", 0, 0);
  56. g:SetFrameStrata("BACKGROUND");
  57. g:SetClampedToScreen(1);
  58. g:SetBackdrop({bgFile="Interface\\Addons\\LustPanels\\media\\lchat"});
  59. g:SetBackdropColor(r,g,b);
  60. g:SetAlpha(.5);
  61.  
  62. --Trade Chat
  63.  
  64. local t = CreateFrame("frame","LustTChatPanel",UIParent)
  65. t:SetWidth(256);
  66. t:SetHeight(350);
  67. t:SetPoint("BOTTOMRIGHT", UIParent, "BOTTOMRIGHT", 0, 0);
  68. t:SetFrameStrata("BACKGROUND");
  69. t:SetClampedToScreen(1);
  70. t:SetBackdrop({bgFile="Interface\\Addons\\LustPanels\\media\\rchat"});
  71. t:SetBackdropColor(r,g,b);
  72. t:SetAlpha(.5);
  73.  
  74.  
  75. --Top left panel
  76.  
  77. local q = CreateFrame("frame","LustTopLeftPanel",UIParent)
  78. q:SetWidth(256);
  79. q:SetHeight(256);
  80. q:SetPoint("TOPLEFT", UIParent, "TOPLEFT", 0, 0);
  81. q:SetFrameStrata("MEDIUM");
  82. q:SetClampedToScreen(1);
  83. q:SetBackdrop({bgFile="Interface\\Addons\\LustPanels\\media\\tlcorner"});
  84. q:SetBackdropColor(r,g,b);
  85. q:SetAlpha(.5);
  86.  
  87. -- Hides ALL error messages
  88.  
  89. UIErrorsFrame:Clear()
  90.  
  91. --More responsive chat tabs
  92.  
  93. CHAT_FRAME_TAB_SELECTED_MOUSEOVER_ALPHA = 1
  94. CHAT_FRAME_TAB_SELECTED_NOMOUSE_ALPHA = 0
  95. CHAT_TAB_HIDE_DELAY = 0
  96. CHAT_FRAME_TAB_ALERTING_MOUSEOVER_ALPHA = 1
  97. CHAT_FRAME_TAB_ALERTING_NOMOUSE_ALPHA = 0
  98. CHAT_FRAME_TAB_NORMAL_MOUSEOVER_ALPHA = 1
  99. CHAT_FRAME_TAB_NORMAL_NOMOUSE_ALPHA = 0
  100.  
  101. -- Making the chattabs invisible until mouseover
  102.  
  103. CHAT_FRAME_TAB_SELECTED_MOUSEOVER_ALPHA = 0.4
  104. CHAT_FRAME_TAB_SELECTED_NOMOUSE_ALPHA = 0
  105.  
  106. CHAT_FRAME_TAB_ALERTING_MOUSEOVER_ALPHA = 0
  107. CHAT_FRAME_TAB_ALERTING_NOMOUSE_ALPHA = 0
  108.  
  109. CHAT_FRAME_TAB_NORMAL_MOUSEOVER_ALPHA = 0.4
  110. CHAT_FRAME_TAB_NORMAL_NOMOUSE_ALPHA = 0
  111.  
  112. -- Blizz Raid Frame hider
  113.  
  114. CompactRaidFrameManager:UnregisterAllEvents()
  115. CompactRaidFrameManager:Hide()
  116. CompactRaidFrameContainer:UnregisterAllEvents()
  117. CompactRaidFrameContainer:Hide()
  118.  
  119. -- Forcing classcolors on
  120.  
  121. local frame=CreateFrame("Frame");
  122. frame:RegisterEvent("UPDATE_CHAT_COLOR_NAME_BY_CLASS");
  123. frame:SetScript("OnEvent",function(self,event,type,set)
  124.     if not set then SetChatColorNameByClass(type,true); end
  125. end);
  126.  
  127. -- /rl reloadUI
  128.  
  129. SlashCmdList['RELOAD'] = function() ReloadUI() end
  130. SLASH_RELOAD1 = '/rl'
  131.  
  132. --/rc Ready Check /role RoleCheck
  133.  
  134. SLASH_ROLECHECK1 = "/role"
  135. SLASH_ROLECHECK2 = "/rolecheck"
  136. SlashCmdList["ROLECHECK"] = function(self, txt)
  137.   InitiateRolePoll()
  138. end
  139.  
  140. SLASH_READYCHECK1 = "/rc"
  141. SlashCmdList["READYCHECK"] = function(self, txt)
  142.   DoReadyCheck()
  143. end

Code:
## Interface: 40300
## Author: Othgar/Lust
## Title: Lust Panels	
## Version: 1.0
## Notes: Panels of lusti-tribali-ness-esque
## OptionalDeps: Bartender4


panels.lua
and here's a .zip of the addon including the textures. Thanks for helping me out guys!
LustPanels.zip
__________________


  Reply With Quote
02-19-12, 08:26 PM   #17
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
That said, I loaded your code in-game and discovered one other (fairly major) issue. You defined your color values as r, g, and b, but then you later assign the variable name g to your guild chat panel, so the coloring of all further panels (everything except the minimap panel) is wrong, because :SetBackdropColor ignores any non-number values passed to it, so you're losing the green color information.

Other than that, though, all of the panels are colored, and after I changed the local variable name for the guild chat panel, they're all the correct class color.

The only other change I made before testing was to alter the bgFile texture paths to a file that actually exists on my system.

If the code isn't working for you (after changing the guild chat panel's local variable name) I don't really know why. The only things I can suggest:

#1 - Try manually setting the color of a panel in-game:
Code:
/run local c=RAID_CLASS_COLORS.SHAMAN mpanel:SetBackdropColor(c.r, c.g, c.b, 0.5)
Change SHAMAN to the name of your class, if you want.

#2 - Try to load only the code you posted, in its own addon, with all other addons disabled.

If neither of those work, then there is something severely wrong with your WoW installation, and you should delete the Cache folder and then run the Repair.exe tool.
  Reply With Quote
02-19-12, 08:43 PM   #18
Othgar
"That" Guy
 
Othgar's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2010
Posts: 228
Originally Posted by Phanx View Post
That said, I loaded your code in-game and discovered one other (fairly major) issue. You defined your color values as r, g, and b, but then you later assign the variable name g to your guild chat panel, so the coloring of all further panels (everything except the minimap panel) is wrong, because :SetBackdropColor ignores any non-number values passed to it, so you're losing the green color information.

Other than that, though, all of the panels are colored, and after I changed the local variable name for the guild chat panel, they're all the correct class color.

The only other change I made before testing was to alter the bgFile texture paths to a file that actually exists on my system.

If the code isn't working for you (after changing the guild chat panel's local variable name) I don't really know why. The only things I can suggest:

#1 - Try manually setting the color of a panel in-game:
Code:
/run local c=RAID_CLASS_COLORS.SHAMAN mpanel:SetBackdropColor(c.r, c.g, c.b, 0.5)
Change SHAMAN to the name of your class, if you want.

#2 - Try to load only the code you posted, in its own addon, with all other addons disabled.

If neither of those work, then there is something severely wrong with your WoW installation, and you should delete the Cache folder and then run the Repair.exe tool.
Thanks Phanx I thried coloring it in-game and it didn't change the color, but I could see the alpha changing if I changed the value. I think there has to be an issue with my textures. It's the only thing really left. Just for good measure though I deleted the cache folder and ran the repair tool and it said there were no problems found.

Update:

I recolored the MinimapPanel texture to solid white and it works fine now. Apparently the solid black can't be colored by Lua.
__________________



Last edited by Othgar : 02-19-12 at 08:54 PM. Reason: Update
  Reply With Quote
02-19-12, 09:02 PM   #19
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Yes. If you want to color your textures, it's best if they're white (or a similarly light color). Think of the textures as paper. If you are using black paper, you won't notice what color is drawn on top of it.
__________________
"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
02-19-12, 09:06 PM   #20
Othgar
"That" Guy
 
Othgar's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2010
Posts: 228
Originally Posted by Seerah View Post
Yes. If you want to color your textures, it's best if they're white (or a similarly light color). Think of the textures as paper. If you are using black paper, you won't notice what color is drawn on top of it.
Man I feel like an idiot now lol. But at least all is working as it's supposed to now. Thanks a lot for the help everyone. You guys rock!
__________________


  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Class coloring panels


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