Thread Tools Display Modes
02-22-06, 07:53 AM   #1
Torteth
A Defias Bandit
Join Date: Jun 2005
Posts: 2
Unhappy Enumerating Users in a Custom Chat Channel

I'm trying to write a simple addon for my Guild which lists all online guild members and all members of a chat channel.
This is to be used to record DKP. (We award DKP to all online players.)

I have the guild enumeration all sweet but I'm having trouble enumerating the members of a chat channel.
This can be achieved in game by typing /chatlist # or /chatwho # where "#" = the channel number or channel name.

I posted on the official WoW forums (UI section) but I cant seem to work out how to use the information I was given correctly:

hello, sorry I was not very clear. Here is what you need to do:
(1) Register the event CHAT_MSG_CHANNEL_LIST
(2) Issue ListChannelByName

Your On_event code look something like:
if(event == "CHAT_MSG_CHANNEL_LIST") then
WHO_CHANNEL_USERS(arg1);
end
...
...
..
function WHO_CHANNEL_USERS(msg)
print (msg)
end

Basically I want to find all members of the channel "Standby5D" and add them to an edit box (or an array). (For simplicties sake a simple DEFAULT_CHAT_FRAME:AddMessage(this_is_a_stub) in place of this in any examples would be sufficiant. Once I RETRIEVE the string of names I'm set. )
I was wondering if someone could point me in the right direction. I've been looking at other UI addons I use; the Register Event section in particular but I dont understand the link between registering the event and then calling ListChannelByName.

Any help would be greatly appreciated.
  Reply With Quote
02-22-06, 08:02 AM   #2
Torteth
A Defias Bandit
Join Date: Jun 2005
Posts: 2
Oh, after even more diggong on WoWWiki.com I found:

Example:
Place this:RegisterEvent("CHAT_MSG_SAY"); in the <OnLoad>/</OnLoad> section of your MyMod.xml file.
Then, have an if (event == "CHAT_MSG_SAY") then MyMod_Say(event, arg1, arg2, arg3); end line, or something like it, in the <OnEvent>/</OnEvent> section of your MyMod.xml file.



Then, have a function like the following in your MyMod.lua file:
function MyMod_Say(event, arg1, arg2, arg3)
PrevMsg = arg1;
PrevPlyr = arg2;
PrevLang = arg3;
end

This would store the previous message, player who said it, and language it was said in into some variables.
This explains the concept quite well.
Wish there was a way to delete this thread...

I assume the above is what I wish to do, once I replace the event with the event I desire of course?

Edit: The thing I wasnt seeing when examining other mods was the OnLoad in the XML file. Guess thats the secret.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Enumerating Users in a Custom Chat Channel


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