Idle Kicker

By RusselB on Mar 28, 2008

This is an idle kicker that works across mulitple networks and in multiple channels. Settings are on a channel by channel basis, and are set/reset via channel menu. Settings are stored in a hash table. Exemptions can be set based on access level (op, half-op, voice and/or regular) as well as by specific nick. NOTE: If the number of characters in the list of exempted nicks exceeds approximately 500, then an error will occur. I have not used binary variables to get around the length limitation, but if the average nick is 20 characters in length, then you still have room for about 25 nicks. As of mIRC version 6.32, the aforementioned limit still exists, but has been greatly expanded to about 4000 characters, or 200 nicks at an average of 20 characters per nick. Code edited per information from [85] in this topic Also checked against recent updates in mIRC to confirm that it works with version 7.14

ctcp *:version:*:  ctcpreply $nick VERSION Idle Kicker 10.19.2010 by Russel Bairstow
on *:start:{
  if !$hget(idle_kick) { .hmake idle_kick 10 }
  if $exists($qt($scriptdiridlekick.hsh)) {    .hload idle_kick $qt($scriptdiridlekick.hsh)  }
  load_idle
}
on *:exit:{
  .timers off
  .hsave -o idle_kick $qt($scriptdiridlekick.hsh)
}
on *:disconnect:{
  $+(.timer,$network,*) off
  .hsave -o idle_kick $qt($scriptdiridlekick.hsh)
}
menu channel {
  Idle Kick
  .$iif(!$idle($network,$chan),Set,Reset) Allowed idle time : idle $network $chan $iif($duration($$?="Time in hh:mm:ss format. Note that hh and mm are not required and will default to 0 if not supplied") isnum,$v1,$duration($v1))
  .$iif($idle($network,$chan),Clear Idle Time $duration($idle($network,$chan),3)) : .hdel idle_kick $+($network,.,$chan,.,Idle)
  .$iif(!$exempt($network,$chan),Set,Reset) Exempt Modes: {
    var %exempt = $$?="Enter characters for exemption status (o = op, h = half-op, v = voice, r = regular)"
    var %exempt1 = $remove(%exempt,o,h,v,r)
    exempt $network $chan $remove(%exempt,%exempt1)
  }
  .$iif($exempt($network,$chan),Clear Exempt Modes $exempt($network,$chan)) : .hdel idle_kick $+($network,.,$chan,.,Exempt)
  .Exempt Nick(s) : {
    var %exempt.nicks = $replace($$?="Nick(s) to exempt",$chr(44),$chr(32))
    var %a = 1, %b = $numtok(%exempt.nicks,32)
    while %a <= %b {
      .hadd -m idle_kick $+($network,.,$chan,.,Exempt.Nick) $addtok($hget(idle_kick,$+($network,.,$chan,.,Exempt.Nick)),$gettok(%exempt.nicks,%a,32),32)
      inc %a
    }
  }
  .Manual Check : check_idle $chan
}
on *:op:#:{
  if $opnick == $me {
    var %exempt = $hget(idle_kick,$+($network,.,$chan,.,Exempt)), %a = 1, %b = $nick($chan,0,a,%exempt)
    while %a <= %b {
      if !$istok($hget(idle_kick,$+($network,.,$chan,.,Exempt.Nick)),$nick($chan,%a,a,%exempt),32) {
        $+(.timer,$network,.,$chan,.,$nick($chan,%a,a,%exempt)) -m 0 500 check_idle $chan $nick($chan,%a,a,%exempt)
      }
      inc %a
    }
  }
  if o isin $exempt($network,$chan) && $timer($+($network,.,$chan,.,$opnick)) {    $+(.timer,$network,.,$chan,.,$opnick) off  }
}
on *:help:#:{
  if h isin $exempt($network,$chan) && $timer($+($network,.,$chan,.,$hnick)) {    $+(.timer,$network,.,$chan,.,$hnick) off  }
}
on *:voice:#:{
  if v isin $exempt($network,$chan) && $timer($+($network,.,$chan,.,$vnick)) {    $+(.timer,$network,.,$chan,.,$vnick) off  }
}
alias -l exempt {
  if $isid {    return $hget(idle_kick,$+($network,.,$chan,.Exempt))  }
  else {    .hadd -m idle_kick $+($1,.,$2,.Exempt)  $3 }
}
alias -l idle {
  if $isid {    return $hget(idle_kick,$+($1,.,$2,.Idle))  }
  else {    .hadd -m idle_kick $+($1,.,$2,.Idle) $3 }
}
alias -l check_idle {
  if !$2 {
    var %exempt = $exempt($network,$1), %a = 1, %b = $nick($1,0,a,%exempt)
    while %a <= %b {
      .timer 1 %a $iif($nick($1,%a,a,%exempt).idle > $idle($network,$chan),.kick $1 $nick($1,%a,a,%exempt) No idling allowed)
      inc %a
    }
  }
  else {    if ($nick($1,$2).idle > $idle($network,$chan)) {        .kick $1 $2 No idling allowed      }  }
}
alias -l load_idle {
  var %a = 1, %b = $scon(0)
  while %a <= %b {
    .scon %a
    var %c = 1, %d = $chan(0)
    while %c <= %d {
      var %exempt = $exempt($network,$chan(%c)), %e = 1, %f = $nick($chan(%c),0,a,%exempt)
      while %e <= %f {
        $+(.timer,$network,.,$chan(%c),.,$nick($chan,%e,a,%exempt)) -m 0 500 check_idle $chan $nick($chan(%c),%e,a,%exempt)
        inc %e
      }
      inc %c
    }
    inc %a
  }
}
on *:quit:{
  $+(.timer,$network,*,$iif($nick != $me,$nick)) off
}
on *:part:#:{
  if $nick == $me {    $+(.timer,$network,.,$chan,*) off  }
  elseif $timer($+($network,.,$chan,.,$nick)) {    $+(.timer,$network,.,$chan,.,$nick) off  }
}
on *:kick:#:{
  if $knick == $me {    $+(.timer,$network,.,$chan,*) off  }
  elseif $timer($+($network,.,$chan,.,$knick)) {    $+(.timer,$network,.,$chan,.,$knick) off  }
}
on @*:join:#:{
  if !$istok($hget(idle_kick,$+($network,.,$chan,.,Exempt.Nick)),$nick,32) {
    $+(.timer,$network,.,$chan,.,$nick) -m 0 500 check_idle $chan $nick
  }
}

