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.
Help for those learning Tcl or writing their own scripts.
tonyokc
Voice
Posts: 11 Joined: Mon May 03, 2004 12:16 am
Post
by tonyokc » Tue Jul 17, 2007 2:22 pm
There are times I need to op all users with the o flag, so I can check the remaining
I have a routine to do it, but it fails on nicks with special characters. I know the fix is the "list" command, but I could sure use a bit of help on where to use it
Any help is appreciated
Tony
Code: Select all
# accept .opops <channel> from global n to op all bot known ops
bind dcc n| opops opops
proc opops {h id chan} {
global botnick
set members [chanlist $chan]
putdcc $id $members
foreach who $members {
if {![isop $who $chan] && [matchattr [nick2hand $who $chan] o|o $chan] } { lappend opnicks $who }
}
set dumps [expr {[llength $opnicks] / 6} ]
putdcc $id "op oping $chan"
set i 0
while { $i < [llength $opnicks]} {
putquick "MODE $chan +oooooo [lrange $opnicks $i [expr {$i + 5} ]]"
set i [expr {$i +6}]
}
}
r0t3n
Owner
Posts: 507 Joined: Tue May 31, 2005 6:56 pm
Location: UK
Post
by r0t3n » Tue Jul 17, 2007 3:28 pm
No need for the while loop, when you have a foreach loop...
Code: Select all
bind dcc n| opops opops
proc opops {h id chan} {
global botnick
set members [chanlist $chan]
putdcc $id $members
set opnicks ""
set dumps 0
putdcc $id "op oping $chan"
foreach who $members {
if {![isop $who $chan] && [matchattr [nick2hand $who] o|o $chan] } {
lappend opnicks $who
incr dumps 1
if {[llength $opnicks] == "6"} {
putquick "MODE $chan +oooooo [join $opnicks " "]"
unset opnicks
}
}
}
if {[[length $opnicks] >=1} {
putquick "MODE $chan +[string repeat "o" [llength $opnicks]] [join $opnicks " "]"
unset opnicks
}
set dumps [expr {$dumps / 6}]
}
Not tested.
r0t3n @ #r0t3n @ Quakenet
rosc2112
Revered One
Posts: 1454 Joined: Sun Feb 19, 2006 8:36 pm
Location: Northeast Pennsylvania
Post
by rosc2112 » Tue Jul 17, 2007 6:51 pm
tonyokc wrote: I have a routine to do it, but it fails on nicks with special characters. I know the fix is the "list" command, but I could sure use a bit of help on where to use it
http://www.peterre.info/characters.html