|
Joined: Jul 2007
Posts: 1,124
Hoopy frood
|
OP
Hoopy frood
Joined: Jul 2007
Posts: 1,124 |
Hi can anyone show me a way to whois the whole channel when I join it? In other words, I would like to be able to whois people upon my arrival to a room. I have tried the code below but nothing happened: on *:JOIN:#: {
if ($nick == $me) {
whois $nick
}
} I'm not sure if there's an effective way of doing this to trigger the whois successfully.
|
|
|
|
Joined: Dec 2002
Posts: 3,534
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,534 |
What info do you actually need from their whois? Can't you use /who $chan instead?
|
|
|
|
Joined: Aug 2004
Posts: 7,168
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,168 |
According to your posted code, it would perform a whois on the joining nick when you join, so it would only work when you joined and it would whois yourself. In order to do what you're asking for (and this does have some serious limitations to it) your code should look like on me:*:join:#:{
var %a = 1, %b = $nick($chan,0)
while %a <= %b {
.enable #channel_whois
.whois $nick($chan,%a)
inc %a
}
}
#channel_whois off
raw *:*:{
if $istok(402 311 401 379 378 307 319 312 301 313 310 671 317 320,$event,32) { haltdef }
echo -a $2-
if $numeric == 318 {
.disable #whois
haltdef
}
}
#channel_whois end
As SladeKraven already stated, doing a /who on the channel is probably more efficient, but that also depends on what information you're wanting.
|
|
|
|
Joined: Jan 2003
Posts: 2,125
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 2,125 |
When you join a channel (which is when on JOIN triggers), mirc doesn't know who is on that channel yet. You'll have to wait for the "end of NAMES" reply (raw 366).
Regardless, it should be pointed out that whois-ing every user in a channel is not just less efficient but an unnecessarily big strain on the server that may even cause it to disconnect you.
|
|
|
|
Joined: Aug 2004
Posts: 7,168
Hoopy frood
|
Hoopy frood
Joined: Aug 2004
Posts: 7,168 |
I realize that, and only wrote (and tested) the code due to the OP's original request for assistance. I guess I was lucky that the raw 366 came through in my testing before the whois's actually started.. probably a fluke.
|
|
|
|
Joined: Jan 2003
Posts: 2,125
Hoopy frood
|
Hoopy frood
Joined: Jan 2003
Posts: 2,125 |
I guess I was lucky that the raw 366 came through in my testing before the whois's actually started.. probably a fluke. This is 100% impossible. No fluke or anything else could make that work: mirc cannot process two events at the same time. on JOIN would have to finish before mirc deals with any other information (like raw 366). The whois loop is in on JOIN however, so there is nothing to loop through (except your own nick).
|
|
|
|
Joined: Jul 2007
Posts: 1,124
Hoopy frood
|
OP
Hoopy frood
Joined: Jul 2007
Posts: 1,124 |
Yeah I realize that when I first join a channel mIRC does not know who is in that channel. It does know I am in the channel so $nick(#,0) will equal 1. I guess there's no way of solving this puzzle, because there isn't any to solve.
|
|
|
|
Bob57
|
Bob57
|
This demonstrates looping through the names in a channel after you join it. I used /who but you can /whois if you require that information. raw 366 is the end of the names list for the channel. on *:join:#: {
if ($nick == $me) set -su120 %WhoChan. $+ $chan $true
else who $nick
}
raw 366:*: {
var %chan = $2
if ($eval(% $+ WhoChan. $+ %chan,2)) {
unset $eval(% $+ WhoChan. $+ %chan,1)
var %i = 1, %nick
while ($nick(%chan,%i)) {
%nick = $v1
if (%nick != $me) who %nick
inc %i
}
}
}
|
|
|
|
Joined: Jul 2007
Posts: 1,124
Hoopy frood
|
OP
Hoopy frood
Joined: Jul 2007
Posts: 1,124 |
Bob, you're such a godsend. You've solved the puzzle for me. This script is EXACTLY what I want! Many thanks to all who have responded to assist me. I'm truly grateful.
Last edited by Tomao; 04/04/08 07:00 AM.
|
|
|
|
RRX
|
RRX
|
Hi can anyone show me a way to whois the whole channel when I join it? In other words, I would like to be able to whois people upon my arrival to a room. I have tried the code below but nothing happened: on *:JOIN:#: {
if ($nick == $me) {
whois $nick
}
} I'm not sure if there's an effective way of doing this to trigger the whois successfully. As said the code needs to be started in end of names raw 366 and will be more than a simple loop that does a /whois on every nick, otherwise theres a high risk of a flood disconnect. Most servers support whois nick1,nick2,nickN so that will already decrease this risk substantially. I use a queue for this that sends next chunk after all received from previous, and also a timer that forces a minimal delay to give mirc some room to do something else because if you have alot code running upon receival of the raws, it could cause ping timeouts disconnects too. All together: a reliable solution is not that easy, especially since you specified every channel, potentially inflicting the need to whois thousands. I have something finished for cases like this but it's a couple thousand lines :p
|
|
|
|
|