Comments

Sign in to comment.
RusselB   -  Oct 20, 2010

For all those that are looking watching these comments and having trouble with the code, I'm not exactly sure what changed, but something changed in the mIRC executable that made the script stop working properly. I am in the process of re-writing the script and will test it both by myself and with others over several different versions of mIRC. Hopefully I'll be able to come up with a single code that will work in all versions after 6.16

I'm limiting the testing to versions after 6.16 simply due to the age of that version.

More
 Respond  
msg4real   -  Jun 19, 2009

does the script need to be named a certein way ./ whats the hsh file need to be named

More
 Respond  
msg4real   -  Jun 19, 2009

I have put it into remotes and I get * /timer: timer 2 not active

  • /timer: timer 2 not active
  • /timer: timer 2 not active
  • /timer: timer 2 not active
  • /timer: timer 4 not active
  • /timer: timer 5 not active

when tring to check naully and the auto check doesn't work

and its not saving the setting

what am I doing wrong

I notice on reboot I am getting

/hsave: insufficient parameters (line 13, scriptdiridlekick.ini)

More
 Respond  
DeeperStill   -  May 20, 2009

I will try this script but what I am really looking for is a "Guest nick Idle kicker". I do not mind idlers at all, however I do mind idlers that do not change from a guest nick. I have jpirc applet users coming into channel who will park without changing nicks. Pretty soon I have a list full of guest nicks. It drives me nuts!!

So make this same script but designate it to kick guests only who idle over a designated time while still protecting ops, vops, halfops, and all other nicks who are not "guest##"

then Id love ya to death RusselB... oh, I love ya anyway

DeeperStill

Later**** I tested this out in my irc channel. I set it to kick idlers at 30 minutes. It didn't work. Should I have placed it some other place besides "remotes"?

More
 Respond  
PATX   -  Apr 26, 2009

RusselB: i find your response very professional and i thank you for understanding. u are a very good script btw. and keep up the good work. i understand why u posted it now which i am sorry i did not when i first saw it. sorry for all this and keep up the good work :)

More
 Respond  
RusselB   -  Apr 26, 2009

As stated, this was originally written when I got requests from channel owners to keep people from idling in their channels. Due to the number of requests I got, I figured I might as well post the code here and be able to refer them to this location. I understand where you're coming from, PATX & hy71194, in regards to many people idling in channels, but if the channel owner doesn't want idlers, then they shouldn't have to put up with them.

BTW: I don't guarantee that all of my scripts will work 100%, but I do guarantee that I will do my best to fix any bugs found.

More
 Respond  
PATX   -  Apr 26, 2009

