Thread Tools Display Modes
06/19/14, 07:33 PM   #1
SkOODaT
 
SkOODaT's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 58
New question GetClassColor() ~ Undocumented

Found GetClassColor() in the raw dump ive tested it and seems to output r,g,b infos but i have an issue :S

local c1, c2, c3 = GetClassColor("reticleover")

c1 gets all the r,g,b information and c2, c3 get nil lol
is thier any way to take the string it ouputs and format it into r,g,b

thank you
  Reply With Quote
06/19/14, 08:46 PM   #2
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Originally Posted by SkOODaT View Post
Found GetClassColor() in the raw dump ive tested it and seems to output r,g,b infos but i have an issue :S

local c1, c2, c3 = GetClassColor("reticleover")

c1 gets all the r,g,b information and c2, c3 get nil lol
is thier any way to take the string it ouputs and format it into r,g,b

thank you
Return value from function GetClassColor(classId) is ZO_ColorDef object, so you can use all its methods.

Lua Code:
  1. local colorDef = GetClassColor(6) --6 = templar
  2.  
  3. local r,g,b = colorDef:UnpackRGB()
  4. local r,g,b,a = colorDef:UnpackRGBA()
  5. local hexString = colorDef:ToHex()
  6. local r,g,b,a = colorDef.r, colorDef.g, colorDef.b, colorDef.a
  7.  
  8. --or you can use for example:
  9. local colorizedText = colorDef:Colorize(text)
  Reply With Quote
06/19/14, 10:27 PM   #3
SkOODaT
 
SkOODaT's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 58
Originally Posted by Garkin View Post
Return value from function GetClassColor(classId) is ZO_ColorDef object, so you can use all its methods.

Lua Code:
  1. local colorDef = GetClassColor(6) --6 = templar
  2.  
  3. local r,g,b = colorDef:UnpackRGB()
  4. local r,g,b,a = colorDef:UnpackRGBA()
  5. local hexString = colorDef:ToHex()
  6. local r,g,b,a = colorDef.r, colorDef.g, colorDef.b, colorDef.a
  7.  
  8. --or you can use for example:
  9. local colorizedText = colorDef:Colorize(text)

awesome thank you so much class works perfect now

is thier any way by chance to use :ToHex() with something like GetUnitReactionColor("reticleover")

im uesing a borrowed function to convert it seems to cause a delay when updateing my text :S
Lua Code:
  1. local function RGBPercToHex(r, g, b)
  2.     r = r <= 1 and r >= 0 and r or 0
  3.     g = g <= 1 and g >= 0 and g or 0
  4.     b = b <= 1 and b >= 0 and b or 0
  5.     return string.format("%02x%02x%02x", r*255, g*255, b*255)
  6. end

local colorDef = GetUnitReactionColor("reticleover")
local hexString = colorDef:ToHex()

does not work lol

preview of what im working on

*** Note The Icons on the side of the health frame are part of the addon "Target Lookup" (Awsome Addon) and just happens to go along VERY well with my addons lol

Last edited by SkOODaT : 06/19/14 at 10:49 PM.
  Reply With Quote
06/20/14, 12:27 AM   #4
Sasky
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 231
Originally Posted by SkOODaT View Post
is thier any way by chance to use :ToHex() with something like GetUnitReactionColor("reticleover")
...
local colorDef = GetUnitReactionColor("reticleover")
local hexString = colorDef:ToHex()
GetUnitReactionColor("reticleover") returns r, g, and b values

You could use them to create your own ZO_ColorDef object and then use it that way.

Zgoo dump of the ZO_ColorDef object:
Warning: Spoiler


To create a new ColorDef, you can use:
Lua Code:
  1. local myColor = ZO_ColorDef:New(red, green, blue, alpha)

Any you leave out will default to 1.
Since GetUnitReactionColor returns r,g,b you can do the following:

Lua Code:
  1. local colorDef = ZO_ColorDef:New(GetUnitReactionColor("reticleover"))
  2. local hexString = colorDef:ToHex()
  Reply With Quote
06/20/14, 10:08 AM   #5
Tonyleila
 
Tonyleila's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 288
So if I read this right there are already class colors defined by the game?
Cause for the Guild Chat addon we used custom colors:
http://www.esoui.com/downloads/info494-GuildChat.html

Templar =white
Sorcerer =blue
Dragon Knight = red
Nightblade = purple
  Reply With Quote
06/20/14, 12:02 PM   #6
SkOODaT
 
SkOODaT's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 58
thank you so much for the help ill try that out with reaction.....

Originally Posted by Tonyleila View Post
So if I read this right there are already class colors defined by the game?
Cause for the Guild Chat addon we used custom colors:
http://www.esoui.com/downloads/info494-GuildChat.html

Templar =white
Sorcerer =blue
Dragon Knight = red
Nightblade = purple
yes thier is lol found it hidden in the raw dump

Templar =white
Sorcerer = tealish color
Dragon Knight = orangeish color
Nightblade = purple

Templar =white sucks tho cause most text is white wish ESO had labeled them a diff colour maby an off-white


** unfortunately it seems

Lua Code:
  1. local colorDef = ZO_ColorDef:New(GetUnitReactionColor("reticleover"))
  2.  local hexString = colorDef:ToHex()
  3. NameString = "|c"..hexString..Name.."|r"

causes the same delay i was expierenceing with the convert to hex function when coloring the unit name with reaction color the only way i seem to be able to avoid this is by setting the color on the entire name text frame, the delay is very minimal almost unnoticable but overall setting it entirely seems to work better for some reason :S

Lua Code:
  1. r, g, b = GetUnitReactionColor("reticleover")
  2. ZO_TargetUnitFramereticleoverName:SetColor(r, g, b, 1)

ESO target frame text is really hard to work with in general :S lol

Last edited by SkOODaT : 06/20/14 at 01:26 PM.
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » New question GetClassColor() ~ Undocumented


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