Thread Tools Display Modes
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
02-20-23, 01:55 AM   #2
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
Hi all,

I'd like to refresh this topic because it drives me crazy

Is possible that in DragonFlight (latest patch) the
Lua Code:
  1. SendChatMessage()
has known limitations that unfortunately I am unable to find ?

I explain better.

Lua Code:
  1. [... parse COMBAT_LOG_EVENT_UNFILTERED ... ]
  2. if clevent=="SPELL_DISPEL" then
  3.     p_autopsy_msg = string.format(L["%s: %s dispelled %s %s %s"],prgname,classcolor(sourceName), destName, GetSpellLink(suffixParam1) or suffixParam2, usedSpell)
  4.     autopsy_msg = string.format(L["%s: %s dispelled %s %s %s"],prgname,sourceName, destName, suffixParam2, usedSpell)
  5. end
  6.  
  7. -- I want to send in chat the dispel announce for example.
  8. -- I made 2 message because I remembered that there was problem with color code in sendchat.
  9.  
  10. -- if , for example, I am in a dungeon5 finder I am inside here:
  11. if IsInGroup(LE_PARTY_CATEGORY_INSTANCE) then
  12.     print(p_autopsy_msg)
  13.     SendChatMessage(autopsy_msg, "INSTANCE_CHAT")
  14. end

to test I have used also a print() and it works while the second SendChatMessage() no.
And I dont understand why :/

Same story for:

Lua Code:
  1. if IsInGroup(LE_PARTY_CATEGORY_HOME) then
  2.     if IsInRaid() then SendChatMessage(autopsy_msg, "RAID") end
  3.     if IsInGroup() then SendChatMessage(autopsy_msg, "PARTY") end
  4. end
  5.  
  6. if not inGroup then
  7.     print(p_autopsy_msg)
  8. end

I have tried also to use in this way:
Lua Code:
  1. SendChatMessage(autopsy_msg, IsInGroup(LE_PARTY_CATEGORY_INSTANCE) and 'INSTANCE_CHAT' or IsInRaid() and 'RAID' or IsInGroup() and 'PARTY' or 'SAY')

But it doesnt want to work.

Any idea will be, as always, really appreciated.

Thanks.
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote
02-20-23, 02:27 AM   #3
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,360
SendChatMessage behavior changes based on instance/non instance status not group.
  Reply With Quote
02-20-23, 01:00 PM   #4
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
Hi Dridzt,

thanks for your answer.

Can you explain better please because I was not able to fully understand

The compact code:
Lua Code:
  1. SendChatMessage(msg, IsInGroup(LE_PARTY_CATEGORY_INSTANCE) and "INSTANCE_CHAT" or IsInRaid() and "RAID" or IsInGroup() and "PARTY" or "SAY")

I have found this code was suggested a lot of times and it should work without problems...

Only take care of these:
https://wowwiki-archive.fandom.com/w...sageCharacters

Really thanks !

P.s.
I found also this that I wrote on the same addon on 2012
Time flies..
https://www.wowinterface.com/forums/...ad.php?t=45493
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote
02-23-23, 12:41 AM   #5
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
Hi guys,

I wrote this only to let you know that I found finally why I was not able to use sendchat.

I thought I had cleaned everything and make a plain vanilla string output to send but I was wrong

The strings were these:
Lua Code:
  1. p_autopsy_msg = string.format(L["%s: %s dispelled %s %s %s"],prgname,classcolor(sourceName), destName, GetSpellLink(suffixParam1) or suffixParam2, usedSpell)
  2. autopsy_msg = string.format(L["%s: %s dispelled %s %s %s"],prgname,sourceName, destName, GetSpellLink(suffixParam1), usedSpell)

where I used the first in print() the second in sendchat() thinking it was a clean one.

But it wasn't because in the first lines of addon I have:
local prgname = "|cffffd200"..ADDON.."|r"

I really forgot about it and it didn't capture my attention before.

Now I have converted the string in something like:
Lua Code:
  1. autopsy_msg = string.format(L["%s: %s dispelled %s %s %s"],ADDON,sourceName, destName, GetSpellLink(suffixParam1), usedSpell)

... and everything automagically begins to works like a charm :-)

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

WoWInterface » Developer Discussions » Lua/XML Help » SendChatMessage behaviour


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off