View Single Post
01-03-20, 02:45 PM   #1
SPIRATES
A Defias Bandit
Join Date: Sep 2008
Posts: 2
How to show and hide a button when chat events happen?

So I'm using TMW (an addon) which has a window for LUA or API code. I have managed to create a button which lights up when I'm in specific zones by using the API function GetZoneText() == "Orgrimmar".

To my dismay there are no API function that can check the chatwindow for specific words like it can check for zone names.

How can I make a script that makes a button light up if X is written in chat, and then hide the same icon if Y or Z is written?

I've searched abit and currently have the following code which I'm trying to modify but dont know how:

Code:
local frame = CreateFrame("Frame")
frame:RegisterEvent("CHAT_MSG_SAY")
frame:SetScript("OnEvent", function(self, event, message, sender)
        if event == "CHAT_MSG_SAY" and message:lower():match("hello world") then
            LIGHT UP THIS BUTTON!?!??!
            
        end
end)
  Reply With Quote