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.

chanctrl.tcl (netbots component) not working :(

Old posts that have not been replied to for several years.
Locked
M
Mentolboy

Post by Mentolboy »

hi!
i just downloaded chanctrl.tcl from egghelp.org (<a href="http://www.egghelp.org/tclarchive/chanc ... r.gz">this is the url</a>) and i added the script to my netbots because it is a netbots component.

i now get the following error:

Code: Select all

[20:46] TCL error in file 'testbot':
[20:46] can't read "cc_part": no such variable
    while executing
"if {!$cc_part} {
  unbind part - * cc_part
}"
    (file "scripts/chanctrl.tcl" line 273)
    invoked from within
"source scripts/chanctrl.tcl"
    (file "testbot" line 30)
[20:46] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)
in my netset.tcl, i've put the following:

Code: Select all

# chanctrl.tcl settings
set nb_component(chanctrl) 1
can somebody help me?

for those who are not able to download the script, here is the code:

Code: Select all

proc cc_check {text} {
  if {regexp -- [[1code]
proc cc_check {text} {
  if {regexp -- [03] $text} { 
    return 1
  } else {
    return 0
  }
}

proc cc_part {nick uhost hand chan text} {
global cc_chans cc_echans cc_flag
  if {[matchattr $hand $cc_flag|$cc_flag $chan]} { return 0 }
  if {$cc_chans != ""} {
    if {![lsearch -exact $cc_chans [string tolower $chan]] == -1} { return 0 }
  }
  if {$cc_echans != ""} {
    if {![lsearch -exact $cc_echans [string tolower $chan]] != -1} { return 0 }
  }
  if {[cc_check $text]} {
    set cc_what "part"
    cc_core $nick $uhost $hand $chan $text $cc_what
  }
}

proc cc_pubm {nick uhost hand chan text} {
global cc_chans cc_echans cc_flag
  if {[matchattr $hand $cc_flag|$cc_flag $chan]} { return 0 }
  if {$cc_chans != ""} {
    if {![lsearch -exact $cc_chans [string tolower $chan]] == -1} { return 0 }
  }
  if {$cc_echans != ""} {
    if {![lsearch -exact $cc_echans [string tolower $chan]] != -1} { return 0 }
  }
  if {[cc_check $text]} {
    set cc_what "pubm"
    cc_core $nick $uhost $hand $chan $text $cc_what
  }
}

proc cc_action {nick uhost hand chan keyword text} {
global cc_chans cc_echans cc_flag
  if {[matchattr $hand $cc_flag|$cc_flag $chan]} { return 0 }
  if {$cc_chans != ""} {
    if {![lsearch -exact $cc_chans [string tolower $chan]] == -1} { return 0 }
  }
  if {$cc_echans != ""} {
    if {![lsearch -exact $cc_echans [string tolower $chan]] != -1} { return 0 }
  }
  if {[cc_check $text]} {
    set cc_what "pubm"
    cc_core $nick $uhost $hand $chan $text $cc_what
  }
}


proc cc_quit {nick uhost hand chan text} {
global cc_chans cc_echans cc_flag
  if {[matchattr $hand $cc_flag|$cc_flag $chan]} { return 0 }
  if {$cc_chans != ""} {
    if {![lsearch -exact $cc_chans [string tolower $chan]] == -1} { return 0 }
  }
  if {$cc_echans != ""} {
    if {![lsearch -exact $cc_echans [string tolower $chan]] != -1} { return 0 }
  }
  if {[cc_check $text]} {
    set cc_what "quit"
    cc_core $nick $uhost $hand $chan $text $cc_what
  }
}

proc cc_core {nick uhost hand chan text cc_what} {
global cc_longban cc_note cc_shortban 
global cc_txt_part1 cc_txt_part2 cc_txt_part3 cc_txt_part4
global cc_txt_pubm1 cc_txt_pubm2 cc_txt_pubm3 cc_txt_pubm4
global cc_txt_quit1 cc_txt_quit2 cc_txt_quit3 cc_txt_quit4
  if {$cc_what == "part"} {
    if {[getuser $hand xtra part_color] == "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_longban
        incr i
      }
      foreach recipient $cc_note {
        if {[validuser $recipient]} {
          sendnote ChanCtrl $recipient "$hand was banned with $i hostmask(s) on $chan due to colour use"
        }
      }
      unset i
      foreach tmp $cc_txt_part4 {
        puthelp "PRIVMSG $nick :$tmp"
      }
      putlog "ChanCtrl: $hand has used colour in $chan. Holding status on level 3."
      return 1
    } elseif {[getuser $hand xtra part_color] == "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_shortban
        incr i
      }
      foreach recipient $cc_note {
        if {[validuser $recipient]} {
          sendnote ChanCtrl $recipient "$hand was banned with $i hostmask(s) on $chan due to colour use"
        }
      }
      unset i
      foreach tmp $cc_txt_part3 {
        puthelp "PRIVMSG $nick :$tmp"
      }
      setuser $hand xtra part_color "3"
      putlog "ChanCtrl: $hand has used colour in $chan. Raising status to level 3."
      return 1
    } elseif {[getuser $hand xtra part_color] == "1"} {
      # check if user is on level 1 (second warning - no action)
      foreach tmp $cc_txt_part2 {
        puthelp "PRIVMSG $nick :$tmp"
      }
      setuser $hand xtra part_color "2"
      putlog "ChanCtrl: $hand has used colour in $chan. Raising 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]]"
      }
      foreach tmp $cc_txt_part1 {
        puthelp "PRIVMSG $nick :$tmp"
      }
      setuser $nick xtra part_color "1"
      putlog "ChanCtrl: $nick has used colour in $chan. Raising status to level 1."
      return 1
    }
  } elseif {$cc_what == "pubm"} {
    if {[getuser $hand xtra pubm_color] == "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_longban
        incr i
      }
      foreach recipient $cc_note {
        if {[validuser $recipient]} {
          sendnote ChanCtrl $recipient "$hand was banned with $i hostmask(s) on $chan due to colour use"
        }
      }
      unset i
      foreach tmp $cc_txt_pubm4 {
        puthelp "PRIVMSG $nick :$tmp"
      }
      putlog "ChanCtrl: $hand has used colour in $chan. Holding status on level 3."
      return 1
    } elseif {[getuser $hand xtra pubm_color] == "2"} {
      # check if user is on level 2 (third warning - short ban)
      set i 0
      putkick $chan $nick "Colour Use - banned for $cc_shortban minutes"
      foreach hmask [getuser $hand hosts] {
        newchanban $chan $hmask ChanCtrl "Colour Use - [ctime [unixtime]]" $cc_shortban
        incr i
      }
      foreach recipient $cc_note {
        if {[validuser $recipient]} {
          sendnote ChanCtrl $recipient "$hand was banned with $i hostmask(s) on $chan due to colour use"
        }
      }
      unset i
      foreach tmp $cc_txt_pubm3 {
        puthelp "PRIVMSG $nick :$tmp"
      }
      setuser $hand xtra pubm_color "3"
      putlog "ChanCtrl: $hand has used colour in $chan. Raising status to level 3."
      return 1
    } elseif {[getuser $hand xtra pubm_color] == "1"} {
      # check if user is on level 1 (second warning - kick)
      foreach tmp $cc_txt_pubm2 {
        puthelp "PRIVMSG $nick :$tmp"
      }
      putkick $chan $nick "Colour Use"
      setuser $hand xtra pubm_color "2"
      putlog "ChanCtrl: $hand has used colour in $chan. Raising 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]]"
      }
      foreach tmp $cc_txt_pubm1 {
        puthelp "PRIVMSG $nick :$tmp"
      }
      setuser $nick xtra pubm_color "1"
      putlog "ChanCtrl: $nick has used colour in $chan. Raising status to level 1."
      return 1
    }
  } elseif {$cc_what == "quit"} {
    if {[getuser $hand xtra quit_color] == "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_longban
        incr i
      }
      foreach recipient $cc_note {
        if {[validuser $recipient]} {
          sendnote ChanCtrl $recipient "$hand was banned with $i hostmask(s) on $chan due to colour use"
        }
      }
      unset i
      sendnote ChanCtrl $hand $cc_txt_quit4
      putlog "ChanCtrl: $hand has used colour in $chan. Holding status on level 3."
      return 1
    } elseif {[getuser $hand xtra quit_color] == "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_shortban
        incr i
      }
      foreach recipient $cc_note {
        if {[validuser $recipient]} {
          sendnote ChanCtrl $recipient "$hand was banned with $i hostmask(s) on $chan due to colour use"
        }
      }
      unset i
      sendnote ChanCtrl $hand $cc_txt_quit3
      setuser $hand xtra quit_color "3"
      putlog "ChanCtrl: $hand has used colour in $chan. Raising status to level 3."
      return 1
    } elseif {[getuser $hand xtra quit_color] == "1"} {
      # check if user is on level 1 (second warning - no action)
      sendnote ChanCtrl $hand $cc_txt_quit2
      setuser $hand xtra quit_color "2"
      putlog "ChanCtrl: $nick has used colour in $chan. Raising 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 $cc_txt_quit1
      setuser $nick xtra quit_color "1"
      putlog "ChanCtrl: $nick has used colour in $chan. Raising status to level 1."
      return 1
    }
  }
}

