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 

Bind dcc - voice

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


Joined: 14 Aug 2009
Posts: 55

PostPosted: Fri Mar 05, 2010 7:18 am    Post subject: Bind dcc - voice Reply with quote

Everything is in the title please i want a script that voice in mass in dcc

ex: .+v nick1 nick2 nick3 nick4 nick5 nick6 #channel
Back to top
View user's profile Send private message
TCL_no_TK
Owner


Joined: 25 Aug 2006
Posts: 509
Location: England, Yorkshire

PostPosted: Sun Mar 07, 2010 7:17 am    Post subject: Reply with quote

Code:
 proc dcc:+v {hand idx text} {
  set chan [join [lrange [split $text] end end]]
  set vnicks [join [lrange [split $text] end-1 end-1]]
  if {$vnicks == ""} {
   putidx $idx "Usage: +v <nicknames ...> \[#channel\]"
   return 1
  }
   if {([regexp {^#} $chan])&&(![validchan "$chan"])} {
    if {(![validchan [lindex [split [console $idx]] 0]])} {
    putidx $idx "Usage: +v <nicknames ...> \[#channel\]"
    return 1
    } else {
     set chan [lindex [split [console $idx]] 0]
    }
   }
    if {![botisop $chan]} {
     putidx $idx "Sorry, I'm not a channel operator on $chan"
     return 1
    }
     foreach nicks $vnicks {
      pushmode $chan +v $nicks
     }
      return 1
 }

 bind dcc o|- +v dcc:+v
* Not Tested, any problems please post reply.
_________________
TCL the misunderstood
Back to top
View user's profile Send private message Send e-mail
neoclust
Halfop


Joined: 14 Aug 2009
Posts: 55

PostPosted: Sun Mar 07, 2010 8:48 am    Post subject: Reply with quote

Thanks man i made this code but it does not work as it should, thank you filed this procedure I'll test it.

Code:

bind dcc n +v mass:voice
proc mass:voice {hand idx arg} {
     set nick1 [lindex $arg 0]
     set nick2 [lindex $arg 2]
     set nick3 [lindex $arg 3]
     set nick4 [lindex $arg 4]
     set nick5 [lindex $arg 5]
     set nick6 [lindex $arg 6]
     set nick7 [lindex $arg 7]
     set chan "#chan"
     foreach nick [list $nick1 $nick2 $nick3 $nick4 $nick5 $nick6 $nick7] { pushmode $chan +v $nick }
}
Back to top
View user's profile Send private message
neoclust
Halfop


Joined: 14 Aug 2009
Posts: 55

PostPosted: Sun Mar 07, 2010 9:00 am    Post subject: Reply with quote

when I forget to put the #channel on the line I get it
(me): .+v angel Fury
((bot): [12:57] Tcl error [dcc:+v]: illegal channel: cryp
it should print some other exception I suppose, Ex: please put the channel name instead of "Tcl error [dcc:+v]: illegal channel: Fury" and
I noticed that the bot does not voice the entire list just one nick
Thanks
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sun Mar 07, 2010 2:25 pm    Post subject: Reply with quote

Tcl_no_tk:
Just a few remarks;
vnicks is a string, not a list. Thus not suitable for use with foreach.
[join [lrange [split $text] end end]] is the same as [lindex [split $text] end], same goes for end-1.
If the last word is not a valid channel, wouldn't this be a nickname to voice then? (add it to the list of nicks to voice)
The console command returns a list, not a string. Don't use split here.

I'd write the script somewhat like this:
Code:
proc dcc:pv {handle idx text} {
 set list [split $text]
 if {[validchan [lindex $list end]]} {
  set channel [lindex $list end]
  set list [lrange $list 0 end-1]
 } elseif {[validchan [lindex [console $idx] 0]]} {
  set channel [lindex [console $idx] 0]
 } else {
  putidx $idx {Usage: +v <nickname> [nickname] ... [channel]}
  return 1
 }
 if {![botonchan $channel] || ![botisop $channel]} {
  putidx $idx "I am currently not a channel operator on $channel"
 }
 foreach vnick [lsort -unique $list] {
  pushmode $channel +v $vnick
 }
}
bind dcc o|o +v dcc:pv


This could be more optimized, but I've kept it like this to make it easier to follow the flow of the code.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
neoclust
Halfop


Joined: 14 Aug 2009
Posts: 55

PostPosted: Sun Mar 07, 2010 5:47 pm    Post subject: Reply with quote

Thanks dude it's fine
Back to top
View user's profile Send private message
TCL_no_TK
Owner


Joined: 25 Aug 2006
Posts: 509
Location: England, Yorkshire

PostPosted: Mon Mar 08, 2010 3:10 pm    Post subject: Reply with quote

nml375: thanks! Smile
_________________
TCL the misunderstood
Back to top
View user's profile Send private message Send e-mail
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