WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   LF help with UIErrorsFrame:AddMessage (https://www.wowinterface.com/forums/showthread.php?t=58077)

lol_i_need_ur_help 07-04-20 09:35 AM

LF help with UIErrorsFrame:AddMessage
 
I my addon i have something like that:

UIErrorsFrame:AddMessage("Casted Cyclone on" .. UnitName("Target") .. "!!", 1.0, 2.0, 1.0, 53, 3);


Well i need help with next things:

1. How-to replace Cyclone with icon .
2. How-to print target name colored.
3. How-to make size of text more bigger.

Any ideas please?

Kanegasi 07-04-20 02:16 PM

The text size is dictated by UIErrorsFrame itself, I don't think you can change the size of an individual line.

As for the icon, I don't think you can dynamically get the file path to use in the texture escape sequence if you were looking to code for any spell, but you can look up the file name on wowhead by finding the icon ID.

Code:

Cyclone spell ID is 33786:
    https://www.wowhead.com/spell=33786
Click on the icon and the popup shows 136022, so:
    https://www.wowhead.com/icon=136022
File name is "Spell_nature_earthbind", so:
    /run print("\124TInterface\\ICONS\\Spell_nature_earthbind:0\124t")
This command prints the icon autosized to your chat frame.

Now for the class color, you'll have to query UnitGUID("target"), then the second return of GetPlayerInfoByGUID(guid), then RAID_CLASS_COLORS[class].colorStr.

Code:

local guid,_,class,color=UnitGUID("target")
if guid then
    _,class=GetPlayerInfoByGUID(guid)
end
if class then
    color=RAID_CLASS_COLORS[class].colorStr
end

Now put everything together:

Lua Code:
  1. local guid,name,_,class,color=UnitGUID("target"),UnitName("target")
  2. if guid then
  3.     _,class=GetPlayerInfoByGUID(guid)
  4. end
  5. if class then
  6.     color=RAID_CLASS_COLORS[class].colorStr
  7. end
  8.  
  9. UIErrorsFrame:AddMessage("Casted \124TInterface\\ICONS\\Spell_nature_earthbind:0\124t on "..((color and "\124C"..color or "")..(name or "")..(color and "\124r" or "")).."!!",1.0,2.0,1.0,53,3)

lol_i_need_ur_help 07-04-20 03:30 PM

Quote:

Originally Posted by Kanegasi (Post 336284)
The text size is dictated by UIErrorsFrame itself, I don't think you can change the size of an individual line.

As for the icon, I don't think you can dynamically get the file path to use in the texture escape sequence if you were looking to code for any spell, but you can look up the file name on wowhead by finding the icon ID.

Code:

Cyclone spell ID is 33786:
    https://www.wowhead.com/spell=33786
Click on the icon and the popup shows 136022, so:
    https://www.wowhead.com/icon=136022
File name is "Spell_nature_earthbind", so:
    /run print("\124TInterface\\ICONS\\Spell_nature_earthbind:0\124t")
This command prints the icon autosized to your chat frame.

Now for the class color, you'll have to query UnitGUID("target"), then the second return of GetPlayerInfoByGUID(guid), then RAID_CLASS_COLORS[class].colorStr.

Code:

local guid,_,class,color=UnitGUID("target")
if guid then
    _,class=GetPlayerInfoByGUID(guid)
end
if class then
    color=RAID_CLASS_COLORS[class].colorStr
end

Now put everything together:

Lua Code:
  1. local guid,name,_,class,color=UnitGUID("target"),UnitName("target")
  2. if guid then
  3.     _,class=GetPlayerInfoByGUID(guid)
  4. end
  5. if class then
  6.     color=RAID_CLASS_COLORS[class].colorStr
  7. end
  8.  
  9. UIErrorsFrame:AddMessage("Casted \124TInterface\\ICONS\\Spell_nature_earthbind:0\124t on "..((color and "\124C"..color or "")..(name or "")..(color and "\124r" or "")).."!!",1.0,2.0,1.0,53,3)

Thanks so much. :o


All times are GMT -6. The time now is 12:55 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI