Thread Tools Display Modes
11-15-17, 03:50 AM   #1
Joker119
A Flamescale Wyrmkin
 
Joker119's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2014
Posts: 113
Sending emotes targeting player to screen

So, I've noticed this is something Prat used to do, but it no longer works(I personally couldn't get it to work, but name-pop ups did), but my chat addon I've made is decidedly more simplistic than prat, and I find the code hard to cipher through to figure out how to implement it in mine..

I've attempted to do this myself with no luck, and I honestly can't figure out why.
I have this function
lua Code:
  1. local function scrollingEmotes(self, event, message, ...)
  2.    if event == "CHAT_MSG_TEXT_EMOTE" or "CHAT_MSG_EMOTE" then
  3.       UIErrorsFrame:AddMessage(message)
  4.       print("Test of Emote Event")
  5.    end
  6. end
  7.  
  8. local a = CreateFrame("Frame")
  9.  a:RegisterEvent("CHAT_MSG_TEXT_EMOTE")
  10.  a:RegisterEvent("CHAT_MSG_EMOTE")
  11.  a:SetScript("OnEvent", scrollingEmotes)

It's event handler code I successfully use in other parts of my UI addon, but for some reason, it's simply not working here, and I don't know why. I get no errors, but when I see an emote, I get neither the debug message nor the emote printed to the UIErrors frame.
__________________
My Addons | "If someone says something is impossible, they lack either imagination, or determination."

Last edited by Joker119 : 11-15-17 at 04:10 AM.
  Reply With Quote
11-15-17, 02:02 PM   #2
Ammako
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 256
I wouldn't be able to tell you what's making it not work for you, 'cause it works just fine on my end. :s
  Reply With Quote
11-15-17, 04:26 PM   #3
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
You're trying to match first, then evaluate a string by itself.

lua Code:
  1. if event == "CHAT_MSG_TEXT_EMOTE" or "CHAT_MSG_EMOTE" then

should be

lua Code:
  1. if event == "CHAT_MSG_TEXT_EMOTE" or event == "CHAT_MSG_EMOTE" then
  Reply With Quote
11-16-17, 12:15 AM   #4
Joker119
A Flamescale Wyrmkin
 
Joker119's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2014
Posts: 113
So I've got the event working, and it send emotes to the error frame like it should, but i'm having issues filtering out ones targeting the player.
According to WoWprogramming CHAT_MSG_TEXT_EMOTE contains message, sender, language, channelstring, target ... but target returns a nil value no matter what emote is used.

lua Code:
  1. local function scrollingEmotes(self, event, message, sender, language, channelstring, target, ...)
  2.     if event == "CHAT_MSG_EMOTE" or event == "CHAT_MSG_TEXT_EMOTE" then
  3.                         --debugging, print the message sender and target to chatframe
  4.             print(message, sender, target)
  5.             message = "|cffff4500"..(message).."|r"
  6.             UIErrorsFrame:AddMessage(message)
  7.             print("reeee")
  8.     end
  9. end

the print() should be giving me the emote message, the character sending it and the target, but that 'target' is always empty.
__________________
My Addons | "If someone says something is impossible, they lack either imagination, or determination."
  Reply With Quote
11-16-17, 02:36 PM   #5
Ammako
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 256
Wowprogramming is outdated and not really being maintained anymore, from what I've been told. Wowpedia is the one you should be relying on.
That being said, Wowpedia doesn't show target as being one of the args, but it's possible that their info is incomplete.

"target" seems to exist just fine for CHAT_MSG_EMOTE, but that doesn't really help with anything. I tried reading and printing all the args for CHAT_MSG_TEXT_EMOTE but none of them contain my target's name, so I guess it's just not there.

If anything it might be worth reporting as a bug.

Last edited by Ammako : 11-16-17 at 02:54 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Sending emotes targeting player to screen

Thread Tools
Display Modes

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