Very big thanks!
I can get name of channel (trade, lfg, general), but I can't get name of guild, party, raid, say (recieving nil from channelString, channelNumber, channelName). How to get them?
Those are generated from different events. For example, CHAT_MSG_GUILD fires for messages to /g, CHAT_MSG_RAID and CHAT_MSG_RAID_LEADER for messages to /ra (depending on who is typing the message), and so forth.
CHAT_MSG_CHANNEL is for the numbered channels, like General or channels you've joined by typing /join.
The same handler function can be used for all of those events, simply be careful how you're treating the event parameters ("arg1", etc).
Those are generated from different events. For example, CHAT_MSG_GUILD fires for messages to /g, CHAT_MSG_RAID and CHAT_MSG_RAID_LEADER for messages to /ra (depending on who is typing the message), and so forth.
CHAT_MSG_CHANNEL is for the numbered channels, like General or channels you've joined by typing /join.
The same handler function can be used for all of those events, simply be careful how you're treating the event parameters ("arg1", etc).
I try to use they, but after
RegisterEvent("CHAT_MSG_GUILD")
"channelString", channelNumber, "channelName" returns nil and nothing :(
I try to use they, but after
RegisterEvent("CHAT_MSG_GUILD")
"channelString", channelNumber, "channelName" returns nil and nothing :(
Well, you haven't shown any code, so those variable names mean nothing to the rest of us.
But if you think about it, there's no need for them. Names and numbers are for the public numbered channels. Guild chat doesn't have a channel number. Guild chat doesn't have a channel name. It's guild chat.
Button:RegisterEvent("CHAT_MSG_GUILD")
Button:RegisterEvent("CHAT_MSG_OFFICER")
Button:RegisterEvent("CHAT_MSG_BATTLEGROUND")
Button:RegisterEvent("CHAT_MSG_BATTLEGROUND_LEADER")
Button:RegisterEvent("CHAT_MSG_PARTY")
Button:RegisterEvent("CHAT_MSG_RAID_LEADER")
Button:RegisterEvent("CHAT_MSG_RAID")
Button:RegisterEvent("CHAT_MSG_WHISPER")
Button:RegisterEvent("CHAT_MSG_BN_WHISPER")
Button:RegisterEvent("CHAT_MSG_CHANNEL")
Button:RegisterEvent("CHAT_MSG_SAY")
Button:SetScript("OnEvent", function(self, event, msg, sender, _, chanString, _, _, _, chanNumber, chanName)
if message ~= nil then
local mas = {"!mop","!mists","!pandaria","!panda"}
for i=1,#mas do
local startPos, endPos = string.find(msg,mas[i]);
if startPos ~= nil then
if string.sub(msg,startPos,endPos) == mas[i] then
if chanNumber > 0 then SendChatMessage(Report,"CHANNEL",nil,chanNumber) else SendChatMessage(Report,"GUILD")
end
end
end
end
I try to use this and can hook/send message to any channel, but I don't know how to distinguish message from SAY from message of GUILD
[Guild][Name]: chatmessage
How I can hook message text, sender name and channel name from chat?
Thanks!
P.S.: sorry for my english, it's very bad :(
Then you set the frame to register the event called "CHAT_MSG_CHANNEL". This will allow you to retrieve the information you want.
Once you have registered the event, you can set your frame to receive the script:
You can get more info from here: http://www.wowpedia.org/Events/Communication
Look for the event called "CHAT_MSG_CHANNEL"
Very big thanks!
I can get name of channel (trade, lfg, general), but I can't get name of guild, party, raid, say (recieving nil from channelString, channelNumber, channelName). How to get them?
CHAT_MSG_CHANNEL is for the numbered channels, like General or channels you've joined by typing /join.
The same handler function can be used for all of those events, simply be careful how you're treating the event parameters ("arg1", etc).
I try to use they, but after
RegisterEvent("CHAT_MSG_GUILD")
"channelString", channelNumber, "channelName" returns nil and nothing :(
Well, you haven't shown any code, so those variable names mean nothing to the rest of us.
But if you think about it, there's no need for them. Names and numbers are for the public numbered channels. Guild chat doesn't have a channel number. Guild chat doesn't have a channel name. It's guild chat.
I try to use this and can hook/send message to any channel, but I don't know how to distinguish message from SAY from message of GUILD
Just pointing this out again. :)