mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Feb 2019
Posts: 2
D
Bowl of petunias
OP Offline
Bowl of petunias
D
Joined: Feb 2019
Posts: 2
Hi!

I want to know is a possibility to obtain the total number of users of a chan directly ON JOIN event (when i join a channel) without using a timer, i.e. before the nicklist is initiated on that channel.

For example:

Code:
ON 1:JOIN:#: {
  if ($nick == $me) echo -a $nick(#,0)
}


In this way, it will echo $nick(#,0) -> 1, because the ON JOIN event process the commands before all the nicks is initiated. Of course, i can use /timer 1 0 echo -a $nick(#,0), but i need to know the total users before calling the NickLust (Custom DLL of Nicklist), because Nicklust can be initiated only ON JOIN event without using a delay or a timer.

Last edited by dukealex; 22/02/19 10:21 AM.
Joined: Dec 2015
Posts: 148
Vogon poet
Offline
Vogon poet
Joined: Dec 2015
Posts: 148
You can only know the total number of users on a channel when you receive RAW 366, you can start checking for number of users when you receive RAW 353, but if it's a large channel, the server can send you multiple RAW 353s.

Code:
raw 353:*:echo -t $3 * $nick($3,0) users counted on $3 so far!

raw 366:*:echo -t $2 * Total of $nick($2,0) users on $2 $+ !


In other words: you can't know the number of users on the channel on join. Only after you receive the names.

Joined: Apr 2018
Posts: 83
E
Babel fish
Offline
Babel fish
E
Joined: Apr 2018
Posts: 83
I agree with Dazuz. At the point of your On Join there is no information to give you. There are zero users in the nicklist.

Instead the nicklist is populated by the server when it sends you the list of users in the raw numeric 353 message(s), and concludes with the raw 366 message (End of list for channel #<channel name>'.

I found this out by checking for the presence of a user (Idlebot in an IdleRPG game) when I joined. It wasn't there, but it was a few miliseconds later, so I switched to process on the raw 366 - no timer needed.

There is a problem if you try to count the users while the raw 353 messages are arriving. There are 2 different ways the nicks are presented.

Normally the are sent as nick!e-mailname@hostaddress. IF usermode +x has been applied then you just get a list of nicks.

Personally I would wait and trap the raw 366 and then do your $user thing.

Code:
raw 366:*: { echo -a User Count : $nick(#,0) }


You can check if the end of list is for your channel by
Code:
raw 366:*: { 
   if $2 == #channelname { echo -a User Count : $nick(#,0) }
}


2 things to note:
1) this is already done for you anyway, just look at the window bar for the channel - the user count is there in brackets just after the channel name.

2) your on join could have been compressed into
Code:
ON ME:1:JOIN:#: {

which means that you no longer have to test if the nick joining == $me

Hope this helps.

Last edited by Erasimus; 28/02/19 05:24 PM.

Link Copied to Clipboard