mIRC Home    About    Download    Register    News    Help

Print Thread
#159303 16/09/06 02:50 AM
Joined: Aug 2003
Posts: 66
B
bynw Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Aug 2003
Posts: 66
I need a script that will cause a bot to auto part a channel when it is the only one left in the channel. But I only want this to happen on specific channels. I dont know if it would be easier to somehow enable a list of channels to stay in and part all others but that would be the ideal way actually since it would be a shorter list.

#159304 16/09/06 03:37 AM
S
schaefer31
schaefer31
S
Use the on part event and check $nick($chan,0) perhaps? You would need a timer though since at the time of the part the nick count is not changed. Something like:

Code:
on *:PART:#chan:{
  .timerpc $+ $ticks -m 1 100 nlcheck $chan
}

alias -l nlcheck {
  if ($nick($1,0) == 1) part $1
}


When a nick parts, a 100ms timer is activated that calls the nlcheck alias and parts the chan if there is only 1 user (itself). Add whatever other channels you want it to do this action on.

#159305 16/09/06 03:45 AM
Joined: Aug 2003
Posts: 66
B
bynw Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Aug 2003
Posts: 66
Thanks ... that's a start at least. I wonder if it can be done the opposite way. A list of channels to stay in rather than a list of channels to part.

#159306 16/09/06 03:54 AM
S
schaefer31
schaefer31
S
You could change the even to just include '#' for all channels, then set an exception list in the nlcheck alias.

e.g.

Code:
on *:PART:#:{
  .timerpc $+ $ticks -m 1 100 nlcheck $chan
}

alias -l nlcheck {
  var %nopart = #Chan1 #Chan2 #Chan3
  if (!$istok(%nopart,$1,32)) && ($nick($1,0) == 1) {
    part $1
  }
}


%nopart are channels that it should not part from, separated by a space.

#159307 16/09/06 04:01 AM
Joined: Sep 2003
Posts: 261
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2003
Posts: 261
You could build a socketbot.


Link Copied to Clipboard