View Single Post
01-22-23, 01:29 PM   #1
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
SendChatMessage behaviour

Hi all,

I had an old addon that prints in a chosen channel when someone died and for what it is happened.
Now I have expanded it with the announces also of the spells interrupts/dispell/steals.

But the problem is that it only randomly works.
It never, never, SendChatMessage the spell interrupts/dispell in the channel chosen but it works only with a simple print().
It sometimes SendChatMessage the death of someone in the chosen channel, and always works with print().

I know that now SendChatMessage() is a restricted in outdoor for the the "SAY", "YELL" and others.
But it should work in INSTANCE/GUILD and other channel as well without problems.

The code I use is something similar to these:

Lua Code:
  1. local msg = "This is the message of the death or of the interrupted spell"
  2. if CONFIGURED_CHANNEL == "GROUP" then
  3.     SendChatMessage(msg, IsInGroup(LE_PARTY_CATEGORY_INSTANCE) and 'INSTANCE_CHAT' or IsInRaid() and 'RAID' or IsInGroup() and 'PARTY' or 'SAY')
  4. else
  5.     print(msg)
  6. end

Lua Code:
  1. local msg = "This is the message of the death or of the interrupted spell"
  2. if CONFIGURED_CHANNEL == "GROUP" then
  3.     if IsInGroup(LE_PARTY_CATEGORY_INSTANCE) then
  4.         channel = "INSTANCE_CHAT"
  5.     elseif IsInRaid() then
  6.         channel = "RAID"
  7.     elseif IsInGroup() then
  8.         channel = "PARTY"
  9.     else
  10.         channel = "SELF"
  11.     end
  12.     SendChatMessage(msg, channel)
  13. else
  14.     print(msg)
  15. end
Both versions doesn't work
Could be related to the fact that sometime this is triggered while in combat sometime while I am out of combat ?
Or there is something else I am missing ?

Basically I can simplify it because what I want to achieve is to find a method to announce what was happening to the party members.
.... If possible

Thanks for any helps.
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote