Thread Tools Display Modes
03-10-16, 12:16 PM   #21
slayos
A Deviate Faerie Dragon
 
slayos's Avatar
Join Date: May 2015
Posts: 15
Originally Posted by Fizzlemizz View Post
local perc = Percent(cur,max)

Would appear to be converting current health into a percentage of max so if you just change perc to cur as the return by:
Code:
	if perc >= 76 then
		return "|cff00d036%s%%|r", cur
	elseif perc >= 26 then
		return "|cfff19c08%s%%|r",cur
	else
		return "|cfff10808%s%%|r",cur
	end
You also have duplicate
Code:
local s = Status(unit)
if s then
    return s
end
Statements.
For the boss you woulld need to substitute the function it's using to convert the values and replace it with Percent as in your code above.
Could you possible give me my code back fixed the way that you'd do it? I'm not really that good at coding.
  Reply With Quote
03-10-16, 12:18 PM   #22
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Code:
local s = Status(unit)
if s then
	return s
end
local cur, max = HP(unit), MaxHP(unit)
local perc = Percent(cur,max)
if UnitIsFriend(unit,"player") then
	if perc >= 76 then
		return "|cff00d036%s%%|r", cur
	elseif perc >= 26 then
		return "|cfff19c08%s%%|r",cur
	else
		return "|cfff10808%s%%|r",cur
	end
else
	return perc
end
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
03-10-16, 12:23 PM   #23
slayos
A Deviate Faerie Dragon
 
slayos's Avatar
Join Date: May 2015
Posts: 15
Originally Posted by Fizzlemizz View Post
Code:
local s = Status(unit)
if s then
	return s
end
local cur, max = HP(unit), MaxHP(unit)
local perc = Percent(cur,max)
if UnitIsFriend(unit,"player") then
	if perc >= 76 then
		return "|cff00d036%s%%|r", cur
	elseif perc >= 26 then
		return "|cfff19c08%s%%|r",cur
	else
		return "|cfff10808%s%%|r",cur
	end
else
	return perc
end
an issue has accured, on target "friendly" it shows their name exactly as i want it however with a % behind it, so let's say i got 418500 health it displays like this 418500% and on unfriendly target it displays like i want ut however 100 instred of 100%
  Reply With Quote
03-10-16, 12:37 PM   #24
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Apologies, too early in the morning .

Code:
local s = Status(unit)
if s then
	return s
end
local cur, max = HP(unit), MaxHP(unit)
local perc = Percent(cur,max)
if UnitIsFriend(unit,"player") then
	if perc >= 76 then
		return "|cff00d036%s|r",cur
	elseif perc >= 26 then
		return "|cfff19c08%s|r",cur
	else
		return "|cfff10808%s|r",cur
	end
else
	return "%s%%",perc
end
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
03-10-16, 12:39 PM   #25
slayos
A Deviate Faerie Dragon
 
slayos's Avatar
Join Date: May 2015
Posts: 15
Originally Posted by Fizzlemizz View Post
Apologies, too early in the morning .

Code:
local s = Status(unit)
if s then
	return s
end
local cur, max = HP(unit), MaxHP(unit)
local perc = Percent(cur,max)
if UnitIsFriend(unit,"player") then
	if perc >= 76 then
		return "|cff00d036%s|r", cur
	elseif perc >= 26 then
		return "|cfff19c08%s|r",cur
	else
		return "|cfff10808%s|r",cur
	end
else
	return "%s%%",perc
end
NICE! you have no idea how long i've been working on getting this fixed!!!, if it's not to much to ask since you're so good at this xD is it possible to make the unfriendly text colored like the friendly one to? i am a perfectionist xD
  Reply With Quote
03-10-16, 12:44 PM   #26
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Something like:

Code:
local s = Status(unit)
if s then
	return s
end
local cur, max = HP(unit), MaxHP(unit)
local perc = Percent(cur,max)
local ret
if perc >= 76 then
	ret = "|cff00d036%s"
elseif perc >= 26 then
	ret = "|cfff19c08%s"
else
	ret = "|cfff10808%s"
