This site works best with JavaScript enabled. Please enable JavaScript to get the best experience from this site.
An edit in SendCommMessage prevents the usage of a number for the "target" parameter.
When using a custom chat channel, the "target" parameter needs to be the channelID (a number) returned by GetChannelName("channel_name").
I made a change to my copy of SendCommMessage to allow "target" to be a number and everything works with using custom chat channels created with the
JoinTemporaryChannel() API call.
SendCommMessage is a wrapper around SendAddonMessage, I don't think you can send those to custom channels.
What kind of parameter would that be for type/distribution?
I verified, you can send to custom channels. Also, I put in my issue that i changed "SendCommMessage" to allow target to be a number and it worked. The number used is returned by: GetChannelName("channel_name").
Example:
self.Prefix = 'MyPrefix" self.ChannelName = 'MyChannel' self.ChannelPassword = 'AbCd123' local _, _ = JoinTemporaryChannel(self.ChannelName ,self.ChannelPassword) self.ChannelID, _ = GetChannelName(self.ChannelName) self:SendCommMessage(self.Prefix, Data, 'CHANNEL', self.ChannelID)
Hi.
I can confirm it. SendAddonMessage support use of custom channels. I've wrote following code for testing, shared it as addon with a guild member and it works.
local C = WrapTextInColorCode; local frame = CreateFrame("frame"); local prefix,chan,pw,id = "CCT-Px","CustomChannelTest","CustomChannelTest",false; frame:SetScript("OnEvent",function(self,event,...) if event=="PLAYER_LOGIN" then C_Timer.After(8,function() if (RegisterAddonMessagePrefix(prefix)~=nil) and (JoinTemporaryChannel(chan,pw)~=nil) then local chanId,chanName = GetChannelName(chan); if chanId then print(C("[Channel registered]","ffffee00"),"id="..C(chanId,"ff00ff00")); SendAddonMessage(prefix,"channel-testing","CHANNEL",chanId); end end end); elseif event=="CHAT_MSG_ADDON" and prefix==... then local _,msg,chType,toon,chLabel = ...; print(C("[AddOnMsg]","ffffee00"), "player="..C(toon,"ff00aaff"), "chan="..C(chLabel,"ffff7700"), "msg="..C(msg,"ff00ff00")); end end); frame:RegisterEvent("PLAYER_LOGIN"); frame:RegisterEvent("CHAT_MSG_ADDON");
Greetings Hizuro
I'm using ACE3 version: Ace3 Release - Revision r1166 (August 29th, 2017)which I got using the Twitch (Curse) desktop app. When I use a custom channel, I'm getting the following error:--------------------1x Census\Census-101.lua:3498: Usage: SendCommMessage(addon, "prefix", "text", "distribution"[, "target"[, "prio"[, callbackFn, callbackarg]]])[C]: ?Ace3\AceComm-3.0\AceComm-3.0-10.lua:91: in function `SendCommMessage' -------------------- The error is caused by line 88 of AceComm-3.0.lua which is a part of a series of conditional statements with a NOT in front of it:(target==nil or type(target)=="string") and This throws an error if the "target", which is the channel number, is NOT of type "string". Census - is the name of the addon that I wrote.
To post a comment, please login or register a new account.