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.

fixing loops

Old posts that have not been replied to for several years.
Locked
D
DarkJFMan
Halfop
Posts: 85
Joined: Mon Dec 15, 2003 3:19 pm

fixing loops

Post by DarkJFMan »

Code: Select all

 bind pub - `ops pub:ops
proc pub:ops { nick host hand args } {
  set channels "[channels]"
  while { $channels != "" } {
    set channel [lindex $channels 0]
    set test [chanlist $channel]
    set ops($channel) 0
    for { set number 0 } { $number < [llength $test] } { incr number } {
 if {[isop [lindex $test $number] $channel]} {
   incr ops($channel)
 }
    }
    set operators($channel) 0
    foreach nick [userlist o] {
 if {[onchan [hand2nick $nick] $channel]} {
   incr operators($channel)
 }
    }
    puthelp "PRIVMSG $channel :There are currently $ops($channel) people opped and\
      $operators($channel) operators in $channel."
    set channels [lreplace $channels 0 0]
  }
  return 0
} 
Is there a way i can make this msg the chan where i typed `ops, because right now, it's msging all the chanes that it's in.
User avatar
KrzychuG
Master
Posts: 306
Joined: Sat Aug 16, 2003 2:51 pm
Location: Torun, Poland
Contact:

Post by KrzychuG »

Code: Select all

bind pub - `ops pub:ops 
proc pub:ops { nick host hand channel args } { 
    set test [chanlist $channel] 
    set ops($channel) 0 
    for { set number 0 } { $number < [llength $test] } { incr number } { 
      if {[isop [lindex $test $number] $channel]} { 
        incr ops($channel) 
      } 
    } 
    set operators($channel) 0 
    foreach nick [userlist o] { 
      if {[onchan [hand2nick $nick] $channel]} { 
        incr operators($channel) 
      } 
    } 
    puthelp "PRIVMSG $channel :There are currently $ops($channel) people opped and\ 
      $operators($channel) operators in $channel." 
  } 
  return 0 
}
Check this code :)
Que?
D
DarkJFMan
Halfop
Posts: 85
Joined: Mon Dec 15, 2003 3:19 pm

Post by DarkJFMan »

ty :)

could this work

Code: Select all

bind pub - `ops pub:ops
proc pub:ops { nick host hand channel args } {
    set test [chanlist $channel]
    set ops($channel) 0
    for { set number 0 } { $number < [llength $test] } { incr number } {
      if {[isop [lindex $test $number] $channel]} {
        incr ops($channel)
      }
    }
  [b]  set voice($channel) 0
    for { set number 0 } { $number < [llength $test] } { incr number } {
      if {[isvoice [lindex $test $number] $channel]} {
        incr voice($channel)[/b]
      }
    }
    set operators($channel) 0
    foreach nick [userlist o] {
      if {[onchan [hand2nick $nick] $channel]} {
        incr operators($channel)
      }
    }
    puthelp "PRIVMSG $channel :There are currently $ops($channel) people opped and\
      $operators($channel) operators in $channel."
  }
  return 0
}
D
DarkJFMan
Halfop
Posts: 85
Joined: Mon Dec 15, 2003 3:19 pm

Post by DarkJFMan »

ty :)

could this work

Code: Select all

bind pub - `ops pub:ops
proc pub:ops { nick host hand channel args } {
    set test [chanlist $channel]
    set ops($channel) 0
    for { set number 0 } { $number < [llength $test] } { incr number } {
      if {[isop [lindex $test $number] $channel]} {
        incr ops($channel)
      }
    }
#line added
  set voice($channel) 0
    for { set number 0 } { $number < [llength $test] } { incr number } {
      if {[isvoice [lindex $test $number] $channel]} {
        incr voice($channel)
      }
    }
#end of line
    set operators($channel) 0
    foreach nick [userlist o] {
      if {[onchan [hand2nick $nick] $channel]} {
        incr operators($channel)
      }
    }
    puthelp "PRIVMSG $channel :There are currently $ops($channel) people opped and\
      $operators($channel) operators in $channel."
  }
  return 0
}
User avatar
KrzychuG
Master
Posts: 306
Joined: Sat Aug 16, 2003 2:51 pm
Location: Torun, Poland
Contact:

Post by KrzychuG »

Should work :)
Que?
D
DarkJFMan
Halfop
Posts: 85
Joined: Mon Dec 15, 2003 3:19 pm

Post by DarkJFMan »

Code: Select all

bind pub - `power pub:power
proc pub:power { nick host hand channel args } {
  set test [chanlist $channel]

# The channels bot is in
  set reg($channel) 0
  for { set number 0 } { $number < [llength $test] } { incr number } {
    if {[botisin [lindex $test $number] $channel]} {
       incr reg($channel)
     }
  }
# The channels bot is op
  set ops($channel) 0
  for { set number 0 } { $number < [llength $test] } { incr number } {
      if {[botisop [lindex $test $number] $channel]} {
        incr ops($channel)
      }
    }
# The number of users are in chan with bot
  set usera($channel) 0
    for { set number 0 } { $number < [llength $test] } { incr number } {
      if {[nickisin [lindex $test $number] $channel]} {
        incr usera($channel)
      }
    } 
# The number of users are in chan with bot with no op
  set usern($channel) 0
    for { set number 0 } { $number < [llength $test] } { incr number } {
      if {![isop $nick $channel] } {
	incr usern($channel)
      }
    }
puhelp "PRIVMSG $channel :I'm oped in $ops($channel) channels out of $reg($channel), \
    and can fool around with $usern($channel) of $usera($channel)
  }
 return 0
}
}
Could this work? i was trying to make it, so i can user "expr" for calculations, but i had no idea how to put it in there, but i took a wild guess.
Locked