end
if UnitIsFriend(unit,"player") then
	ret = ret.."|r"
	return ret,cur
else
	ret = ret.."%%"|r"
	return ret,perc
end
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
03-10-16, 12:46 PM   #27
slayos
A Deviate Faerie Dragon
 
slayos's Avatar
Join Date: May 2015
Posts: 15
Originally Posted by Fizzlemizz View Post
Something like:

Code:
local s = Status(unit)
if s then
	return s
end
local cur, max = HP(unit), MaxHP(unit)
local perc = Percent(cur,max)
local ret
if perc >= 76 then
	ret = "|cff00d036%s"
elseif perc >= 26 then
	ret = "|cfff19c08%s"
else
	ret = "|cfff10808%s"
end
if UnitIsFriend(unit,"player") then
	ret = ret.."|r"
	return ret,cur
else
	ret = ret.."%%"|r"
	return ret,perc
end
Doesn't work :P
  Reply With Quote
03-10-16, 12:50 PM   #28
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Way too early ..

Code:
local s = Status(unit)
if s then
	return s
end
local cur, max = HP(unit), MaxHP(unit)
local perc = Percent(cur,max)
local ret
if perc >= 76 then
	ret = "|cff00d036%s"
elseif perc >= 26 then
	ret = "|cfff19c08%s"
else
	ret = "|cfff10808%s"
end
if UnitIsFriend(unit,"player") then
	ret = ret.."|r"
	return ret,cur
else
	ret = ret.."%%|r"
	return ret,perc
end
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
03-10-16, 12:53 PM   #29
slayos
A Deviate Faerie Dragon
 
slayos's Avatar
Join Date: May 2015
Posts: 15
Originally Posted by Fizzlemizz View Post
Way too early ..

Code:
local s = Status(unit)
if s then
	return s
end
local cur, max = HP(unit), MaxHP(unit)
local perc = Percent(cur,max)
local ret
if perc >= 76 then
	ret = "|cff00d036%s"
elseif perc >= 26 then
	ret = "|cfff19c08%s"
else
	ret = "|cfff10808%s"
end
if UnitIsFriend(unit,"player") then
	ret = ret.."|r"
	return ret,cur
else
	ret = ret.."%%|r"
	return ret,perc
end
worked xD thank you, i wish i was as good in coding, would've made this so much easyer lol xD

want to do 1 last before i got my whole ui complete? this one shouldn't be complicated
local _,power_name = UnitPowerType(unit)
local r,g,b = PowerColor(power_name)
local max = MaxPower(unit)
if max > 0 then
return "|cff%02x%02x%02x%s | %s",r,g,b,Short(Power(unit),true),Short(max,true)
end
this code is showing the text code like this "32.0k | 32.0k" but I want it to display it like this "32000"
  Reply With Quote
03-10-16, 01:09 PM   #30
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
local _,power_name = UnitPowerType(unit)
local r,g,b = PowerColor(power_name)
local max = MaxPower(unit)
if max > 0 then
return "|cff%02x%02x%02x%s|r",r,g,b,Power(unit)
end
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
03-10-16, 01:13 PM   #31
slayos
A Deviate Faerie Dragon
 
slayos's Avatar
Join Date: May 2015
Posts: 15
Originally Posted by Fizzlemizz View Post
local _,power_name = UnitPowerType(unit)
local r,g,b = PowerColor(power_name)
local max = MaxPower(unit)
if max > 0 then
return "|cff%02x%02x%02x%s|r",r,g,b,Power(unit)
end
i think that's it ;O thank you so much for the assistance m8, if i can do anything for you!
  Reply With Quote
03-11-16, 12:30 PM   #32
ceylina
A Wyrmkin Dreamwalker
Join Date: Oct 2014
Posts: 50
Not sure if you want it at all but here is my coding for health and power bars

I only color the health or power percentage and not the current/max health amount.

Health:

Code:
local cur, max = HP(unit), MaxHP(unit)
local r,g,b = HPColor(cur,max)
return "%s/%s |cff%02x%02x%02x(%s%%)|r",Short(cur,true),Short(max,true),r,g,b,Percent(cur,max)

