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.

Johoho's chanctrl.tcl Help

Old posts that have not been replied to for several years.
Locked
User avatar
FiRe
Voice
Posts: 18
Joined: Mon Jan 19, 2004 6:40 am

Johoho's chanctrl.tcl Help

Post by FiRe »

I know this isn't exactly the right place to get help, but i'm guessing some of you at least have used or are currently using this script of his (link).

I was wondering if anyone knows why the colour control part of the script doesn't not work for me. I'm using the latest version of netbots (4.09), with the updated script (botnetop.tcl 4.09.1). I have set the options in netset.tcl correctly:

Code: Select all

# EXTRAS
# chanctrl.tcl settings
set nb_component(chanctrl) 1
set cc_msgtype "NOTICE"
set cc_colourcontrol 1
set cc_clc_chans ""
set cc_clc_echans "#WPHUB #WPCS.Priv #DOA.UT #TriPPy #swafdpriv"
set cc_clc_flag "No|MNOHV"
set cc_clc_bantime1 5
set cc_clc_bantime2 15
set cc_clc_note "$owner"
set cc_clc_part 0
set cc_clc_pubm 1
set cc_clc_quit 0
set cc_clc_text {
"Your Part-MSG contained colours. Please disable that"
"That's the 2nd Time you used colours in your Part-MSG. Stop that please !"
"That was the last time for you to use colours here. Come back in 2 days!"
"Ok... we're done.. stay OUT!"
"Please don't use colours in this channel"
"Stop colours or we'll ban you"
"You don't want to listen, want you?? Two day ban!"
"You're out!"
"Your Quit-MSG contrained colours. Please disable that"
"That's the 2nd Time you used colours in your Quit-MSG. Stop that please!"
"You're banned for 2 days for your colour Quit-MSG"
"Quit somewhere else with colours...not here!"
}
set cc_noautorejoin 0
set cc_nar_chans "none"
set cc_nar_echans ""
set cc_nar_flag "bNo|mnov"
set cc_nar_seconds 2
set cc_nar_bantime 1
set cc_nar_bantype 1
set cc_nar_msg "no autorejoin - banned for a minute"
set cc_nochanhopper 0
set cc_nch_chans ""
set cc_nch_echans ""
set cc_nch_flag "bNo|mnov"
set cc_nch_seconds 2
set cc_nch_bantime1 1440
set cc_nch_bantime2 10080
set cc_nch_msg1 "No Channel hopping please !"
set cc_nch_msg2 "We know you as channel hopper ! Banned for 1 day!"
set cc_nch_msg3 "Channel hopping again ? Banned for 7 days!"
But this is the problem, the colour control part of the script doesn't actually work, it doesn't kick or ban people who use lots of colour, nor does it spit out any error. If checked these forums (searched), and found nothing relevant concerning this script. Does anyone know why it doesn't work?

Code: Select all

# chanctrl.tcl for netbots.tcl v3.30
# designed to work with eggdrop 1.5.3 or higher
# Johoho's Eggdrop Page - http://johoho.tuts.net/eggdrop/
# chanctrl.tcl copyright (c) 1999,2000 by johoho <johoho@hojo-net.de>
# netbots.tcl copyright (c) 1998-2000 by slennox <slennox@egghelp.org>

## chanctrl.tcl component script v3.06.0, 26.05.2000 ##

# History:
# 
# v1.00.0, 01.02.2000 - initial release
# v1.50.0, 03.02.2000 - added quit msg check
# v1.51.0, 17.03.2000 - fixed wrong bans and quit msg check procedures
# v1.52.0, 19.03.2000 - added a comment on useradd
# v2.00.0, 01.04.2000 - complete rewrite of the code
# v2.10.0, 22.04.2000 - added action and part check (/me && [/leave || /part])
# v2.11.0, 19.05.2000 - fixed a bug - thanks ICU and _eCs_
# v3.00.0, 25.05.2000 - added noautorejoin and nochanhopper code
# v3.01.0, 25.05.2000 - fixed a matching bug
# v3.02.0, 25.05.2000 - cc_action bug fix
# v3.03.0, 25.05.2000 - added cc_clc_pubm, cc_clc_quit and cc_clc_part again
# v3.04.0, 25.05.2000 - added note notification on bans
# v3.05.0, 25.05.2000 - splitted cc_flag
# v3.06.0, 26.05.2000 - optimized chans and echans code, fixed an unlikely to appear bug