bind part - * cc_part
if {!$cc_part} {
  unbind part - * cc_part
}

bind pubm - * cc_pubm
bind ctcp - ACTION cc_action
if {!$cc_pubm} {
  unbind pubm - * cc_pubm
  unbind ctcp - ACTION cc_action
}

bind sign - * cc_quit
if {!$cc_quit} {
  unbind sign - * cc_quit
}
[/code1]03] $text} { 
    return 1
  } else {
    return 0
  }
}

proc cc_part {nick uhost hand chan text} {
global cc_chans cc_echans cc_flag
  if {[matchattr $hand $cc_flag|$cc_flag $chan]} { return 0 }
  if {$cc_chans != ""} {
    if {![lsearch -exact $cc_chans [string tolower $chan]] == -1} { return 0 }
  }
  if {$cc_echans != ""} {
    if {![lsearch -exact $cc_echans [string tolower $chan]] != -1} { return 0 }
  }
  if {[cc_check $text]} {
    set cc_what "part"
    cc_core $nick $uhost $hand $chan $text $cc_what
  }
}

proc cc_pubm {nick uhost hand chan text} {
global cc_chans cc_echans cc_flag
  if {[matchattr $hand $cc_flag|$cc_flag $chan]} { return 0 }
  if {$cc_chans != ""} {
    if {![lsearch -exact $cc_chans [string tolower $chan]] == -1} { return 0 }
  }
  if {$cc_echans != ""} {
    if {![lsearch -exact $cc_echans [string tolower $chan]] != -1} { return 0 }
  }
  if {[cc_check $text]} {
    set cc_what "pubm"
    cc_core $nick $uhost $hand $chan $text $cc_what
  }
}