Power:

Code:
local cur,max = Power(unit),MaxPower(unit)
local _,power_name = UnitPowerType(unit)
local r,g,b = PowerColor(power_name)
  return "%s/%s |cff%02x%02x%02x(%s%%)|r",Short(cur,true),Short(max,true),r,g,b,Percent(cur,max)

Druid mana

Code:
if UnitPowerType(unit) ~= 0 and DruidForm(unit) then
  local max = MaxPower(unit,0)
  local color = PitBull4.PowerColors["MANA"]
  local r,g,b = color[1]*255, color[2]*255, color[3]*255
    return "|cff%02x%02x%02x(%s%%)|r",r,g,b,Percent(Power(unit,0),max)
end
  Reply With Quote
03-15-16, 09:04 PM   #33
slayos
A Deviate Faerie Dragon
 
slayos's Avatar
Join Date: May 2015
Posts: 15
Wink Druid Mana

how can i get this code
if UnitPowerType(unit) ~= 0 and DruidForm(unit) then
local max = MaxPower(unit,0)
local color = PitBull4.PowerColors["MANA"]
local r,g,b = color[1]*255, color[2]*255, color[3]*255
return "|cff%02x%02x%02x(%s%%)|r",r,g,b,Percent(Power(unit,0),max)
end
to show Cur insted of Percent?

like so "32000" if that's whatt my mana is?

Thanks in advanse

Last edited by slayos : 03-15-16 at 09:08 PM.
  Reply With Quote
03-15-16, 09:08 PM   #34
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Code:
if UnitPowerType(unit) ~= 0 and DruidForm(unit) then
	local color = PitBull4.PowerColors["MANA"]
	local r,g,b = color[1]*255, color[2]*255, color[3]*255
	return "|cff%02x%02x%02x(%s)|r",r,g,b,Power(unit,0)
end
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
03-15-16, 09:11 PM   #35
slayos
A Deviate Faerie Dragon
 
slayos's Avatar
Join Date: May 2015
Posts: 15
Talking Thanks

Originally Posted by Fizzlemizz View Post
Code:
if UnitPowerType(unit) ~= 0 and DruidForm(unit) then
	local color = PitBull4.PowerColors["MANA"]
	local r,g,b = color[1]*255, color[2]*255, color[3]*255
	return "|cff%02x%02x%02x(%s)|r",r,g,b,Power(unit,0)
end
heh it's you again, seems like my UI just refuse to be done, there seem to duck up problems, after problems are solved heh ^ glad i got you to back me up though!
  Reply With Quote
03-15-16, 09:30 PM   #36
slayos
A Deviate Faerie Dragon
 
slayos's Avatar
Join Date: May 2015
Posts: 15
You don't happen to know a code that displays the spec of the player?

let's say i meet a "Holy Paladin" i got a own code that says f.ex "Holy" with class colored text or eventually show a img of the spec? pref the img is possible but text is more than fine!

Last edited by slayos : 03-15-16 at 10:59 PM.
  Reply With Quote
03-16-16, 09:59 AM   #37
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
I don't know Pitbull well enough to tell you exactly how but the process of getting a specialisation comes in two parts.

First determine if the target can be inspected and if so send an inspect request to the server.
Code:
if CanInspect("target") then
	frame:RegisterEvent("INSPECT_READY")
	NotifyInspect("target")
else
	print("Can't inspect target")
end
Once the server has gathered the information it will send an "INSPECT_READY" event to the designated frame(s) which can then retrieve the information.

Frames OnEvent script for the "INSPECT_READY" event:
Code:
local spec_id = GetInspectSpecialization("target")
self:UnregisterEvent("INSPECT_READY")
ClearInspectPlayer()
local id, name, description, icon, background, role, class = GetSpecializationInfoByID(spec_id)
print(name) -- or set a texture to display the icon
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
03-16-16, 10:18 AM   #38
slayos
A Deviate Faerie Dragon
 
slayos's Avatar
Join Date: May 2015
Posts: 15
How do i perform this action?
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » PitBull4 Lua texts - Colored health and power?

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