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.

Beginner Help

Old posts that have not been replied to for several years.
Locked
b
broca

Beginner Help

Post by broca »

Hi. I don't know a word about TCL.
I downloaded lammer.tcl from this site.
But the script is buggy when need to ban someone without ident enabled, because the ban missed the ´~´ so the ban is useless.
The code of the script is:

Code: Select all

		newchanban $chan [maskhost [getchanhost $nick $chan]] "Sentinel" "Repeating is not allowed"
		putserv "KICK $chan $nick :Repeating is not allowed" -next
		putserv "MODE $chan +b [maskhost [getchanhost $nick $chan]]" -next 
I was reading the tcl docs that come with eggdrop, and some others script, to try to change the way of ban.

I rewrote that part:

Code: Select all

                set host [string tolower [lindex [split [getchanhost $nick $chan] @] 1]]
		newchanban $chan *!*@$host  "Sentinel" "No repitas" $flood_time
		putserv "KICK $chan $nick :No repitas" -next
		putserv "MODE $chan +b *!*@$host" -next
But now the script doesn't work.
I'm unclear what the problem is.
Someone can see a problem in that ?

Thanks a lot.
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

do u get a errormsg ?
Elen sila lúmenn' omentielvo
b
broca

Post by broca »

Papillon wrote:do u get a errormsg ?
Yes:
Tcl error [handle_lamer]: error while matching regular expression: invalid argument to regex function

It seems unrelated to my changes in the script. Because I receive this error at any time, not when the script is running in the lines where I did the changes.
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

could u paste the "handle_lamer" proc please ;) can't be bothered to download it
Elen sila lúmenn' omentielvo
b
broca

Post by broca »

Code: Select all

proc handle_lamer {nick keyword text} {
    set text [join $text]
    global lamers flood_time capsp screamp numcolor
    set nick [split $nick !]
    set nick [lindex $nick 0]
    set text [split $text]
    set chan [lindex $text 0]
    if {![validchan $chan]} { return 0 }
    if {([isop $nick $chan])||([isvoice $nick $chan])||([nick2hand $nick]!="*")} { return 0 }
    set text [lrange $text 1 end]
    set n [md5 $nick]
    set screams [regexp -all -- {[!,?]} $text]
    set caps [regexp -all -- {[A-Z,Å,Ä,Ö]} $text] 
    set colors [regexp -all -- "\003" $text]
    incr colors [regexp -all -- "\026" $text]
    incr colors [regexp -all -- "\033" $text]
    set strlen [string length $text]
    set retval 0
    if {![info exists lamers($n!wt)]} {
	set lamers($n!wt) [md5 $text]
	set lamers($n!w2) 1
	utimer $flood_time "del_floodvars $n"
	if {($colors>$numcolor)||(([expr $caps/$strlen.0]>$capsp)||([expr $screams/$strlen.0]>$screamp)&&($strlen>3))} {
	    set lamers($n!w3) 1
	    putserv "NOTICE $nick :No se permiten colores, mayusculas ni cantidades innecesarias de signos" -next
	} else {
	    set lamers($n!w3) 0
	}
    } else {
        if {[utimerexists "del_floodvars $n"]==""} { utimer $flood_time "del_floodvars $n" }
	if {$lamers($n!wt)==[md5 $text]} {
	    set lc $lamers($n!w2)
	    incr lc
	    set lamers($n!w2) $lc
	    if {$lc==2} {
		putserv "NOTICE $nick :No repitas" -next
	    } elseif {$lc==3} {
		putserv "KICK $chan $nick :No repitas" -next
		set retval 1
	    } elseif {$lc>3} {
                set host [string tolower [lindex [split [getchanhost $nick $chan] @] 1]]
		newchanban $chan *!*@$host  "Sentinel" "No repitas" $flood_time
		putserv "KICK $chan $nick :No repitas" -next
		putserv "MODE $chan +b *!*@$host" -next
		set retval 1
	    }
	} else {
	    set lamers($n!wt) [md5 $text]
	    set lamers($n!w2) 1
	}
	if {($colors>$numcolor)||(([expr $caps/$strlen.0]>$capsp)||([expr $screams/$strlen.0]>$screamp)&&($strlen>3))} {
            set lc $lamers($n!w3)
            incr lc
            set lamers($n!w3) $lc
            if {$lc==2} {
                putserv "KICK $chan $nick :No se permiten colores, mayusculas ni cantidades innecesarias de signos" -next
		set retval 1
            } elseif {$lc>2} {
                set host [string tolower [lindex [split [getchanhost $nick $chan] @] 1]]
		newchanban $chan *!*@$host  "Sentinel" "No se permiten colores, mayusculas ni cantidades innecesarias de signos" $flood_time
                putserv "KICK $chan $nick :No se permiten colores, mayusculas ni cantidades innecesarias de signos" -next
                putserv "MODE $chan +b *!*@$host" -next
		set retval 1
	    }
	}
    }
    return $retval
}
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

Your Tcl version is too old to run that script. You need at least Tcl 8.3 to have the -all option to regexp.
Locked