Quantcast
LF help with UIErrorsFrame:AddMessage - WoWInterface
Thread Tools Display Modes
07-04-20, 09:35 AM   #1
lol_i_need_ur_help
A Defias Bandit
Join Date: Jul 2020
Posts: 3
Post 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?
  Reply With Quote
07-04-20, 02:16 PM   #2
Kanegasi
A Firelord
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 496
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)
  Reply With Quote
07-04-20, 03:30 PM   #3
lol_i_need_ur_help
A Defias Bandit
Join Date: Jul 2020
Posts: 3
Thumbs up

Originally Posted by Kanegasi View Post
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.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » LF help with UIErrorsFrame:AddMessage

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