Thread Tools Display Modes
07-10-10, 02:18 PM   #1
wellbeing
A Cliff Giant
Join Date: Oct 2009
Posts: 71
Chat_message_channel

I want to get the message string from a specific chat channel where

id = channel name


ive toyed around with a number of ways to do it.. but i cant even get a function to run on the chat frame event. so.. i havent even put into play the specification of the desired channel from which to grab the string.

here is what i thought would work..

function SkillzSend_OnLoad(self)
self:RegisterEvent("CHAT_MESSAGE_CHANNEL");
end

if (event=="CHAT_MESSAGE_CHANNEL") then
local msg = arg1
print(msg)
end

am i using the wrong method?
  Reply With Quote
07-10-10, 02:56 PM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Where is the rest of your code? Little snippets out of context make it difficult to debug.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
07-10-10, 02:58 PM   #3
wellbeing
A Cliff Giant
Join Date: Oct 2009
Posts: 71
Originally Posted by Seerah View Post
Where is the rest of your code? Little snippets out of context make it difficult to debug.
my xml is in line.

there is no other code.. lol.

what am i missing?
  Reply With Quote
07-10-10, 03:01 PM   #4
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
What do you mean by your XML being "in line"?
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
07-10-10, 03:04 PM   #5
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,919
Well for a start you are using the wrong event.

http://wowprogramming.com/docs/events/CHAT_MSG_CHANNEL
http://www.wowwiki.com/Events/Communication
Code:
"CHAT_MSG_CHANNEL" Category: Communication  
   Fired when the client receives a channel message. 

arg1 - chat message 
arg2 - author 
arg3 - language 
arg4 - channel name with number ex: "1. General - Stormwind City" 
zone is always current zone even if not the same as the channel name 
arg5 - target 
second player name when two users are passed for a CHANNEL_NOTICE_USER (E.G. x kicked y) 
arg6 - AFK/DND/GM "CHAT_FLAG_"..arg6 flags 
arg7 - zone ID used for generic system channels (1 for General, 2 for Trade, 22 for LocalDefense, 23 for WorldDefense and 26 for LFG) 
not used for custom channels or if you joined an Out-Of-Zone channel ex: "General - Stormwind City" 
arg8 - channel number 
arg9 - channel name without number (this is _sometimes_ in lowercase) 
zone is always current zone even if not the same as the channel name 
arg11  - The lineID used to identify the line used when reporting the chat message.
And assuming the addon runs as normal then using that event and printing the args should result in what you want.
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818
  Reply With Quote
07-10-10, 03:19 PM   #6
wellbeing
A Cliff Giant
Join Date: Oct 2009
Posts: 71
Originally Posted by Seerah View Post
What do you mean by your XML being "in line"?
lol, sorry.

my lua:

function SkillzSend_OnLoad(self)
self:RegisterEvent("CHAT_MSG_CHANNEL");
end

function SkillzSend_OnEvent(self, event, ...)
local msgg = arg1

if (event=="CHAT_MSG_CHANNEL") then
print("asdfasdfasdf")



print(msgg)
end
end


my xml:


<Ui xmlns="http://www.blizzard.com/wow/ui" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Frame name="SkillzSend">
<Scripts>
<OnLoad>
SkillzSend_OnLoad(self);
</OnLoad>
<OnEvent>
SkillzSend_OnEvent(self, event, ...);
</OnEvent>
</Scripts>
</Frame>
</Ui>


my toc:

## Interface: 30300
## Title: SkillzSend
## Author: TheGrouch
## Version: 1.01.00
## Notes: send alpha
## DefaultState: Enabled
## LoadOnDemand: 0
## SavedVariables:


SkillzSend2.lua
SkillzSend2.xml


I'm not getting the prints.

Last edited by wellbeing : 07-10-10 at 04:35 PM.
  Reply With Quote
07-10-10, 05:53 PM   #7
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,919
I am assuming you have the files named the same as in the TOC ?

Either way I'm just gonna give it a test .. I suspect the problem is due to what actual channels they catch messages for.


Edit:
Okay, after a quick test I can say the code works but only for custom channels. As per screenshot as follows:

Edit2:
Okay, after forgetting to turn off the addon I got some more messages once I joined the nearest towns General and Trade Channels. The 2nd screenshot reflects that effect. The text that appears include all the values that the event holds.
Attached Thumbnails
Click image for larger version

Name:	WoWScrnShot_071110_010021.jpg
Views:	750
Size:	200.5 KB
ID:	4601  Click image for larger version

Name:	WoWScrnShot_071110_012514.jpg
Views:	801
Size:	218.7 KB
ID:	4602  
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818

Last edited by Xrystal : 07-10-10 at 06:26 PM.
  Reply With Quote
07-10-10, 07:44 PM   #8
wellbeing
A Cliff Giant
Join Date: Oct 2009
Posts: 71
Originally Posted by Xrystal View Post
I am assuming you have the files named the same as in the TOC ?

Either way I'm just gonna give it a test .. I suspect the problem is due to what actual channels they catch messages for.


Edit:
Okay, after a quick test I can say the code works but only for custom channels. As per screenshot as follows:

Edit2:
Okay, after forgetting to turn off the addon I got some more messages once I joined the nearest towns General and Trade Channels. The 2nd screenshot reflects that effect. The text that appears include all the values that the event holds.


i cannot understand why it wont work for me.

edit: GOT IT!

i went in and renamed everything to one name..the frame the folder the lua the toc the xml. it worked.

Last edited by wellbeing : 07-10-10 at 08:14 PM.
  Reply With Quote
07-11-10, 05:11 AM   #9
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
Originally Posted by wellbeing View Post
i went in and renamed everything to one name..the frame the folder the lua the toc the xml. it worked.
The folder & toc file needs to have the same name, i.e. /MyReallyCoolAddOn/MyReallyCoolAddOn.toc, but rest can be named whatever you want as long as you type in the correct filenames into the toc file.
__________________
I stopped playing back World of Warcraft in 2010 and I have no plans on returning.
This is a dead account and if you want to continue any of my addons or make a fork then feel free to do so.
This is your permission slip.

If you need to contact me, do so on Twitter @v6ooo

Best regards, v6.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Chat_message_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