WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   |h? (https://www.wowinterface.com/forums/showthread.php?t=57133)

JDoubleU00 05-08-19 09:04 PM

|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)


p3lim 05-08-19 11:29 PM

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>

Fizzlemizz 05-08-19 11:29 PM

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.

SDPhantom 05-09-19 04:54 AM

Quote:

Originally Posted by JDoubleU00 (Post 332042)
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".

JDoubleU00 05-09-19 07:28 AM

Thanks for all the replies, this helps a lot.


All times are GMT -6. The time now is 01:13 AM.

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