Thread Tools Display Modes
03-29-16, 05:11 PM   #1
EvilMaddness
An Aku'mai Servant
 
EvilMaddness's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2015
Posts: 33
Code works but not 100% yet

I was able to get the color code to work on the health text but it's changing color when clicking on a target or switching from yellow to green also. I was going to use the same code to change the color for the power text but I'm not any good at lua programming.

Code:
hooksecurefunc("TextStatusBar_UpdateTextStringWithValues",function(statusFrame, _, value, valueMin, valueMax)
 local statusFrame = PlayerFrameHealthBarText
 if statusFrame and PlayerFrameHealthBarTextLeft and PlayerFrameHealthBarTextRight then
 local percent = value / valueMax
 local r,g,b = 1,0.82,0 -- yellow
 if percent < 0.335 then
 r,g,b = 1,0,0 -- red
 elseif percent > 0.665 then
 r,g,b = 0,1,0 -- green
 end
 PlayerFrameHealthBarTextLeft:SetTextColor(r,g,b)
 PlayerFrameHealthBarTextRight:SetTextColor(r,g,b)
 end
end)
__________________
The Maddness Within lua
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Code works but not 100% yet


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