Thread Tools Display Modes
04/07/14, 09:14 PM   #1
dev909
 
dev909's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 4
Receiving chat channel

Hey all, I've been going through the wiki and can't really understand how to tell what chat channel is incoming. For example if my friend whispered me, how am I able to acknowledge the message that he sent? Also how would I be able to return a message? I'm pretty tired at the moment, and most likely missed it, but if anyone can help that would be awesome!
  Reply With Quote
04/08/14, 03:04 AM   #2
Tajin
 
Tajin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 29
here, these two snippets should answer your question:

Lua Code:
  1. EVENT_MANAGER:RegisterForEvent("younameit", EVENT_CHAT_MESSAGE_CHANNEL, ParseChat)

Lua Code:
  1. local function ParseChat(id, channel, fromName, text)
  Reply With Quote
04/08/14, 06:51 AM   #3
dev909
 
dev909's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 4
Alright thanks! So I'm assuming that id is the unique chat identifier, channel is the incoming channel, fromName is the person who is communicating with you, and then text is the actual text? This would solve for incoming messages but how would you return a message? Would you literally just in ParseChat return a message?
  Reply With Quote
04/08/14, 07:36 AM   #4
Tajin
 
Tajin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 29
"parseChat" is just a function I'm using that takes the callback from the "EVENT_CHAT_MESSAGE_CHANNEL" event.

You can't send chatmessages via script.

There is a command for it...
Lua Code:
  1. SendChatMessage private (string message, integer channelId, string target)
...but its "private", so we can't use it.
  Reply With Quote
04/08/14, 07:55 AM   #5
dev909
 
dev909's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 4
Ah...I suppose they won't give us access to it either would they..
  Reply With Quote
04/08/14, 08:52 AM   #6
Tajin
 
Tajin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 29
I doubt it, theres already enough spamming going on without it.
  Reply With Quote
04/08/14, 09:44 AM   #7
dev909
 
dev909's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 4
Damn spammers :/. Ok well another question, at the moment I'm set up so that when a whisper comes to you it lists the username in the chat log (don't criticize, I'm tweaking stuff) however after the names a "^n" is appended to the string. I tried to use string.gsub to remove them but it doesn't work. Any thoughts?

Code:
    
function incMessage(id, channel, fromName, msg)
    local name = string.gsub(fromName,"^n", "")
    notifyArray[count] = name
  Reply With Quote
04/09/14, 01:29 AM   #8
Tajin
 
Tajin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 29
I've seen different suffixes, not just ^n so I use this:
Lua Code:
  1. local function ParseChat(id, channel, fromName, text)
  2.     i = string.find(fromName,"^",0,true)
  3.     if i ~= nil then
  4.         fromName = string.sub(fromName,0,i-1)
  5.     end
  6. ...
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Receiving chat channel

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