mIRC Home    About    Download    Register    News    Help

Print Thread
#108238 18/01/05 10:16 AM
Joined: Jan 2005
Posts: 17
S
Pikka bird
OP Offline
Pikka bird
S
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

#108239 18/01/05 10:48 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Code:
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.

#108240 18/01/05 11:04 AM
Joined: Jan 2005
Posts: 17
S
Pikka bird
OP Offline
Pikka bird
S
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

#108241 18/01/05 11:10 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
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?

Code:
on 1:Join:#: {
  if ($timer(idlechk)) { 
    return
  }
  else {
    .timeridlechk 0 600 check.idle
  }
}

#108242 18/01/05 11:21 AM
Joined: Jan 2005
Posts: 17
S
Pikka bird
OP Offline
Pikka bird
S
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!

#108243 18/01/05 11:49 AM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Code:
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

#108244 18/01/05 12:13 PM
Joined: Jan 2005
Posts: 17
S
Pikka bird
OP Offline
Pikka bird
S
Joined: Jan 2005
Posts: 17
did what you said and still, nothing frown
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

#108245 18/01/05 12:29 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
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. confused

#108246 18/01/05 01:19 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
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. wink

Code:
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.

#108247 18/01/05 09:15 PM
Joined: Jan 2005
Posts: 17
S
Pikka bird
OP Offline
Pikka bird
S
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.
#108248 18/01/05 09:50 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
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.

#108249 18/01/05 10:11 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
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. wink

#108250 18/01/05 10:16 PM
Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
actually ages agai i complained about it and was told how to do it. smile so im just playing it forward.

#108251 18/01/05 10:17 PM
Joined: Jan 2005
Posts: 17
S
Pikka bird
OP Offline
Pikka bird
S
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

#108252 18/01/05 10:19 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
Show us the working code. smile

#108253 18/01/05 10:35 PM
Joined: Jan 2005
Posts: 17
S
Pikka bird
OP Offline
Pikka bird
S
Joined: Jan 2005
Posts: 17
having problems...

Code:
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

#108254 18/01/05 10:47 PM
Joined: Dec 2002
Posts: 3,547
S
Hoopy frood
Offline
Hoopy frood
S
Joined: Dec 2002
Posts: 3,547
You was almost there...

Code:
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 
  }
}

#108255 19/01/05 02:41 PM
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Code:
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 }
}


Link Copied to Clipboard