|
Joined: Jan 2005
Posts: 17
Pikka bird
|
OP
Pikka bird
Joined: Jan 2005
Posts: 17 |
hi I want to auto-voice users who idle in a channel for a certain amount of time, say 30 minutes, and then half-op them after say 60 minutes can anyone help? thanks
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
alias check.idle {
var %nicks = $nick($chan,0)
while (%nicks) {
if ($nick($chan,%nicks).idle >= 1800) {
mode $chan +v $nick($chan,%nicks)
}
dec %nicks
}
}
Untested, that should voice anyone with an idle greater than or equal to 30 minutes.
|
|
|
|
Joined: Jan 2005
Posts: 17
Pikka bird
|
OP
Pikka bird
Joined: Jan 2005
Posts: 17 |
hi I got the script working by adding it to aliases, but it doesn't seem to operate automatically, I had to add /check.idle and then type that in the channel manually thanks
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
Ooops, sorry. I'm not sure what the best event to stick a timer in would be perhaps On Join and check idled nicks every 10 minutes?
on 1:Join:#: {
if ($timer(idlechk)) {
return
}
else {
.timeridlechk 0 600 check.idle
}
}
|
|
|
|
Joined: Jan 2005
Posts: 17
Pikka bird
|
OP
Pikka bird
Joined: Jan 2005
Posts: 17 |
ok looks good, I have both those code snippets in remote, is this correct? however, nothing seems to happen (I reduced the times to 10 seconds for testing) I'm pretty new to mirc scripting.. thanks!
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
on 1:Join:#: {
if ($timer(idlechk)) {
return
}
else {
.timeridlechk 0 20 check.idle
}
}
alias check.idle {
var %nicks = $nick($chan,0)
while (%nicks) {
if ($nick($chan,%nicks).idle > 60) {
if ($me isop $chan) {
mode $chan +v $nick($chan,%nicks)
}
}
dec %nicks
}
}
This goes in the Remotes Section yes. This code should, when someone joins the channel init the timer if not started already. The ' .timeridlechk 0 20 check.idle' part can be edited to suit your needs. The 0 must stay, the 0 signifies an infinite loop to check who is idled. The 20 part can be edited, it simply means the number of seconds until it performs the commands. The ' if ($nick($chan,%nicks).idle > 60) {' part can be modified but only the 60 part. This simply means if someone has an idle time greater than 60 the user will be voiced by you. I added if ($me isop $chan) { also. This simply checks if you are an op on the channel, if you are an operator you'll voice them. If not it should do nothing. I'm not sure if it works or not again the code is still untested. But we'll be glad to help you out until it reaches perfection. Take it easy, Andy
|
|
|
|
Joined: Jan 2005
Posts: 17
Pikka bird
|
OP
Pikka bird
Joined: Jan 2005
Posts: 17 |
did what you said and still, nothing I am using nnscript but tried it also on a new mirc install.. I got a clone to join and idle, but no result I can't see how it isn't working as I understand the code 100% is it possible to rename the check.idle to anything? thanks a lot for your help
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
I don't see how it isn't working, I have just tested it and it works fine here.
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
I'm not sure if it was because I had it set to any channel rather than a specified channel. But replace the text in green with your channel and see if that has any effect. It is working fine here. I was testing it with Kick though, between you and I I don't like people idling.
on !*:Join:[color:green]#chan[/color]: {
if ($timer(idlechk)) {
return
}
else {
.timeridlechk 0 30 check.idle
}
}
alias check.idle {
var %nicks = $nick([color:green]#chan[/color],0)
while (%nicks) {
if ($nick([color:green]#chan[/color],%nicks).idle > 60) {
if ($me isop [color:green]#chan[/color]) {
if ($me isin $nick([color:green]#chan[/color],%nicks)) { return }
mode #Help +v $nick([color:green]#chan[/color],%nicks)
}
}
dec %nicks
}
}
I have noticed that when you copy & paste from these forums, that you get all the text on one line so it is vital that you make sure the code is exactly as we see it. Otherwise it wont work, period. The above code triggers when someone joins the channel #chan. The timers check every 30 seconds to see who has an idle time greater than 60 seconds, if they do they'll get voiced. It works fine for me here other than that I really don't know what else to suggest. /timeridlechk off possibly. That halts the timers for the script, and when someone joins it starts again. If its already started it is left and the command is halted.
|
|
|
|
Joined: Jan 2005
Posts: 17
Pikka bird
|
OP
Pikka bird
Joined: Jan 2005
Posts: 17 |
does whitespace effect the way the script is executed too? thanks
Last edited by severnaya; 18/01/05 09:52 PM.
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
I have noticed that when you copy & paste from these forums, that you get all the text on one line so it is vital that you make sure the code is exactly as we see it. Otherwise it wont work, period. I mentioned this just the other day,in reply to someone elses mentioning another way as well, but thought it worth repeating both. (1) If u cut and paste from a message, you can open wordpad, paste text, reselect and cut and paste from there, and it well be fine. (2) click the quote link on the message the script u want is in, then cut and paste the script from the post text edit box, and it well be fine.
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
Thanks for that information. It's quite useful, everytime I post long code and spot an error I have to keep pressing return to make sure they are on seperate lines but no to worry. Ole Dave has the answers.
|
|
|
|
Joined: Sep 2003
Posts: 4,230
Hoopy frood
|
Hoopy frood
Joined: Sep 2003
Posts: 4,230 |
actually ages agai i complained about it and was told how to do it. so im just playing it forward.
|
|
|
|
Joined: Jan 2005
Posts: 17
Pikka bird
|
OP
Pikka bird
Joined: Jan 2005
Posts: 17 |
ok I finally got that working, however even if the user is already +v, they are still +v'd continuously (every however many seconds there are in /timeridlechk 0 60 check.idle how could I do a check for +v already, and if so, do not +v again? hmm, I will try myself this time! thanks
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
Show us the working code.
|
|
|
|
Joined: Jan 2005
Posts: 17
Pikka bird
|
OP
Pikka bird
Joined: Jan 2005
Posts: 17 |
having problems... on !*:Join:#test: {
if ($timer(idlechk)) {
return
}
else {
.timeridlechk 0 60 check.idle
}
}
alias check.idle {
var %nicks = $nick(#test,0)
while (%nicks) {
if ($nick(#test,%nicks).idle > 120) {
if ($me isop #test12345) {
if ($me isin $nick(#test,%nicks)) { return }
[color:green] if ($nick !isvoice #test) { [/color]
mode #test +v $nick(#test,%nicks)
[color:green] } [/color]
}
}
dec %nicks
}
}
I looked at the mirc help files, maybe my code is wrong syntax thanx
|
|
|
|
Joined: Dec 2002
Posts: 3,547
Hoopy frood
|
Hoopy frood
Joined: Dec 2002
Posts: 3,547 |
You was almost there...
on !*:Join:#test: {
if ($timer(idlechk)) {
return
}
else {
.timeridlechk 0 60 check.idle
}
}
alias check.idle {
var %nicks = $nick(#test,0)
while (%nicks) {
if ($nick(#test,%nicks).idle > 120) {
if ($me isop [color:green]#test[/color]) {
if ($me isin $nick(#test,%nicks)) { return }
[color:green]if ($nick(#test,%nicks) !isvoice #test) {[/color]
mode #test +v $nick(#test,%nicks)
}
}
}
dec %nicks
}
}
|
|
|
|
Joined: Aug 2003
Posts: 1,831
Hoopy frood
|
Hoopy frood
Joined: Aug 2003
Posts: 1,831 |
on me:*:join:[color:brown]#yourchannel[/color]:.timerchkidle 0 30 checkidle #
on me:*:part:[color:brown]#yourchannel[/color]:.timerchkidle off
alias checkidle {
if $me !isop $1 { return }
[color:gray] ; first check voiced nicks to see if you should /hop them[/color]
var %i = 1,%nicks
while $nick($1,%i,[color:red]v[/color],[color:green]@%[/color]) {
[color:gray] ; check [color:red]v[/color]oiced nicks [color:green](excludes Ops|Hops)[/color] idle times are >= [color:blue]3600[/color]secs (1 hour)[/color]
if $nick($1,$v1).idle >= [color:blue]3600[/color] { %nicks = %nicks $nick($1,%i,v) }
if $modespl // %i { mode $1 $+(+,$str(h,$v1)) %nicks | var %nicks }
inc %i
}
if $numtok(%nicks,32) { mode $1 $+(+,$str(h,$v1)) %nicks }
[color:gray] ; now check regulars[/color]
var %i = 1,%nicks
while $nick($1,%i,[color:red]r[/color]) {
[color:gray] ; check if [color:red]r[/color]egular nicks idle times are >= [color:blue]1800[/color] seconds (30 mins)[/color]
if $nick($1,$v1).idle >= [color:blue]1800[/color] { %nicks = %nicks $nick($1,%i,r) }
if $modespl // %i { mode $1 $+(+,$str(v,$v1)) %nicks | var %nicks }
inc %i
}
if $numtok(%nicks,32) { mode $1 $+(+,$str(v,$v1)) %nicks }
}
|
|
|
|
|