mIRC Home    About    Download    Register    News    Help

Print Thread
#84681 31/05/04 12:48 AM
Joined: Dec 2003
Posts: 199
K
Vogon poet
OP Offline
Vogon poet
K
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


Want to Link Servers? PM Me
- EliteIRC.dyndns.org -
#84682 31/05/04 12:59 AM
Joined: May 2004
Posts: 132
N
Vogon poet
Offline
Vogon poet
N
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.

if ($me != geek) { $life is $false }
else { $life is $true }
NoPleX
#84683 31/05/04 01:06 AM
Joined: Feb 2004
Posts: 714
Z
Hoopy frood
Offline
Hoopy frood
Z
Joined: Feb 2004
Posts: 714
There is no channel specified if you do it by timer.
Code:
alias idle { .timer 0 301 /idle2 [color:red]#channelname[/color] }
alias idle2 { var %x = 1
while (%x &lt;= $nick([color:red]$1[/color],0,r)) { if ($nick($chan,$nick([color:red]$1[/color],%x,r)).idle &gt;= 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.

"All we are saying is give peace a chance" -- John Lennon
#84684 31/05/04 01:11 AM
Joined: Dec 2003
Posts: 199
K
Vogon poet
OP Offline
Vogon poet
K
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)


Want to Link Servers? PM Me
- EliteIRC.dyndns.org -
#84685 31/05/04 01:13 AM
Joined: Feb 2004
Posts: 714
Z
Hoopy frood
Offline
Hoopy frood
Z
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. smile


"All we are saying is give peace a chance" -- John Lennon
#84686 31/05/04 01:37 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Quote:
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:
Code:
 
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 &gt;= 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.

Gone.
#84687 31/05/04 01:43 AM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
  • if ($nick($1,%x,r).idle >= 300)

#84688 31/05/04 02:04 AM
Joined: May 2004
Posts: 132
N
Vogon poet
Offline
Vogon poet
N
Joined: May 2004
Posts: 132
cant my script be used aswell as yours?


if ($me != geek) { $life is $false }
else { $life is $true }
NoPleX
#84689 31/05/04 02:08 AM
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
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.

Gone.
#84690 31/05/04 02:35 AM
Joined: May 2004
Posts: 132
N
Vogon poet
Offline
Vogon poet
N
Joined: May 2004
Posts: 132
oh ok... I must have missed the 2.. Thx for you notice smile


if ($me != geek) { $life is $false }
else { $life is $true }
NoPleX
#84691 31/05/04 05:35 AM
Joined: Dec 2003
Posts: 199
K
Vogon poet
OP Offline
Vogon poet
K
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:


Want to Link Servers? PM Me
- EliteIRC.dyndns.org -
#84692 31/05/04 05:54 AM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
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)

#84693 31/05/04 05:56 AM
Joined: Dec 2003
Posts: 199
K
Vogon poet
OP Offline
Vogon poet
K
Joined: Dec 2003
Posts: 199
Yeah, Just tested it works. smile
Thanks for the recommendations. wink


Want to Link Servers? PM Me
- EliteIRC.dyndns.org -

Link Copied to Clipboard