egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Help with List Command

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
tonyokc
Voice


Joined: 03 May 2004
Posts: 11

PostPosted: Tue Jul 17, 2007 2:22 pm    Post subject: Help with List Command Reply with quote

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:

# 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}]
  }
}
Back to top
View user's profile Send private message
r0t3n
Owner


Joined: 31 May 2005
Posts: 507
Location: UK

PostPosted: Tue Jul 17, 2007 3:28 pm    Post subject: Reply with quote

No need for the while loop, when you have a foreach loop...

Code:
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
Back to top
View user's profile Send private message MSN Messenger
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Tue Jul 17, 2007 6:51 pm    Post subject: Re: Help with List Command Reply with quote

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
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber