List members of a channel (not 100% but works)

devestator

Lifetime Member
Joined
Oct 25, 2006
Messages
1,550
Reaction score
15
Points
38
So I was just curious as to if it could be done so I wrote this little macro to parse out the members of a channel and add them to an array. Maybe someone can find it usefull for something in one of their macros. There may be better ways of doing this and this doesn't work 100% of the time, but it's what I came up wit in about 30 minutes.

Note: The problem with this macro is it can miss one person. The way the channel list works it starts a new line every 10 or so names, if the very last line only has one person on it, it will not pick it up.

Also there has to be at least two people in the channel for it to work.

One last thing, I've never seen it happen as quick as the channel list spits out but if a message does come in between two lines of a channel list and has a "," in it then it will mess up the results.

Anyway here it is, if anyone can fix the problems with it and repost be my guest, I just couldn't figure any work arounds for those problems currently.

Code:
|============================
|channelParse.mac
|Written By - Devestator
|11/19/2008
|============================

#Event channelName "Channel #1#(#2#) #*#"
#Event channelList "#*#,#*#"

Sub Main
	/declare chanListInitiated	bool outer false
	/declare cName			string outer
	/declare cCount			int outer
	/declare chanList[500]		string outer
	/declare lastStart		int outer
	/declare lineFinished		bool outer
	/declare aStart			int outer

	/list 1
	:mainLoop
	/doevents
	/goto :mainLoop
/return

Sub Event_channelName(string rLine, string chanName, int memCount)
	/varset chanListInitiated true
	/varset cName ${chanName}
	/varset cCount ${memCount}
/return

Sub Event_channelList(string rLine)
	/declare cLoop			int local
	/declare numComplete		int local
	/declare aStop			int local

	/if (${chanListInitiated}) {
		/varset lastStart 0
		/varset aStop ${Math.Calc[${aStart}+30]}
		/varset lineFinished false
		/varset numComplete 0

		/if (${aStart}<1) {
			/echo Channel ${cName} - ${cCount} players
			/varset aStart 1
		}
		/for cLoop ${aStart} to ${aStop}
			/call ParseName "${rLine}" ${cLoop} ${lastStart}
			/varset numComplete ${Math.Calc[${numComplete}+1]}
		/if (!${lineFinished}) /next cLoop

		/varset aStart ${Math.Calc[${aStart}+${numComplete}]}
		/if (${aStart}>=${Math.Calc[${cCount}-1]}) {
			/varset chanListInitiated false
			/call listArray
                                      /endmacro
		}
	}
/return

Sub ParseName(string listString, int arrayNum, int startValue)
	/declare wString	string local
	/declare memName	string local

	/varset wString ${listString.Right[${Math.Calc[${listString.Length}-${startValue}]}]}
	/if (${wString.Find[,]}) {
		/varset memName ${wString.Left[${Math.Calc[${wString.Find[,]}-1]}]}
		/if (${startValue}>0) {
			/varset lastStart ${Math.Calc[${wString.Find[,]}+1+${startValue}]}
		} else {
			/varset lastStart ${Math.Calc[${wString.Find[,]}+3]}
		}
	} else {
		/varset memName ${wString}
		/varset lineFinished true
	}
	/if (!${memName.Equal[NULL]}) {
		/varset chanList[${arrayNum}] ${memName}
	}
/return

Sub listArray	
	/declare aLoop		int local

	/for aLoop 1 to ${cCount}
		/echo ${chanList[${aLoop}]}
	/next aLoop
/return
 
nononononono =(

last thing we need is someoen to compile names for direct tell sales spam.
Being anon isn't enough, so now have to join a channel long enough to just say or ask what we want, then drop fast hoping some parser doesn't pick us up?
 
Lol honestly I didn't think about someone doing that, but you know it's not going to make a big difference. They can easily get as many names as they want in guild lobby or bazaar, or anywhere like that with just zone information.

The thing that got me thinking about it, and the reason I wrote it to see if it could be done, was the raid invite post about inviting everyone in a channel =P

Maybe I should take this code and sale it to the spammers! haha j/k.
 
Couldn't you just do something simple like

/log on
/list #
/log off

Then use the text reader from the other thread.
 
I havn't looked at the text reader so not sure exactly how it works. But it would depend on if it does text streaming or can only read closed log files. Some people run with their logs always on, so the files may get very very large, and if you can't just stream newly added text from the log it would not be a very efficient way to parse out any data.

And even then you would still have to parse out the names in the same way I have above, you are just exchanging one string for another.