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 in caps kicker tcl for arfer

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

In:

Code: Select all

if {![matchattr [nick2hand $nick] $vCapsFlagsAllow $chan]} {
you don't need nick2hand $nick since you already have the hand (user account) from the proc itself.
Once the game is over, the king and the pawn go back in the same box.
User avatar
Arnold_X-P
Master
Posts: 226
Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:

Post by Arnold_X-P »

would this be correct?

Code: Select all

if {[matchattr $hand $vCapsFlagsAllow $chan] || [isop $nick $chan] || [ishalfop $nick $chan]} {
.:an ideal world:. www.geocities.ws/chateo/yo.htm
my programming place /server ix.scay.net:7005
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Sure, that's what I said. :)
Once the game is over, the king and the pawn go back in the same box.
User avatar
Arnold_X-P
Master
Posts: 226
Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:

Post by Arnold_X-P »

if i delete these two routes

Code: Select all

if {[botisop $chan]} {
 if {![matchattr [nick2hand $nick] $vCapsFlagsAllow $chan]} { 
and I replace them with

Code: Select all

if {[matchattr $hand $vCapsFlagsAllow $chan] || [isop $nick $chan] || [ishalfop $nick $chan]} { 
I get the error again
[04:02:41] Tcl error [pCapsDetect]: can't read "diff": no such variable

Code: Select all

# caps.tcl

# set bot user flags to ignore text
set vCapsFlagsAllow fo

# set text length (excluding spaces) to allow without checking
set vCapsLengthAllow 4

# set maximum percentage caps allowed (calculation excludes spaces in text)
# greater than 0, less than or equal to 100
set vCapsPercentAllow 40

# set number of warnings before punishing
# integer value equal to or greater than 1
set vCapsWarnings 3

# set here the mode of punishment
# 1 == kick only (after warnings)
# 2 == kickban (after warnings)
set vCapsPunishMode 1

# time in minutes within which a warning remains valid
# even after the user is punished, passed offences remain valid for this time period
# hence a user could be punished twice for two consecutive offences
set vCapsSinTime 20

# if punishment mode 2, set here the time in minutes the ban lasts
set vCapsBanTime 10

# Set this to 1 to ignore nicks in lines
set vIgnoreNick 1

bind PUBM - * pCapsDetect

proc pCapsDetect {nick uhost hand chan text} {
    global vCapsBanTime vCapsFlagsAllow vCapsLengthAllow vCapsPercentAllow
    global vCapsPunishMode vCapsSinBin vCapsSinTime vCapsWarnings
 if {[matchattr $hand $vCapsFlagsAllow $chan] || [isop $nick $chan] || [ishalfop $nick $chan]} {
         if {$::vIgnoreNick == 1} {
            set nicks [chanlist $chan]
            set text [join [ldiff [split $text] $nicks]]
         }
            set caps [regexp -all -- {[A-Z]} $text]
            set total [string length [regsub -all -- {[\s]} $text {}]]
            if {$total > $vCapsLengthAllow} {
                set percent [expr {$caps * 100.0 / $total}]
                if {$percent > $vCapsPercentAllow} {
                    set now [unixtime]
                    set max [expr {$now - ($vCapsSinTime * 60)}]
                    lappend vCapsSinBin(${nick},$chan) $now
                    foreach sin $vCapsSinBin(${nick},$chan) {
                        if {$sin >= $max} {lappend newlist $sin}
                    }
                    set vCapsSinBin(${nick},$chan) $newlist
                    if {[llength $vCapsSinBin(${nick},$chan)] > $vCapsWarnings} {
                        switch -- $vCapsPunishMode {
                            1 {}
                            2 {
                                pushmode $chan +b ${nick}!$uhost
                                flushmode $chan
                                timer $vCapsBanTime [list pushmode $chan -b ${nick}!$uhost]
                            }
                            default {return 0}
                        }
                        putkick $chan $nick "excess caps, you were warned"
                    } else {
                        set output "*** [llength $vCapsSinBin(${nick},$chan)] WARNING(S) *** within the last $vCapsSinTime minutes for excess caps"
                        putserv "PRIVMSG $chan :$nick $output"
                    }
                }
            }
        }
    }
    return 0
}


proc ldiff {list1 list2 {option -exact}} {
   if {$option ne "-nocase"} { set option -exact }
   return [lmap x $list1 {expr {[lsearch $option $list2 $x] < 0 ? $x : [continue]}}]
}

proc lintersect {list1 list2 {option -exact}} {
   if {$option ne "-nocase"} { set option -exact }
   return [lmap x $list1 {expr {[lsearch $option $list2 $x] >= 0 ? $x : [continue]}}]
}

putlog "Caps.tcl by arfer is loaded"

 
.:an ideal world:. www.geocities.ws/chateo/yo.htm
my programming place /server ix.scay.net:7005
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

The variable "diff" is neither set nor called in the code you posted above.
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
User avatar
Arnold_X-P
Master
Posts: 226
Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:

Post by Arnold_X-P »

thanks SpiKe^^ and caesar
.:an ideal world:. www.geocities.ws/chateo/yo.htm
my programming place /server ix.scay.net:7005
User avatar
Arnold_X-P
Master
Posts: 226
Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:

Post by Arnold_X-P »

it can be omitted in uppercase nicknames, for example the use of [] or: is omitted;
example if there is an uppercase nickname called GENICOZZ
And the users name it in the channel like this GENICOZZ: or also GENICOZZ;
and the bot omit that semicolons and also omit when it is put between characters like [the-nickname]
example [GENICOZZ]
it is possible to create that variant so that it skips ; : and also [ ]
.:an ideal world:. www.geocities.ws/chateo/yo.htm
my programming place /server ix.scay.net:7005
User avatar
Arnold_X-P
Master
Posts: 226
Joined: Mon Oct 30, 2006 12:19 am
Location: DALnet - Trinidad - Beni - Bolivia
Contact:

Post by Arnold_X-P »

add this path but it doesn't work for me to skip : ; [ ]

Code: Select all

regsub -- {-[0-9A-Z].} $text {:;[ ]} text
.:an ideal world:. www.geocities.ws/chateo/yo.htm
my programming place /server ix.scay.net:7005
Post Reply