Forum > Serverside Modding

[QUESTION] New gossip UI

<< < (2/2)

stoneharry:
This is a code snippet taken from one of my scripts:


--- Code: ---ChatFrame_MessageEventHandler2 = ChatFrame_MessageEventHandler

function ChatFrame_MessageEventHandler(s,e,arg1,...)
if arg1 ~= nil then
if arg1 ~= "" then
if string.find(arg1, "[CU-ADDON]", 1, true) ~= nil then
if (arg1 == "[CU-ADDON] OpenMenuFactionChoose") then
DestinyFrame_OnEvent(DestinyFrame, 0);
end
return;
elseif string.find(arg1, "CHAOTIC:SCENARIO", 1, true) ~= nil then
return;
elseif string.find(arg1, "[EoC-Addon]", 1, true) ~= nil then
if (arg1 == "[EoC-Addon] HungerGamesOpen") then
HungerGames:Show()
end
return;
end
end
end
ChatFrame_MessageEventHandler2(s,e,arg1,...)
end

--- End code ---

This hooks the chat frame, looks for strings and calls functions then returns if string matches are found. By returning, it does not actually show the message in the chat frame.

The better method to do this is via addon messages. http://wowprogramming.com/docs/api/SendAddonMessage I cannot remember the server-side code.

Navigation

[0] Message Index

[*] Previous page

Go to full version