WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   How to show and hide a button when chat events happen? (https://www.wowinterface.com/forums/showthread.php?t=57760)

SPIRATES 01-03-20 02:45 PM

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)



All times are GMT -6. The time now is 01:21 PM.

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