# Thanks to:

# NML_375 for some lessons in coding...
# Abraham for his ideas / suggestions, bug reports and countless tests
# ...
# and of course slennox for his netbots.tcl!


# procs

proc ispermown { handle } {
  global owner
  if {![info exists owner] || $owner == ""} {return 0}
  if {$handle == "%"} {return 0}
  foreach zowner [split [string trim $owner " "] ,] {
    if {[string tolower $handle] == [string tolower $zowner]} { set isowner 1 } }
    if {[info exists isowner]} {
    if {[matchattr $handle n]} {return 1} {return 0}
  }
  return 0
}

# colourctrl.tcl, v2.25.0, 26.05.2000

setudef flag colourcontrol

if {$cc_clc_chans == ""} {
  set cc_clc_chans [channels]
} elseif {$cc_clc_chans == "none"} {
  set cc_clc_chans ""
}

foreach chan $cc_clc_chans {
  channel set $chan +colourcontrol
}

foreach chan $cc_clc_echans {
  channel set $chan -colourcontrol
}

proc cc_clc_part {nick uhost hand chan text} {
  if {[regexp -- (\003) $text]} {
    cc_clc_core $nick $uhost $hand $chan $text "part"
  }
}

proc cc_clc_pubm {nick uhost hand chan text} {
  if {[regexp -- (\003) $text]} {
    cc_clc_core $nick $uhost $hand $chan $text "pubm"
  }
}

proc cc_clc_action {nick uhost hand chan keyword text} {
  if {[regexp -- (\003) $text]} {
    cc_clc_core $nick $uhost $hand $chan $text "pubm"
  }
}

proc cc_clc_quit {nick uhost hand chan text} {
  if {[regexp -- (\003) $text]} {
    cc_clc_core $nick $uhost $hand $chan $text "quit"
  }
}

