mIRC Home    About    Download    Register    News    Help

Print Thread
$chan(#).inwho == $false after join #261311 31/08/17 09:30 PM
Joined: Aug 2003
Posts: 294
P
Protopia Offline OP
Fjord artisan
OP Offline
Fjord artisan
P
Joined: Aug 2003
Posts: 294
I have a script which wants to process the nick list after I join a channel.

Obviously it needs to wait until the channel nick list has been populated, so it sets a timer.

When the timer executes, it checks $chan(#).inwho to see whether the nick list has finished populating, intending to queue another timer if it hasn't.

Unfortunately, inwho appears to be false when populating the nick list after a join.

Re: $chan(#).inwho == $false after join [Re: Protopia] #261312 01/09/17 01:06 AM
Joined: Jan 2004
Posts: 1,552
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,552
i do not find this to be true. If i set a timer to execute 1 second after joining, i do get $false because it's already finished if the network is fast and the channel is small. But if you put these 3 lines in a script:

Code:
raw 352:*: echo 5 -s raw $numeric $1 / $chan($2).inwho
raw 315:*: echo 5 -s raw $numeric $1 / $chan($2).inwho
on *:JOIN:#:{ who # | timer 1 0 echo 12 -s inwho is $chan(#).inwho }


I am finding that the timer executing zero seconds after join says inwho is $true, and raw 352 says $true and raw 315 says $false

I suggest you trap raw 315 as the earliest indicator that /who is finished, instead of using a timer and hoping it's done

Re: $chan(#).inwho == $false after join [Re: maroon] #261314 01/09/17 07:43 AM
Joined: Aug 2003
Posts: 294
P
Protopia Offline OP
Fjord artisan
OP Offline
Fjord artisan
P
Joined: Aug 2003
Posts: 294
I assure you that this is true if the channel has a lot of members and it takes several seconds for them to be listed.

Also, on Freenode I get neither a 352 nor a 315 sent. I get 1 or more 353 followed by a 366 :End of /NAMES list.

But I could certainly set a variable in the ON JOIN event and clear it on the RAW 366 event as a way of knowing either I was InJoin.

But that does not stop this being a potential bug.

Re: $chan(#).inwho == $false after join [Re: Protopia] #261315 01/09/17 07:58 AM
Joined: Jan 2004
Posts: 1,552
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,552
I just now joined freenet to try this script, and it works the way I expected. As I join the channel, the script does a /who of the channel, and triggers the 352/315.

If you're not getting a 352 or 315 but are getting the 353/366, then either you have another script that intercepts 352/315 and suppresses them, or else you have a different ON JOIN event that's running instead of my snippet, and it has a "/names #channel" instead of "/who #channel". I executed "/names #channel" and I did get the expected 353/366 instead of the 352/315. I'm guessing you're not getting .inwho to be $true because you're doing /names instead of /who.

Re: $chan(#).inwho == $false after join [Re: Protopia] #261316 01/09/17 08:01 AM
Joined: Aug 2003
Posts: 294
P
Protopia Offline OP
Fjord artisan
OP Offline
Fjord artisan
P
Joined: Aug 2003
Posts: 294
According to lists of IRC numerics:

352 followed by 315 is for a WHO
353 followed by 366 is for a NAMES

So I guess inwho should be false because strictly speaking it is not a WHO but a NAMES.

But it would certainly be useful to have inwho or innames for during a join.

Re: $chan(#).inwho == $false after join [Re: Protopia] #261317 01/09/17 08:12 AM
Joined: Jan 2004
Posts: 1,552
maroon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,552
Are you sure my 3 lines are even executing? I joined adams.freenode.net and joined a channel, which caused those 3 script lines to execute, and it fired up the /who #channel_name and then triggered the raw events 352 and 315 not the 353/366 from /names.

Re: $chan(#).inwho == $false after join [Re: maroon] #261318 01/09/17 08:35 AM
Joined: Aug 2003
Posts: 294
P
Protopia Offline OP
Fjord artisan
OP Offline
Fjord artisan
P
Joined: Aug 2003
Posts: 294
Originally Posted By: maroon
I'm guessing you're not getting .inwho to be $true because you're doing /names instead of /who.


Actually I am doing neither in my script. I think that /NAMES is executed automatically by the irc server on join as I cannot see mIRC issuing a /NAMES explicitly.

Re: $chan(#).inwho == $false after join [Re: Protopia] #261319 01/09/17 08:38 AM
Joined: Jul 2006
Posts: 3,748
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,748
That's correct. As suggested the best way to do what you are looking for is to set a variable and handle the end of /names raw event, that's the best way to know that the nicklist has finished populating, it's also a lot better than using a timer


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: $chan(#).inwho == $false after join [Re: Wims] #261320 01/09/17 08:54 AM
Joined: Aug 2003
Posts: 294
P
Protopia Offline OP
Fjord artisan
OP Offline
Fjord artisan
P
Joined: Aug 2003
Posts: 294
Yes indeed. Using 366 to trigger the relevant script is much better than using a timer. smile

Re: $chan(#).inwho == $false after join [Re: maroon] #261379 19/09/17 08:50 PM
Joined: Sep 2005
Posts: 2,881
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Originally Posted By: maroon
i do not find this to be true. If i set a timer to execute 1 second after joining, i do get $false because it's already finished if the network is fast and the channel is small. But if you put these 3 lines in a script:

Code:
raw 352:*: echo 5 -s raw $numeric $1 / $chan($2).inwho
raw 315:*: echo 5 -s raw $numeric $1 / $chan($2).inwho
on *:JOIN:#:{ who # | timer 1 0 echo 12 -s inwho is $chan(#).inwho }


I am finding that the timer executing zero seconds after join says inwho is $true, and raw 352 says $true and raw 315 says $false

I suggest you trap raw 315 as the earliest indicator that /who is finished, instead of using a timer and hoping it's done


Your on join is actually showing the $chan().inwho state on join as its evaluating at the time you set the timer.

You’d need to use $!chan( # ).inwho to get it to evaluate when the timer fires.

Re: $chan(#).inwho == $false after join [Re: hixxy] #261380 20/09/17 09:52 AM
Joined: Feb 2003
Posts: 2,743
Raccoon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,743
In case it hasn't been mentioned yet:

$chan(#).inwho is only intended to return $true during the commission of a /WHO #CHAN (new: /IALFILL) command. The behavior is to set .inwho = $true whenever numerics 352 (WHO) or 354 (WHOX) are received for a channel, and it is set back to $false when numeric 315 (End of /WHO) is received.

This property does NOT respond to either numerics 353 (NAMES) or 366 (End of /NAMES). Only /WHO.


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
Re: $chan(#).inwho == $false after join [Re: Raccoon] #261381 20/09/17 09:58 AM
Joined: Feb 2003
Posts: 2,743
Raccoon Offline
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,743
Do NOT waste your time with /timers. Use event-based coding methods instead.

This is what you actually want.
Code:
; End of /NAMES ($2 == channel)
RAW 366:*: {
  if ($2 == #MyChannel) && ($me isop $2) {
    do stuff.
  }
} ; by Raccoon 2017


Well. At least I won lunch.
Good philosophy, see good in bad, I like!