proc cc_action {nick uhost hand chan keyword text} {
global cc_chans cc_echans cc_flag
  if {[matchattr $hand $cc_flag|$cc_flag $chan]} { return 0 }
  if {$cc_chans != ""} {
    if {![lsearch -exact $cc_chans [string tolower $chan]] == -1} { return 0 }
  }
  if {$cc_echans != ""} {
    if {![lsearch -exact $cc_echans [string tolower $chan]] != -1} { return 0 }
  }
  if {[cc_check $text]} {
    set cc_what "pubm"
    cc_core $nick $uhost $hand $chan $text $cc_what
  }
}


proc cc_quit {nick uhost hand chan text} {
global cc_chans cc_echans cc_flag
  if {[matchattr $hand $cc_flag|$cc_flag $chan]} { return 0 }
  if {$cc_chans != ""} {
    if {![lsearch -exact $cc_chans [string tolower $chan]] == -1} { return 0 }
  }
  if {$cc_echans != ""} {
    if {![lsearch -exact $cc_echans [string tolower $chan]] != -1} { return 0 }
  }
  if {[cc_check $text]} {
    set cc_what "quit"
    cc_core $nick $uhost $hand $chan $text $cc_what
  }
}

proc cc_core {nick uhost hand chan text cc_what} {
global cc_longban cc_note cc_shortban 
global cc_txt_part1 cc_txt_part2 cc_txt_part3 cc_txt_part4
global cc_txt_pubm1 cc_txt_pubm2 cc_txt_pubm3 cc_txt_pubm4
global cc_txt_quit1 cc_txt_quit2 cc_txt_quit3 cc_txt_quit4
  if {$cc_what == "part"} {
    if {[getuser $hand xtra part_color] == "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_longban
        incr i
      }
      foreach recipient $cc_note {
        if {[validuser $recipient]} {
          sendnote ChanCtrl $recipient "$hand was banned with $i hostmask(s) on $chan due to colour use"
        }
      }
      unset i
      foreach tmp $cc_txt_part4 {
        puthelp "PRIVMSG $nick :$tmp"
      }
      putlog "ChanCtrl: $hand has used colour in $chan. Holding status on level 3."
      return 1
    } elseif {[getuser $hand xtra part_color] == "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_shortban
        incr i
      }
      foreach recipient $cc_note {
        if {[validuser $recipient]} {
          sendnote ChanCtrl $recipient "$hand was banned with $i hostmask(s) on $chan due to colour use"
        }
      }
      unset i
      foreach tmp $cc_txt_part3 {
        puthelp "PRIVMSG $nick :$tmp"
      }
      setuser $hand xtra part_color "3"
      putlog "ChanCtrl: $hand has used colour in $chan. Raising status to level 3."
      return 1
    } elseif {[getuser $hand xtra part_color] == "1"} {
      # check if user is on level 1 (second warning - no action)
      foreach tmp $cc_txt_part2 {
        puthelp "PRIVMSG $nick :$tmp"
      }
      setuser $hand xtra part_color "2"
      putlog "ChanCtrl: $hand has used colour in $chan. Raising 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]]"
      }
      foreach tmp $cc_txt_part1 {
        puthelp "PRIVMSG $nick :$tmp"
      }
      setuser $nick xtra part_color "1"
      putlog "ChanCtrl: $nick has used colour in $chan. Raising status to level 1."
      return 1
    }
  } elseif {$cc_what == "pubm"} {
    if {[getuser $hand xtra pubm_color] == "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_longban
        incr i
      }
      foreach recipient $cc_note {
        if {[validuser $recipient]} {
          sendnote ChanCtrl $recipient "$hand was banned with $i hostmask(s) on $chan due to colour use"
        }
      }
      unset i
      foreach tmp $cc_txt_pubm4 {
        puthelp "PRIVMSG $nick :$tmp"
      }
      putlog "ChanCtrl: $hand has used colour in $chan. Holding status on level 3."
      return 1
    } elseif {[getuser $hand xtra pubm_color] == "2"} {
      # check if user is on level 2 (third warning - short ban)
      set i 0
      putkick $chan $nick "Colour Use - banned for $cc_shortban minutes"
      foreach hmask [getuser $hand hosts] {
        newchanban $chan $hmask ChanCtrl "Colour Use - [ctime [unixtime]]" $cc_shortban
        incr i
      }
      foreach recipient $cc_note {
        if {[validuser $recipient]} {
          sendnote ChanCtrl $recipient "$hand was banned with $i hostmask(s) on $chan due to colour use"
        }
      }
      unset i
      foreach tmp $cc_txt_pubm3 {
        puthelp "PRIVMSG $nick :$tmp"
      }
      setuser $hand xtra pubm_color "3"
      putlog "ChanCtrl: $hand has used colour in $chan. Raising status to level 3."
      return 1
    } elseif {[getuser $hand xtra pubm_color] == "1"} {
      # check if user is on level 1 (second warning - kick)
      foreach tmp $cc_txt_pubm2 {
        puthelp "PRIVMSG $nick :$tmp"
      }
      putkick $chan $nick "Colour Use"
      setuser $hand xtra pubm_color "2"
      putlog "ChanCtrl: $hand has used colour in $chan. Raising 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]]"
      }
      foreach tmp $cc_txt_pubm1 {
        puthelp "PRIVMSG $nick :$tmp"
      }
      setuser $nick xtra pubm_color "1"
      putlog "ChanCtrl: $nick has used colour in $chan. Raising status to level 1."
      return 1
    }
  } elseif {$cc_what == "quit"} {
    if {[getuser $hand xtra quit_color] == "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_longban
        incr i
      }
      foreach recipient $cc_note {
        if {[validuser $recipient]} {
          sendnote ChanCtrl $recipient "$hand was banned with $i hostmask(s) on $chan due to colour use"
        }
      }
      unset i
      sendnote ChanCtrl $hand $cc_txt_quit4
      putlog "ChanCtrl: $hand has used colour in $chan. Holding status on level 3."
      return 1
    } elseif {[getuser $hand xtra quit_color] == "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_shortban
        incr i
      }
      foreach recipient $cc_note {
        if {[validuser $recipient]} {
          sendnote ChanCtrl $recipient "$hand was banned with $i hostmask(s) on $chan due to colour use"
        }
      }
      unset i
      sendnote ChanCtrl $hand $cc_txt_quit3
      setuser $hand xtra quit_color "3"
      putlog "ChanCtrl: $hand has used colour in $chan. Raising status to level 3."
      return 1
    } elseif {[getuser $hand xtra quit_color] == "1"} {
      # check if user is on level 1 (second warning - no action)
      sendnote ChanCtrl $hand $cc_txt_quit2
      setuser $hand xtra quit_color "2"
      putlog "ChanCtrl: $nick has used colour in $chan. Raising 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 $cc_txt_quit1
      setuser $nick xtra quit_color "1"
      putlog "ChanCtrl: $nick has used colour in $chan. Raising status to level 1."
      return 1
    }
  }
}

bind part - * cc_part
if {!$cc_part} {
  unbind part - * cc_part
}

bind pubm - * cc_pubm
bind ctcp - ACTION cc_action
if {!$cc_pubm} {
  unbind pubm - * cc_pubm
  unbind ctcp - ACTION cc_action
}

bind sign - * cc_quit
if {!$cc_quit} {
  unbind sign - * cc_quit
}

<font size=-1>[ This Message was edited by: Mentolboy on 2001-12-21 15:01 ]</font>
P
Pat
Voice
Posts: 5
Joined: Mon Sep 24, 2001 8:00 pm
Contact:

Post by Pat »

You should probably look through the readme file again. There are a whole bunch of settings you need to put in netset.tcl besides just loading the script.

Pat
M
Mentolboy

Post by Mentolboy »

stupid me, why didn't i see that myself :smile:
tnx :smile:
Locked