|
Joined: Dec 2003
Posts: 199
Vogon poet
|
OP
Vogon poet
Joined: Dec 2003
Posts: 199 |
alias idle { .timer 0 301 /idle2 } alias idle2 { var %x = 1 while (%x <= $nick(#,0,r)) { if ($nick($chan,$nick(#,%x,r)).idle >= 300) { kick # $nick(#,%x,r) You have Idled in #HelpCenter for 5mins - Please Come back if you need help. } inc %x } } The object of the script is to kick anyone who idles in the channel for 5mins or more - and if they do, it kicks them. :\ It works when I do it manually, and screws up if I dont do it manually... Please help ~Kriminal
|
|
|
|
Joined: May 2004
Posts: 132
Vogon poet
|
Vogon poet
Joined: May 2004
Posts: 132 |
here use this one!
on me:*:JOIN:#channel: .timer 0 120 CheckIdlers
alias CheckIdlers { var %chan = #needhelp if ($me !isop %chan) { echo -a You are not oped on %chan | return } var %a = $nick(%chan,0,r) while (%a) { if ($nick(%chan,%a,r).idle > 600) { kick %chan $nick(%chan,%a,r) 2 You were kicked because of idle! } dec %a } }
Last edited by NoPleX; 31/05/04 01:00 AM.
|
|
|
|
Joined: Feb 2004
Posts: 714
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 714 |
There is no channel specified if you do it by timer.
alias idle { .timer 0 301 /idle2 [color:red]#channelname[/color] }
alias idle2 { var %x = 1
while (%x <= $nick([color:red]$1[/color],0,r)) { if ($nick($chan,$nick([color:red]$1[/color],%x,r)).idle >= 300) { kick [color:red]$1[/color] $nick([color:red]$1[/color],%x,r) You have Idled in #HelpCenter for 5mins - Please Come back if you need help. }
inc %x
}
} You can use a variable or an on Join event to trigger the timer. I reccomend you to name the timer, so you have control of it. Hope it helps! BTW - usage of /idle2 is /idle2 <channel>Zyzzy.
Last edited by Zyzzyx26; 31/05/04 01:07 AM.
|
|
|
|
Joined: Dec 2003
Posts: 199
Vogon poet
|
OP
Vogon poet
Joined: Dec 2003
Posts: 199 |
alias idle { .timeridle 0 301 /idle2 #HelpCenter } alias idle2 { var %x = 1 while (%x <= $nick(#,0,r)) { if ($nick($chan,$nick(#,%x,r)).idle >= 300) { kick # $nick(#,%x,r) You have Idled in #HelpCenter for 5mins - Please Come back if you need help. } inc %x } } So that will work? (yeah I know i'll make an on join event to trigger it, was doing it triggering it manually ot make sure it wokred)
|
|
|
|
Joined: Feb 2004
Posts: 714
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 714 |
No.. check the post above. You have to change all the # for a $1 for it to work. I added a parameters to the timer, you have to adapt the parameter to the script. 
|
|
|
|
Joined: Feb 2004
Posts: 2,013
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,013 |
if ($nick($chan,$nick(#,%x,r)).idle >= 300) Don't forget to change $chan to $1 as well --> if ($nick( $1,$nick($1,%x,r)).idle >= 300) Script:
alias idle { .timer 0 301 idle2 #HelpCenter }
alias idle2 {
if ($me !isop $1) { echo -a You are not oped on $1 | return }
var %x = $nick($1,0,r)
while (%x) {
if ($nick($1,%x,r).idle >= 300) {
kick $1 $nick($1,%x,r) You have Idled in $1 for 5mins - Please Come back if you need help.
}
dec %x
}
}
It is important that you understand the difference between having idle time higher than 300, and having a timer check for idle times every 301 seconds. Checking every 301 seconds, means that the maximum idle time of a person in your channel is (current idle + 301) seconds. The lower you set the timer to, the less maximum idle time they can have. To explain this the easiest way: if you do /idle, then the people who are on your channel for say for example 250 seconds, will only get kicked after 301 seconds after typing /idle, which means they'll have been idle for a total amount of 551 seconds. Greets Edit: added checking if oped, + small change thx to Iori
Last edited by FiberOPtics; 31/05/04 01:47 AM.
|
|
|
|
Iori
|
Iori
|
- if ($nick($1,%x,r).idle >= 300)
|
|
|
|
Joined: May 2004
Posts: 132
Vogon poet
|
Vogon poet
Joined: May 2004
Posts: 132 |
cant my script be used aswell as yours?
|
|
|
|
Joined: Feb 2004
Posts: 2,013
Hoopy frood
|
Hoopy frood
Joined: Feb 2004
Posts: 2,013 |
Hi Noplex,
you probably replied to the wrong person, as Iori didn't post a script.
To answer your question: all the solutions pasted in this thread are more or less the same aside from little differences in scripting approach. The script I pasted last, is pretty much the same as you pasted.
Btw I noticed you altered the script, though you should remove the "2" from the kick command. The 2 was used along with the /ban command to set the type of ban, though it does not have a meaning with the /kick command.
Greets
Edit: to Zyxxy and Kriminal: while (%x <= $nick($1,0,r)) <-- it is usually bad practice to put an identifier in an if condition, when it is certain that the identifier needs quite some internal processing to return the value. I'm thinking of $len, $lines, and anything that requires some calculation. This is because with every iteration, the identifier has to be called again to return the wanted value. It is far more efficient to store the wanted value in a variable, and then inc/dec the iteration variable (as seen in my example script). Note that in other cases the loss in speed won't be much, and then it won't matter. Btw this isn't criticism in any way, just trying to give some tips of value.
Last edited by FiberOPtics; 31/05/04 02:25 AM.
|
|
|
|
Joined: May 2004
Posts: 132
Vogon poet
|
Vogon poet
Joined: May 2004
Posts: 132 |
oh ok... I must have missed the 2.. Thx for you notice
|
|
|
|
Joined: Dec 2003
Posts: 199
Vogon poet
|
OP
Vogon poet
Joined: Dec 2003
Posts: 199 |
Question; Why WOULDNT this work? alias idle { .timer 0 1 /idle2 #HelpCenter } alias idle2 { var %x = 1 while (%x <= $nick($1,0,r)) { if ($nick($1,$nick($1,%x,r)).idle >= 300) { kick $1 $nick($1,%x,r) You have Idled in $1 for 5mins - Please Come back if you need help. } inc %x } } I like to have my code fixed rather than a brand new one, it doesn't feel right :tongue:
|
|
|
|
Iori
|
Iori
|
It should work.
I do recommend... 1. Use a longer delay between repetitions. 2. Name the timer. (e.g. .timeridlechk 0 60 idle2 #helpcenter) 3. Use if ($nick($1,%x,r).idle >= 300) in place of if ($nick($1,$nick($1,%x,r)).idle >= 300)
|
|
|
|
Joined: Dec 2003
Posts: 199
Vogon poet
|
OP
Vogon poet
Joined: Dec 2003
Posts: 199 |
Yeah, Just tested it works.  Thanks for the recommendations.
|
|
|
|
|