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.

Please, fix this script.

Old posts that have not been replied to for several years.
Locked
s
st33l
Voice
Posts: 4
Joined: Thu Jun 23, 2005 6:16 am

Please, fix this script.

Post by st33l »

Please, correct this script. It should not pay attention to colors, the bold, the underlined text. And that our users change color and flood is not set off.
repeat.tcl

Code: Select all

# by Tris, 17jul96 (v2)
# action added by fantomas 22Dec1997

# Updated to v4 (17 November 1998) by slennox <slenny@ozemail.com.au>
# About time someone updated this nice little script that more
# people should be using :-)
# - Updated for 1.3 bots (channel specific +o user no longer kicked)
# - Added options to set number of kicks in how many seconds
# and kick msg
# - Added option to ban as well as kick
#
# Fixed version (1 December 1998)
# - repeatban set to 1 was generating 'invalid command name' error.
# I'd forgotten to add 'fixbanmask' proc (stolen from subop*.tcl by
# MHT & YaZZ) :-)
#
# Updated to v4.1 (8 December 1998)
# - Got rid of the fixbanmask crap and changed ban type to an IP ban :-)

# Updated (25 November 2002) @/+ exempt
# - Now this script won't kick opped/voiced users. I added an op/voice exempt to this script 
# originally made by Tris and modified by users listed above. (|am|) @ DALnet amit@amit.mu 

# Number of repeats before kicking
set repeatkick 3
# In how many seconds
set repeattime 70
# Kick msg
set repeatmsg "Stop Repeating!"
# Also ban?
set repeatban 1
# How long the ban should last (in minutes)
set repeatbantime 30


# Don't edit below unless you know what you're doing
bind pubm - * repeat_pubm
bind ctcp - ACTION repeat_action
bind nick - * repeat_nick

proc repeat_pubm {nick uhost hand chan text} {
  if {[matchattr $nick mo|mo $chan] || [isop $nick $chan] || [isvoice $nick $chan] || [matchattr $nick o|o $chan]} {return 0}
  global repeat_last repeat_num repeatkick repeatmsg repeatban repeatbantime
  if [info exists repeat_last([set n [string tolower $nick]])] {
    if {[string compare [string tolower $repeat_last($n)] \
        [string tolower $text]] == 0} {
      if {[incr repeat_num($n)] >= ${repeatkick}} {
        if {$repeatban} {
          set banmask "*!*[string range $uhost [string first "@" $uhost] end]"
          newchanban $chan $banmask repeat $repeatmsg $repeatbantime
        }
        putserv "KICK $chan $nick :$repeatmsg"
        unset repeat_last($n)
        unset repeat_num($n)
      }
      return
    }
  }
  set repeat_num($n) 1
  set repeat_last($n) $text
}

proc repeat_action {nick uhost hand dest keyword text} {
  if {[matchattr $nick mo|mo $dest] || [isop $nick $dest] || [isvoice $nick $dest] || [matchattr $nick o|o $dest]} {return 0} 
  global botnick altnick repeat_last repeat_num repeatkick repeatmsg repeatban repeatbantime
  if [info exists repeat_last([set n [string tolower $nick]])] {
    if {[string compare [string tolower $repeat_last($n)] \
        [string tolower $text]] == 0} {
      if {[incr repeat_num($n)] >= ${repeatkick}} {
        if {$repeatban} {
          set banmask "*!*[string range $uhost [string first "@" $uhost] end]"
          newchanban $dest $banmask repeat $repeatmsg $repeatbantime
        }
        putserv "KICK $dest $nick :$repeatmsg"
        unset repeat_last($n)
        unset repeat_num($n)
      }
      return
    }
  }
  set repeat_num($n) 1
  set repeat_last($n) $text
}

proc repeat_nick {nick uhost hand chan newnick} {
  if {[matchattr $nick mo|mo $chan] || [isop $nick $chan] || [isvoice $nick $chan] || [matchattr $nick o|o $chan]} {return 0}
  global repeat_last repeat_num
  catch {set repeat_last([set nn [string tolower $newnick]]) \
         $repeat_last([set on [string tolower $nick]])}
  catch {unset repeat_last($on)}
  catch {set repeat_num($nn) $repeat_num($on)}
  catch {unset repeat_num($on)}
}

proc repeat_timr {} {
  global repeat_last repeattime
  catch {unset repeat_last}
  catch {unset repeat_num}
  utimer $repeattime repeat_timr
}

if ![regexp repeat_timr [utimers]] {     # thanks to jaym
  utimer $repeattime repeat_timr
}

putlog "repeat.tcl (@/+ exempt) by |am| originally made by Tris loaded"
s
stevegarbz
Op
Posts: 104
Joined: Sat Dec 04, 2004 7:25 pm

Post by stevegarbz »

What does it say the error is when it isn't working?
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

this script looks rather bad anyway, there are much better ones.
the implantation of Sir Fz' allfloodprotection is better, however I still like slenox one which was the best... I hope the things I like it for arent changed from myself (I cant even remeber all changes I did to others scripts ^^).

However back to your problem about the stripcodes, if you are using 1.6.17 or above you can simply add:

Code: Select all

set text [string tolower [stripcodes abcru $text]]
somewhere before the first use of $text and remove all the string tolower things around $text later on.
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
s
st33l
Voice
Posts: 4
Joined: Thu Jun 23, 2005 6:16 am

Post by st33l »

De Kus, thank you!
allfloodprotection don't strip colors too ;)
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

st33l wrote:De Kus, thank you!
allfloodprotection don't strip colors too ;)
It will in the next realease :D
Locked