WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=3)
-   -   Only messages with [LINKS] in trade? (https://www.wowinterface.com/forums/showthread.php?t=45785)

jlrm365 02-05-13 02:30 PM

Only messages with [LINKS] in trade?
 
I'm sure I remember seeing an addon that would not allow the display of messages in Trade channel, unless those messages contained links.

I hope that someone knows what this addon is / was, so that I can go and grab it.

I want to see people advertising their wares, so want to stay in trade, but the pointless chat often fills the screen and makes seeing genuine trade ads harder than it needs to be.

So..

Does an addon exist, that only allows you to see Trade channel messages with links?

Thanks.
:cool:

Phanx 02-06-13 12:08 AM

If you want to see all types of links:
Code:

ChatFrame_AddMessageEventFilter("CHAT_MSG_CHANNEL", function(_, _, message, _, _, _, _, _, _, _, channel)
    if channel == "Trade - City" and not message:find("|H") then
        return true
    end
end)

If you only want to see specific types of links (eg. only item, enchant, and tradeskill links):
Code:

local AllowedLinkTypes = {
    enchant = true,
    item = true,
    trade = true,
}
ChatFrame_AddMessageEventFilter("CHAT_MSG_CHANNEL", function(_, _, message, _, _, _, _, _, _, _, channel)
    if channel == "Trade - City" then
        local linkType = message:match("|H(.-):") or "none"
        return not AllowedLinkTypes[linkType]
    end
end)

For either, change "Trade - City" to the full name of the trade channel in your language.

If you need help turning the above code into an addon, copy and paste it into this page:
http://addon.ziuo.net/

jlrm365 02-06-13 06:27 AM

Quote:

Originally Posted by Phanx (Post 272771)
If you want to see all types of links:
Code:

ChatFrame_AddMessageEventFilter("CHAT_MSG_CHANNEL", function(_, _, message, _, _, _, _, _, _, _, channel)
    if channel == "Trade - City" and not message:find("|H") then
        return true
    end
end)

If you only want to see specific types of links (eg. only item, enchant, and tradeskill links):
Code:

local AllowedLinkTypes = {
    enchant = true,
    item = true,
    trade = true,
}
ChatFrame_AddMessageEventFilter("CHAT_MSG_CHANNEL", function(_, _, message, _, _, _, _, _, _, _, channel)
    if channel == "Trade - City" then
        local linkType = message:match("|H(.-):") or "none"
        return not AllowedLinkTypes[linkType]
    end
end)

For either, change "Trade - City" to the full name of the trade channel in your language.

If you need help turning the above code into an addon, copy and paste it into this page:
http://addon.ziuo.net/

That post is a near revelation - for the code and the link.

I tweaked the product of that site, so the TOC and LUA shared the same name, but the automation it makes possible is a great help.

I'm going to test the addon now :)
Thanks.

EDIT:

It works. I prefer the first - as it does just what I wanted, in a micro fashion - but I have some ideas (for the second and in general) and so sent you a PM.

Phanx 02-07-13 03:38 AM

If you have a question, post it on the forums. I read 99% of everything posted on these forums, and will reply if I can help, as will dozens of other community members.

I do not provide any kind of private support or tutoring, and all PMs/emails asking for private support or tutoring will be either ignored, or replied to with a form letter suggesting you post a forum thread.

jlrm365 02-08-13 02:10 PM

Quote:

Originally Posted by Phanx (Post 272796)
If you have a question, post it on the forums. I read 99% of everything posted on these forums, and will reply if I can help, as will dozens of other community members.

I do not provide any kind of private support or tutoring, and all PMs/emails asking for private support or tutoring will be either ignored, or replied to with a form letter suggesting you post a forum thread.

Getting to the point then:

Your first "If you want to see all types of links" version is what I consider to be a perfect "micro addon" - under 6 lines, does one thing and does it well.
Is that your own code or is it generic?

Either way, would you mind if I turned it into an addon, uploaded it and credited you (as I have done with a couple of other micro addons)?

I've been using it and it's brilliant. I think it's something that would save the sanity of a lot of people.
Thanks.

:cool:

Phanx 02-08-13 11:32 PM

It is "my own code" in the sense that I typed it into the forum's text box without copying or reading from anywhere else, but it is also extremely "generic" in the sense that anyone with a basic understanding of Lua and the the WoW chat filtering API would write pretty much the same code. Feel free to do whatever you want with it. If you do want to give me credit, please make sure it is clear that I am not involved with the addon and people should contact you about bugs/suggestions, not me.


All times are GMT -6. The time now is 12:54 PM.

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