proc cc_clc_core {nick uhost hand chan text cc_what} {
global cc_clc_flag cc_msgtype cc_clc_note cc_clc_bantime1 cc_clc_bantime2 cc_clc_text
  if {[lsearch -exact [channel info $chan] +colourcontrol] == -1} { return 0 }
  if {[matchattr [nick2hand $nick $chan] $cc_clc_flag $chan]} { return 0 }
  if {[ispermown [nick2hand $nick $chan]]} { return 0 }
  if {$cc_what == "part"} {
    if {[getuser $hand xtra cc_clc_part] == "3"} {
      # check if user is on level 3 (fourth warning - long ban)
      set i 0
      foreach hmask [getuser $hand hosts] {
        newchanban $chan $hmask ChanCtrl "Colour Use - [ctime [unixtime]]" $cc_clc_bantime2
        incr i
      }
      foreach recipent $cc_clc_note {
        if {[validuser $recipent]} {
          sendnote ChanCtrl $recipient "$hand was banned with $i hostmask(s) on $chan due to colour abuse"
        }
      }
      puthelp "$cc_msgtype $nick :[lindex $cc_clc_text 3]"
      putlog "ChanCtrl: $hand has used colour in $chan. Holding part status on level 3."
      return 1
    } elseif {[getuser $hand xtra cc_clc_part] == "2"} {
      # check if user is on level 2 (third warning - short ban)
      set i 0
      foreach hmask [getuser $hand hosts] {
        newchanban $chan $hmask ChanCtrl "Colour Use - [ctime [unixtime]]" $cc_clc_bantime1
        incr i
      }
      foreach recipent $cc_clc_note {
        if {[validuser $recipent]} {
          sendnote ChanCtrl $recipient "$hand was banned with $i hostmask(s) on $chan due to colour abuse"
        }
      }
      puthelp "$cc_msgtype $nick :[lindex $cc_clc_text 2]"
      setuser $hand xtra cc_clc_part "3"
      putlog "ChanCtrl: $hand has used colour in $chan. Raising part status to level 3."
      return 1
    } elseif {[getuser $hand xtra cc_clc_part] == "1"} {
      # check if user is on level 1 (second warning - no action)
      puthelp "$cc_msgtype $nick :[lindex $cc_clc_text 1]"
      setuser $hand xtra cc_clc_part "2"
      putlog "ChanCtrl: $hand has used colour in $chan. Raising part status to level 2."
      return 1
    } else {
      # no record yet (first warning - no action)
      if {![validuser $nick]} {
        putlog "ChanCtrl: added $nick with [maskhost $uhost] for part colour"
        adduser $nick [maskhost $uhost]
        setuser $nick comment "Added by ChanCtrl - [ctime [unixtime]]"
      }
      puthelp "$cc_msgtype $nick :[lindex $cc_clc_text 0]"
      setuser $nick xtra cc_clc_part "1"
      putlog "ChanCtrl: $nick has used colour in $chan. Raising part status to level 1."
      return 1
    }
  } elseif {$cc_what == "pubm"} {
    if {[getuser $hand xtra cc_clc_pubm] == "3"} {
      # check if user is on level 3 (fourth warning - long ban)
      set i 0
      putkick $chan $nick "Colour Use"
      foreach hmask [getuser $hand hosts] {
        newchanban $chan $hmask ChanCtrl "Colour Use - [ctime [unixtime]]" $cc_clc_bantime2
        incr i
      }
      foreach recipent $cc_clc_note {
        if {[validuser $recipent]} {
          sendnote ChanCtrl $recipient "$hand was banned with $i hostmask(s) on $chan due to colour abuse"
        }
      }
      puthelp "$cc_msgtype $nick :[lindex $cc_clc_text 7]"
      putlog "ChanCtrl: $hand has used colour in $chan. Holding public status on level 3."
      return 1
    } elseif {[getuser $hand xtra cc_clc_pubm] == "2"} {
      # check if user is on level 2 (third warning - short ban)
      set i 0
      putkick $chan $nick "Colour Use - banned for $cc_clc_bantime1 minutes"
      foreach hmask [getuser $hand hosts] {
        newchanban $chan $hmask ChanCtrl "Colour Use - [ctime [unixtime]]" $cc_clc_bantime1
        incr i
      }
      foreach recipent $cc_clc_note {
        if {[validuser $recipent]} {
          sendnote ChanCtrl $recipient "$hand was banned with $i hostmask(s) on $chan due to colour abuse"
        }
      }
      puthelp "$cc_msgtype $nick :[lindex $cc_clc_text 6]"
      setuser $hand xtra cc_clc_pubm "3"
      putlog "ChanCtrl: $hand has used colour in $chan. Raising public status to level 3."
      return 1
    } elseif {[getuser $hand xtra cc_clc_pubm] == "1"} {
      # check if user is on level 1 (second warning - kick)
      puthelp "$cc_msgtype $nick :[lindex $cc_clc_text 5]"
      putkick $chan $nick "Colour Use"
      setuser $hand xtra cc_clc_pubm "2"
      putlog "ChanCtrl: $hand has used colour in $chan. Raising public status to level 2."
      return 1
    } else {
      # no record yet (first warning - no action)
      if {![validuser $nick]} {
        putlog "ChanCtrl: added $nick with [maskhost $uhost] for public colour"
        adduser $nick [maskhost $uhost]
        setuser $nick comment "Added by ChanCtrl - [ctime [unixtime]]"
      }
      puthelp "$cc_msgtype $nick :[lindex $cc_clc_text 4]"
      setuser $nick xtra cc_clc_pubm "1"
      putlog "ChanCtrl: $nick has used colour in $chan. Raising public status to level 1."
      return 1
    }
  } elseif {$cc_what == "quit"} {
    if {[getuser $hand xtra cc_clc_quit] == "3"} {
      # check if user is on level 3 (fourth warning - long ban)
      set i 0
      foreach hmask [getuser $hand hosts] {
        newchanban $chan $hmask ChanCtrl "Colour Use - [ctime [unixtime]]" $cc_clc_bantime2
        incr i
      }
      foreach recipent $cc_clc_note {
        if {[validuser $recipent]} {
          sendnote ChanCtrl $recipient "$hand was banned with $i hostmask(s) on $chan due to colour abuse"
        }
      }
      sendnote ChanCtrl $hand [lindex $cc_clc_text 11]
      putlog "ChanCtrl: $hand has used colour in $chan. Holding quit status on level 3."
      return 1
    } elseif {[getuser $hand xtra cc_clc_quit] == "2"} {
      # check if user is on level 2 (third warning - short ban)
      set i 0
      foreach hmask [getuser $hand hosts] {
        newchanban $chan $hmask ChanCtrl "Colour Use - [ctime [unixtime]]" $cc_clc_bantime1
        incr i
      }
      foreach recipent $cc_clc_note {
        if {[validuser $recipent]} {
          sendnote ChanCtrl $recipient "$hand was banned with $i hostmask(s) on $chan due to colour abuse"
        }
      }
      sendnote ChanCtrl $hand [lindex $cc_clc_text 10]
      setuser $hand xtra cc_clc_quit "3"
      putlog "ChanCtrl: $hand has used colour in $chan. Raising quit status to level 3."
      return 1
    } elseif {[getuser $hand xtra cc_clc_quit] == "1"} {
      # check if user is on level 1 (second warning - no action)
      sendnote ChanCtrl $hand [lindex $cc_clc_text 9]
      setuser $hand xtra cc_clc_quit "2"
      putlog "ChanCtrl: $nick has used colour in $chan. Raising quit status to level 2."
      return 1
    } else {
      # no record yet (first warning - no action)
      if {![validuser $nick]} {
        putlog "ChanCtrl: added $nick with [maskhost $uhost] for colour quit"
        adduser $nick [maskhost $uhost]
        setuser $nick comment "Added by ChanCtrl - [ctime [unixtime]]"
      }
      sendnote ChanCtrl $hand [lindex $cc_clc_text 8]
      setuser $nick xtra cc_clc_quit "1"
      putlog "ChanCtrl: $nick has used colour in $chan. Raising quit status to level 1."
      return 1
    }
  }
}

