This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

check op %

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
.
.pt
Halfop
Posts: 71
Joined: Wed Nov 16, 2005 10:14 am

check op %

Post by .pt »

hi all, does anyone know if exists or can make a script that can count the % a bot is opped in a chan? i tried to search the forum and the tcl script archive but nothing like, so if someone can point a site or make one it would be great tks.

example:
<user> !opless #chan
<eggdrop> 75% without op on $chan

PS: the objective of this script is that i lend some bot to people, and if the bot stays there without op not doing anything theres no objective to be there just to fill up the chan
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

modify the script to use '[isop $nick] || [ishalfop $nick]' instead of just '[isop $nick]'.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
.
.pt
Halfop
Posts: 71
Joined: Wed Nov 16, 2005 10:14 am

Post by .pt »

sorry did understand,, modify what script?
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

sorry, I somehow read after waking up, you would a scrpt that does not only count ops, but also halfops...

so you were looking for something like?

Code: Select all

bind pub - !opless opless

proc opless {nick uhost hand chan text} {
   if {![validchan $text] || ([channel get $text secret] && ![onchan $nick $text])} {
      puthelp "NOTICE $nick :I am not on such channel"
      return 0
   }
   set users [chanlist $text]
   set total [llength $users]
   set ops 0
   foreach user $users {
      if {[isop $user] || [ishalfop $user]} {
         incr ops
      }
   }
   puthelp "PRIVMSG $chan :[expr {100 - round(100.0 * $ops / $total)}]% without op on $text"
   return 1
}
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
.
.pt
Halfop
Posts: 71
Joined: Wed Nov 16, 2005 10:14 am

Post by .pt »

oh sorry, is nothing like that, maybe i explained myself wrong, its like this..

i run a channel were there are 4 bots that users can request for their channels so they can have a bot for them, and i want something to check from the time that bot spends on the channel what is the % of time that the op had ops, so i can know if the op is having op most of the time..

tks in advance
.
.pt
Halfop
Posts: 71
Joined: Wed Nov 16, 2005 10:14 am

Post by .pt »

or something like a timer to check if the bot is op and count the times is op for that chan and the times is not op, at the end off like a day he check the 2 variables and if the opless one is bigger than the other he notices me or leave the chan
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

bind time - * deoprate
bind pub - !opless ratereply

set ratemins 0

proc deoprate args {
 global deoprate ratemins
 foreach c [channels]
  if {![info exists deoprate([set c [string tolower $c]])]} { set deoprate($c) 0 }
  if {![botisop $c]} { incr deoprate($c) }
 }
 incr ratemins
}

proc ratereply {nick uhost hand chan arg} {
 global deoprate ratemins
 if {[validchan [set c [lindex [split $arg] 0]]] && [info exists deoprate($c)]} {
  puthelp "privmsg $chan :[expr {$deoprate($c)/$ratemins*100}]% without op on $c"
 }
}
.
.pt
Halfop
Posts: 71
Joined: Wed Nov 16, 2005 10:14 am

Post by .pt »

do i have to set ratemins to something?
.
.pt
Halfop
Posts: 71
Joined: Wed Nov 16, 2005 10:14 am

Post by .pt »

ignore my last post. just one more thing if isnt much trouble can u make the command !opless list all chans the bot is on instead of checking !opless #chann ?

tks in advance
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

bind time - * deoprate
bind pub - !opless ratereply

set ratemins 0

proc deoprate args {
 global deoprate ratemins
 foreach c [channels]
  if {![info exists deoprate([set c [string tolower $c]])]} { set deoprate($c) 0 }
  if {![botisop $c]} { incr deoprate($c) }
 }
 incr ratemins
}

proc ratereply {nick uhost hand chan arg} {
 global deoprate ratemins
 foreach c [channels] {
  if {[info exists deoprate($c)]} {
   puthelp "privmsg $chan :[expr {$deoprate($c)/$ratemins*100}]% without op on $c"
  }
 }
}
.
.pt
Halfop
Posts: 71
Joined: Wed Nov 16, 2005 10:14 am

Post by .pt »

tks :)

best regards
Post Reply