Saturday, April 14, 2012

chat_msg help

[:1]Hey guys. If i could get pointed in the right direction or get some help here I'd be vurrry happy!

Basically. I have some programming background, but these addons are a little confusing.

I'm trying to use the CHAT_MSG_WHISPER

with

script PlaySoundFile("Sound\\interface\\iTellMessage.wav")

I want to have a sound go off when I get a message from a few different players. lets just say playera playerb and playerc.

do I have to use the sender argument? if so, how do i use it?

Any help would be great. thanks guys!|||When event CHAT_MSG_WHISPER fires

arg2 is the author (sender)

You need a toc file,

You need a frame built with an xml file or within your lua that has an OnLoad and OnEvent call.

You need to register the event CHAT_MSG_WHISPER in your OnLoad handler.

You need to build a table of player names in your OnLoad handler.

YourTable = {

["Friendname1"] = 1,

["Friendname2"] = 1,

["Friendname3"] = 1,

["Friendname4"] = 1,

}

and in your event handler you would have


Code:
if (event == "CHAT_MSG_WHISPER") then
if YourTable[arg2] ~= nil then
PlaySoundFile("Sound\\interface\\iTellMessage.wav" )
end
end
|||Quote:








When event CHAT_MSG_WHISPER fires

arg2 is the author (sender)

You need a toc file,

You need a frame built with an xml file or within your lua that has an OnLoad and OnEvent call.

You need to register the event CHAT_MSG_WHISPER in your OnLoad handler.

You need to build a table of player names in your OnLoad handler.

YourTable = {

["Friendname1"] = 1,

["Friendname2"] = 1,

["Friendname3"] = 1,

["Friendname4"] = 1,

}

and in your event handler you would have


Code:
if (event == "CHAT_MSG_WHISPER") then
if YourTable[arg2] ~= nil then
PlaySoundFile("Sound\\interface\\iTellMessage.wav" )
end
end






Can anyone assist me with on_event send msg to custom channel by name?

I'm trying to set gatherer up for my friends, family, and myself to share nodes with each other in a specified chat channel and by friends list.

Here's the guild chat setup.


Code:
if Gatherer.Config.GetSetting("guild.enable") then
if ( IsInGuild() ) then
SendAddonMessage("GathX", sendMessage, "GUILD")
if (Gatherer.Config.GetSetting("guild.print.send")) then guildAlert = true end
end
end
|||Going to attempt to use this snippet tonight that I stole from http://www.wowwiki.com/API_SendChatMessage


Code:
if Gatherer.Config.GetSetting("mass.enable") then
local index = GetChannelName("massGather") -- It finds massGather is a channel at index #
if (index~=nil) then
SendChatMessage("GathX" +sendMessage , "CHANNEL", nil, index);
end
end



getting static from another part of mod

"\AddOns\Gatherer\GatherApi.lua line 72: attempt to call field 'Send' (a nil value)"


Code:
If this is our gather
if ( (not gatherSource) or (gatherSource == "REQUIRE") ) then
Gatherer.Comm.Send(objectId, gatherC, gatherZ, index, gatherCoins, gatherLoot)
end
|||You can imitate the prefix of the addonmessage by joining 2 strings, however since you are using a dedicated channel it is not needed. To join 2 strings you use a double period '..'


Code:
local SyncMessage = "GathX"..MessageToSend

As you are using a dedicated channel, it would be easier to set up the addon to assume any messages in that channel are already prefixed and just send the data with:


Code:
local id, name = GetChannelName("massGather");
if (id > 0 and name ~= nil) then
SendChatMessage(SyncMessage, "CHANNEL", nil, id)
end

You would then copy the mods original CHAT_MSG_ADDON receiving function, but remove the prefix requirement that will be there, and have it read from the standard channel instead.

Your error is 'Gatherer.Comm.Send' is not defined when you are calling it.

Wouldnt it be easier to just join a raid with the people you want to sync info with?|||It would be easier to raid the info, however I was trying to develop the addon to broadcast to select people that chose to hop guilds as well as family n such.

Mostly trying to pass up the time consuming event of sharing the database.

Ty for the help, I'll be trying it out by the end of the week.

No comments:

Post a Comment