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.

mass slap+say script

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
A
Atako
Voice
Posts: 1
Joined: Sat Aug 18, 2012 2:29 pm

mass slap+say script

Post by Atako »

Hey! Could you help me?

I need a script mass slap+say

I will write on one channel: .say blebleble

and bot will slap all users on #channel and say blebleble Can someone help me?

I've say and mass slap script but i can't

Code: Select all

bind msg - .say msg_say

proc msg_say {nick uhost hand args} {
    global botnick 
    if {[llength [lindex $args 0]]<2} {
        putserv "NOTICE $nick :/msg $botnick .say #chan_name <text>"
    } else {
        set chan [lindex [lindex $args 0] 0]
        if { ![validchan $chan]} {
            putserv "NOTICE $nick :\"$chan\": invalid chan."
            return 0
        }
        ## FIX ME this condition is never reached
        if { ![onchan $botnick $chan] } {
            putserv "NOTICE $nick :je ne suis pas sur le chan \"$chan\"."
            return 0
        }
        ## END FIX ME
        # comment this next 4 lines if you want to be able to talk in a chan you're not in
        if { ![onchan $nick $chan] } {
            putserv "NOTICE $nick :tu n'es pas sur le chan \"$chan\"."
            return 0
        }
        set msg [lrange [lindex $args 0] 1 end]
    }
    proc massslap {nick uhost hand chan text args} { 
   # dump only 25 nicks per line 
   set chanList [chanlist $chan] 
   while {[llength $chanList] != 0} { 
      puthelp "PRIVMSG $chan :[join [lrange $chanList 0 25]]" 
      set chanList [lrange $chanList 25 end] 
   } 
} 
    putchan $chan $msg
}
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Re: mass slap+say script

Post by speechles »

Code: Select all

 if {[llength [lindex $args 0]]<2} {
# becomes to the eggdrop every single time
if {1 < 2 } {
Here is your problem. "[llength [lindex $args 0]]" will always be 1. It has no choice but to be because of how you've used it in your procedure declaration.

Stop using "[lindex $args 0]" all over the place. Everywhere you have that change it to "[split $arg]".

Also, change this part:
proc msg_say {nick uhost hand args} {

to this:
proc msg_say {nick uhost hand arg} {

There are more errors than this in your script concerning list to string errors. But I will let you figure those out. Only in certain conditions with certain characters should you notice the bugs.
http://www.peterre.info/characters.html wrote:A point worthy of note about args
Putting args as the last argument of a Tcl procedure allows the use of a variable number of input arguments. But there is a potential source of confusion if the procedure is one that is called by an eggdrop bind command.

In a script that I downloaded I saw code similar to the following:

bind dcc - m2f dcc_calc_m2f
proc dcc_calc_m2f {hand idx args} {
if {[llength $args] == "1"} {

The author was no doubt thinking that if a user typed
.m2f aaa bbb ccc
then the value of args would be a list of three elements, aaa, bbb and ccc, and that therefore the value of [llength $args] would be 3.

In fact, the value of args would be a list of one element, that element being the string aaa bbb ccc. Whatever string the user types, the value of [llength $args] will always be 1.

Similarly, the value of [lindex $args 0] will not be the string aaa, but the string aaa bbb ccc.

The eggdrop pub and msg binds behave in the same way.

The above properties of eggdrop's bind command have been confirmed by testing with eggdrop version 1.6.6.
Post Reply