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.