# noautorejoin.tcl, v1.34.0, 26.05.2000

setudef flag noautorejoin

if {$cc_nar_chans == ""} {
  set cc_nar_chans [channels]
} elseif {$cc_nar_chans == "none"} {
  set cc_nar_chans ""
}

foreach chan $cc_nar_chans {
  channel set $chan +noautorejoin
}

foreach chan $cc_nar_echans {
  channel set $chan -noautorejoin
}

proc cc_nar_kick {nick uhost hand chan kicked reason} {
global cc_nar_flag cc_nar_seconds 
  if {[lsearch -exact [channel info $chan] +noautorejoin] == -1} { return 0 }
  if {[matchattr [nick2hand $kicked $chan] $cc_nar_flag $chan]} { return 0 }
  if {[ispermown [nick2hand $kicked $chan]]} { return 0 }
  if {[matchattr [nick2hand $kicked $chan] b]} { return 0 }
  utimer $cc_nar_seconds "cc_nar_ison $kicked $chan"
  return 0
}

proc cc_nar_ison {nick chan} {
  global cc_msgtype cc_nar_bantime cc_nar_bantype cc_nar_msg
  if {![botisop $chan] || ![onchan $nick $chan]} { return 0 }
  putkick $chan $nick "$cc_nar_msg"
  if {$cc_nar_bantype == "0"} {
    newchanban $chan $nick!*@* ChanCtrl "Auto-Rejoin - [ctime [unixtime]]" $cc_nar_bantime
  } elseif {$cc_nar_bantype == "1"} {
    newchanban $chan [maskhost [getchanhost $nick]] ChanCtrl "Auto-Rejoin - [ctime [unixtime]]" $cc_nar_bantime
  } elseif {$cc_nar_bantype == "2"} {
    newchanban $chan *![getchanhost $nick] ChanCtrl "Auto-Rejoin - [ctime [unixtime]]" $cc_nar_bantime
  }
}


