Thread Tools Display Modes
05-08-19, 09:04 PM   #1
JDoubleU00
A Firelord
 
JDoubleU00's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 463
|h?

This is the code from TradeChannelCleaner, I've posted my question there, but the author has not responded so I thought I would ask here.

What does the |H do? Look for hyperlinks? I was trying to find documentation, but my GoogleFu is weak, any pointers there would be appreciated also.

Code:
ChatFrame_AddMessageEventFilter("CHAT_MSG_CHANNEL", function(_, _, message, _, _, _, _, _, _, _, channel)
    if channel == "Trade - City" and not message:find("|H") then
        return true
    end
end)
__________________
Author of JWExpBar and JWRepBar.
  Reply With Quote
05-08-19, 11:29 PM   #2
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Chat links are special strings that the chat frame translates into clickable buttons in the string, which you know as links or more typically hyperlinks (like on websites).

Without the chat window processing them, they look something like this:
Code:
|Hitem:7073:0:0:0:0:0:0:0:80:0|h[Broken Fang]|h
|H denotes the start of such a link, and what follows is the metadata about the link (such as the type of link, like "item", the item ID in this case, and the item's attributes). |h shows up twice, once to denote the end of the metadata, which is then followed with what should be displayed in the chat window (in this case [Broken Fang]), and ends with a final |h.

|H and |h here are escape sequences, similar to how |c is used to start a color sequence and ends with |r.

More information about links, and in particular itemLinks and itemStrings:
https://wow.gamepedia.com/UI_escape_...ces#Hyperlinks
https://wow.gamepedia.com/ItemLink
https://wow.gamepedia.com/ItemString

This is similar to how links are made on websites, in which they are made up of anchor tags. You'd see "click here" and you'd be able to click it, while the code to do that would be this:
Code:
<a href="www.wowinterface.com">click here</a>

Last edited by p3lim : 05-08-19 at 11:32 PM.
  Reply With Quote
05-08-19, 11:29 PM   #3
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Indeed, there are various tokens for things in chat strings like:

Code:
"41,130|TInterface\\MoneyFrame\\UI-GoldIcon:0:0:2:0|t 85|TInterface\\MoneyFrame\\UI-SilverIcon:0:0:2:0|t 71|TInterface\\MoneyFrame\\UI-CopperIcon:0:0:2:0|t"
the |T...|t is for icons, in this case gold/silver/copper in a money string.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
05-09-19, 04:54 AM   #4
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
Originally Posted by JDoubleU00 View Post
What does the |H do? Look for hyperlinks? I was trying to find documentation, but my GoogleFu is weak, any pointers there would be appreciated also.

Code:
ChatFrame_AddMessageEventFilter("CHAT_MSG_CHANNEL", function(_, _, message, _, _, _, _, _, _, _, channel)
    if channel == "Trade - City" and not message:find("|H") then
        return true
    end
end)
In short, what this code is doing is registering a filter to check if a message in trade chat contains a link. If it doesn't find one, it tells the ChatFrame to ignore the message. It's crude and easily defeated by anyone that actually types "|H" in chat, which will be read in as "||H".
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 05-09-19 at 04:57 AM.
  Reply With Quote
05-09-19, 07:28 AM   #5
JDoubleU00
A Firelord
 
JDoubleU00's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 463
Thanks for all the replies, this helps a lot.
__________________
Author of JWExpBar and JWRepBar.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » |h?

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