font color from tooltip
So i would like to know font color from a given tooltip line
cant find anything useful in lua documentation for that And if its possible, that color would be same for all or could be changed by some addons already? |
If the text is colored using inline color codes:
Code:
-- turns "|cffff0000" into 255, 0, 0 for example Code:
local r, g, b = GameTooltipTextLeft1:GetTextColor() |
Thanks, maybe i dont need compare strings and can get all i want from color :banana:
|
When the text is using inline color codes, GetTextColor will still return the default color (usually white), so you still need to use string matching to determine whether there are inline color codes overriding the deafult color.
|
some things i dont get here
basically i want scan dropped item and know if they are thunderforged, elite etc. that info is in 2nd tooltip line, so knowing that line is green (if item is normal, there is item level in that line written in different color) is better than comparing strings from all languages. but when i do print(GameTooltipTextLeft2:GetText()) its coming in white, but still got green from GameTooltipTextLeft2:GetTextColor(), well greenish, gets me g 0.99999779462814 when doing it with itemLevel line, print "pass" correct color well, i wrote something and need wait for debug till wednesday probably ;) |
SetTextColor only affects the individual font string object it's called on. The text and the color are not intriniscally connected, so if you take the text from that font string object, and display it on another font string object, or pass it to a function -- like print() -- you only get the text, not the color or alignment or size or any other properties of the original font string object.
If you got a color when print()-ing the item level line, that means that the item level line uses inline color codes (eg. "|cffffd000Item Level: 496|r") which override the text color set on the font object. Also, based on what you described, you will need to use string matching on the actual text content, as that green text can be "Heroic" -- or it can be "Raid Finder", or it could be something else. Fortunately, you don't need to do any of the work translating the string; you can just use the pre-defined Blizzard global strings. For example: Code:
if GameTooltipTextLeft2:GetText() == ITEM_HEROIC then Code:
local r, g, b = GameTooltipTextLeft2:GetTextColor() |
thanks fro explanation
i dont mind getting all other green information text, yours idea seems much more elegant tho have problem with global strings, at http://wow.go-hero.net/framexml/1665...rings.lua/diff nothing about Thunderforged . From where i can get latest build? 16733. Checked ingame and guesses like THUNDERFORGED or ITEM_THUNDERFORGED not working :) |
yea, found how to export current build via console, but nothing there
|
Reposted from earlier:
Quote:
|
Oh, I should have posted a link... you can see the GlobalStrings.lua file for all locales here:
https://github.com/phanx/wow-globalstrings Unfortunately it looks like there isn't a global string for "Thunderforged". But, I'm fairly certain that all the other possibilities for that line (Heroic, Raid Finder, is there anything else?) do have global strings, so if you see green text in GameTooltipTextLeft2 and it isn't ITEM_HEROIC or RAID_FINDER, then it's probably safe to assume it's "Thunderforged". |
Elite, Heroic Elite, Thunderforged, Heroic Thunderforged are strings interesting me here
i get tooltip from SetLootItem(index), Raid Finder cannot occur, so my scan look like Lua Code:
I crate that tooltip frame with GameTooltipTemplate, so strings there are as before any addons touch them? i could use just values item levels to determine if weapon/armor is upgraded, but that way, when Blizz add Favored, Blessed or Cinnamon :) items, i dont need to change a thing |
Quote:
If you did want to try item level matching, you can capture it like so: Code:
-- Construct your pattern once at the top of the file: |
All times are GMT -6. The time now is 09:50 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI