mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Aug 2003
Posts: 318
P
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
P
Joined: Aug 2003
Posts: 318
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.

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
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

Joined: Aug 2003
Posts: 318
P
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
P
Joined: Aug 2003
Posts: 318
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.

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
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.

Joined: Aug 2003
Posts: 318
P
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
P
Joined: Aug 2003
Posts: 318
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.

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
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.

Joined: Aug 2003
Posts: 318
P
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
P
Joined: Aug 2003
Posts: 318
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.

Joined: Jul 2006
Posts: 4,141
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,141
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


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Aug 2003
Posts: 318
P
Pan-dimensional mouse
OP Offline
Pan-dimensional mouse
P
Joined: Aug 2003
Posts: 318
Yes indeed. Using 366 to trigger the relevant script is much better than using a timer. smile

Joined: Sep 2005
Posts: 2,881
H
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.

Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
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!
Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
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!

Link Copied to Clipboard