# nochanhopper.tcl, v1.01.0, 26.5.2000

setudef flag nochanhopper

if {$cc_nch_chans == ""} {
  set cc_nch_chans [channels]
} elseif {$cc_nch_chans == "none"} {
  set cc_nch_chans ""
}

foreach chan $cc_nch_chans {
  channel set $chan +nochanhopper
}

foreach chan $cc_nch_echans {
  channel set $chan -nochanhopper
}

proc cc_nch_join {nick uhost hand chan} {
global cc_nar_flag cc_nch_seconds 
  if {[lsearch -exact [channel info $chan] +nochanhopper] == -1} { return 0 }
  if {[matchattr [nick2hand $nick $chan] $cc_nar_flag $chan]} { return 0 }
  if {[ispermown [nick2hand $nick $chan]]} { return 0 }
  utimer $cc_nch_seconds "cc_nch_ison $nick $uhost $hand $chan"
  return 0
}

proc cc_nch_ison {nick uhost hand chan} {
global cc_msgtype cc_nch_bantime1 cc_nch_bantime2 cc_nch_msg1 cc_nch_msg2 cc_nch_msg3
  if {[onchan $nick $chan]} { return 0 }
  if {![validuser $nick]} {
    adduser $nick [maskhost $uhost]
    putlog "ChanCtrl (Channel Hopper): added user $nick ([maskhost $uhost])"
    setuser $nick comment "Added by ChanCtrl.tcl (nochanhopper) - [ctime [unixtime]]"
    setuser $nick xtra cc_nch "1"
  }
  if {[getuser $hand xtra cc_nch] == "1"} {
    puthelp "$cc_msgtype $nick :$cc_nch_msg1"
    setuser $nick xtra cc_nch "2"
  } elseif {[getuser $hand xtra cc_nch] == "2"} {
    puthelp "$cc_msgtype $nick :$cc_nch_msg2"
    setuser $nick xtra cc_nch "3"
    newchanban $chan [maskhost $uhost] ChanCtrl "Channel Hopper - [ctime [unixtime]]" $cc_nch_bantime1
  } elseif {[getuser $hand xtra cc_nch] == "3"} {
    puthelp "$cc_msgtype $nick :$cc_nch_msg3"
    newchanban $chan [maskhost $uhost] ChanCtrl "Channel Hopper - [ctime [unixtime]]" $cc_nch_bantime2
  }
}

bind part - * cc_clc_part
bind pubm - * cc_clc_pubm
bind ctcp - ACTION cc_clc_action
bind sign - * cc_clc_quit

if {!$cc_clc_part} {
  unbind part - * cc_clc_part
}

if {!$cc_clc_pubm} {
  unbind pubm - * cc_clc_pubm
  unbind ctcp - ACTION cc_clc_action
}

if {!$cc_clc_quit} {
  unbind sign - * cc_clc_quit
}

if {!$cc_colourcontrol} {
  if {$cc_clc_part} {
    unbind part - * cc_clc_part
  }
  if {$cc_clc_pubm} {
    unbind pubm - * cc_clc_pubm
    unbind ctcp - ACTION cc_clc_action
  }
  if {$cc_clc_quit} {
    unbind sign - * cc_clc_quit
  }
}

bind kick - * cc_nar_kick
if {!$cc_noautorejoin} {
  unbind kick - * cc_nar_kick
}

bind join - * cc_nch_join
if {!$cc_nochanhopper} {
  unbind join - * cc_nch_join
}
User avatar
FiRe
Voice
Posts: 18
Joined: Mon Jan 19, 2004 6:40 am

Post by FiRe »

No one? :<
g
greenbear
Owner
Posts: 733
Joined: Mon Sep 24, 2001 8:00 pm
Location: Norway

Post by greenbear »

Sorry if im stating the obvious, but did you set your channel +colourcontrol ?

Code: Select all

.chanset #channel +colourcontrol
User avatar
FiRe
Voice
Posts: 18
Joined: Mon Jan 19, 2004 6:40 am

Post by FiRe »

Yeah, I did :\
Locked