thank you hy71194!!!!!!! thats what i have been trying to say!

More
 Respond  
hy71194   -  Apr 26, 2009

Can I ask .. what is the point of this?!? Most people LOVE idlers in their room.

Edit: Nevermind, I read the comments again.. but it still does not make scene to me why someone would do that.

More
 Respond  
PATX   -  Apr 26, 2009

i meant that the point is flawed. besides it is just just an opinion. take it easy...

More
 Respond  
Cheiron   -  Apr 26, 2009

RusselB is amongst the most respected coders i have come to know Patx. every script he does is guarenteed 100% to be a worker and coded in probably the most professional way possible. these scripts are aimed at those people that require these scripts. to say that it is flawed would require significant evidence that the code is flawed , that it doesnt work and that it doesnt do what it is was coded to do.

More
 Respond  
PATX   -  Apr 26, 2009

well more than half of the ppl on a irc network idle. so hance i am saying it is a flawed script.

More
 Respond  
RusselB   -  Apr 23, 2009

That is why I included methods to exempt certain nicks using one or more of a few methods.

Some channel owners don't like people just idling in their channel.

More
 Respond  
PATX   -  Apr 23, 2009

why would you wanna kick idlers???? that is like all/most irc bots + ALL ppl who have a life!!!! bad idea good msl coing tho :)

More
 Respond  
Balta   -  Apr 14, 2009

Can't seem to get automatic to work but manual works nonetheless ty.

More
 Respond  
RusselB   -  Apr 11, 2009

Error located and corrected. Thanks for helping me find the proper area of the code by stating that it was in reference to the Exempt nicks.

More
 Respond  
Balta   -  Apr 11, 2009

sry im still getting this error

  • Too few parameters: $addtok using mIRC6.35

oh this was for Exempt nick(s) :)

More
 Respond  
RusselB   -  Feb 15, 2009

Any of the formats that you stated should work for the exemptions.

I will review the code with some friends and see if we can figure out why it's not working on the automatic.

More
 Respond  
DaDealer   -  Feb 15, 2009

it in it correct, I have it for 1 hour 01:00:00. and it doesnt seem to do anything automaticaly I have had it running all night and have some ghost that have like a 15 hour idle. but when I did the manual and it worked I loved it lol.

oh, and whats the format for the exemptions? ohv o,h,v or o h v

More
 Respond  
RusselB   -  Feb 15, 2009

Please ensure that you entered the idle limit in the correct format. For two minutes you (should) have the following options: 1) 00:02:00 2) 00:2:00 3) 0:02:00 4) 0:2:00 5) 02:00 6) 2:00 7) 2:0 8) 120

More
 Respond  
DaDealer   -  Feb 15, 2009

ok with some testing, I moved the alias Check_idle to the top of the code and took out the -l ...but now it just seems to have a problem if i set the idle limit above 2 mins. I get this:

* /timer: timer 1 not active
* /timer: timer 1 not active
* /timer: timer 1 not active
* /timer: timer 1 not active
* /timer: timer 1 not active
* /timer: timer 1 not active
* /timer: timer 1 not active
* /timer: timer 1 not active
More
 Respond  
DaDealer   -  Feb 15, 2009

it worked good the first time I ran it but now it does this: When I run the manual check it does this:

CHECK_IDLE Unknown command

and a list of
* /timer: timer 1 not active

I even tried deleting the hash file and the code and re pasting it in there thinking I might have done something.

any ideas?

More
 Respond  
irchainscriptz   -  Nov 22, 2008

Nice code but Iam in script rooms so we all idle a lot :P other then that nice job!

More
 Respond  
RusselB   -  Nov 21, 2008

The $addtok line in the original posting, for some reason, was missing a ) at the end.

This has been corrected. Some of you may not have gotten noticed a problem with that, dependent on what version of mIRC you were using the code on.

More
 Respond  
SnoooP   -  May 15, 2008

i had a little go of this before and it worked of for me

More
 Respond  
BusyElf   -  May 15, 2008

I\'m getting the same problem Noob, Tried a few attempts to cure it but..... ^shrugs^

More
 Respond  
N00bd00b   -  Apr 27, 2008

Please forgive me for being a n00b but I can\'t get this to work. It doesn\'t seem to be kicking and when I try to add an exempt nick, I get the message:

  • Invalid format: $addtok

Do I need to go through and edit something?

More
 Respond  
CicatrixZ   -  Mar 29, 2008

Good Job Dude.. This is really What i Like... Im using it now.. TY.. SO Useful.. TY Again.. <3

More
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.