PDA

View Full Version : How to extract a string from a chatbox?


Nabmodder
02-07-2006, 01:39 PM
In an effort to learn the secrets of AddOn-creation I've done some simple tutorials, and now I'm trying to get a messagebox to appear when a whisper containing a certain string ("invite" or whatever) is received.
The addon reacts fine if I leave out the innermost "if", letting a messagebox pop up whenever a whisper is received.
At the moment my LUA-code looks like this:

function Bla_OnLoad()
this:RegisterEvent("CHAT_MSG_WHISPER");
end

function Bla_OnEvent()
if(event=="CHAT_MSG_WHISPER") then
-- if string.find(WHAT_TO_PUT_HERE, "hello") then
message("Weee!!");
-- end
end
end

How can I let the function "read" the chatbox? I've searched wowwiki for quite some time but stuff like DEFAULT_CHAT_BOX etc. aren't really that well documented and it's unclear to me how to access/read a chatbox.
If extracting a string is more complex than it would seem to me, tell me to learn2script :azn:

Any help is most welcome :smiley: