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.

TCL error

Old posts that have not been replied to for several years.
Locked
P
Pitchat
Op
Posts: 122
Joined: Tue Feb 18, 2003 11:24 pm
Location: Hebertville Quebec Canada
Contact:

TCL error

Post by Pitchat »

Hi i have the spy.tcl script and when people join or part channel i got that error :

[22:37] Tcl error [spy:part]: wrong # args: should be "spy:part nick uhost hand channel"
i look but i do not figure what is wrong

heres the code

Code: Select all

# Spy v1.1

# *Description:
#  Mouchard qui rapporte tout ce qui se passe sur un channel, notices, querys
#  et party-line (attention aux Excess Flood possibles).

# *Commandes:
#  -pub: !spy <on/off>

#####################################################################
## Configuration du Script ##########################################
#####################################################################

# Channels à espionnes :
set spy(record) "#aide-moi.net"

# Channels où moucharder :
set spy(chans) "#pitchat"

# Activer le mode Spy (0=non, 1=oui) :
set spy(active) 1

# Préfixe des commandes du Bot :
set spy(command) "!"

# Anti flood sur les commandes du Bot x:y (x=nombre de fois, y=secondes) :
set spy(flood) 5:10

# Ignorer l'utilisateur après son flood (0=non, 1=oui) :
set spy(ignore) 1

# Si oui, combien de temps (en minutes) :
set spy(ignoretime) 1

# Laisser faire les utilisateurs ayant certains flags :
set spy(ignflags) "fmnov|fmnov"

#####################################################################
#####################################################################
#####################################################################

proc spy:flood:init {} {
global spy spyflood
set spy(floodnum) [lindex [split $spy(flood) :] 0]
set spy(floodtime) [lindex [split $spy(flood) :] 1]
set i [expr $spy(floodnum) - 1]
while {$i >= 0} {
   set spyflood($i) 0
   incr i -1
}
}
spy:flood:init

proc spy:flood {nick uhost} {
global spy spyflood botnick
if {$spy(floodnum) == 0} {
   return 0
}
set i [expr $spy(floodnum) - 1]
while {$i >= 1} {
   set spyflood($i) $spyflood([expr $i - 1])
   incr i -1
}
set spyflood(0) [unixtime]
if {[expr [unixtime] - $spyflood([expr $spy(floodnum) - 1])] <= $spy(floodtime)} {
   if {$spy(ignore)} {
      newignore [join [maskhost *!*[string trimleft $uhost ~]]] $botnick "Flood" $spy(ignoretime)
   }
   return 1
} {
   return 0
}
}

bind pub mno|mno $spy(command)spy spy:command
proc spy:command {nick uhost hand channel arg} {
global spy
if ![matchattr $nick $spy(ignflags) $channel] {
   if {[spy:flood $nick $uhost]} {
      return 0
   }
}
set mode [lindex $arg 0]
if ![string length $mode] {
   puthelp "NOTICE $nick :Usage: !spy <on\/off>"
   return 0
} elseif {$mode == "on"} {
   if {([lsearch -exact [string tolower $spy(record)] [string tolower $channel]] != -1) || ($spy(record) == "*")} {
      puthelp "NOTICE $nick :Mode Spy déjà activé sur $channel."
      return 0
   } else {
      append spy(record) " $channel"
      puthelp "NOTICE $nick :Mode Spy activé sur $channel."
      bind join -|- * spy:join
      bind part -|- * spy:part
      bind ctcp -|- ACTION spy:ctcp
      bind mode -|- * spy:modefixed
      bind topc -|- * spy:topc
      bind sign -|- * spy:sign
      bind kick -|- * spy:kick
      bind nick -|- * spy:nick
      bind pubm -|- * spy:pub
      bind msgm -|- * spy:msg
      bind notc -|- * spy:notice
      return 1
   }
} elseif {$mode == "off"} {
   if {([lsearch -exact [string tolower $spy(record)] [string tolower $channel]] == -1) && ($spy(record) != "*")} {
      puthelp "NOTICE $nick :Mode Spy déjà désactivé sur $channel."
      return 0
   } else {
      regsub -- $channel $spy(record) "" spy(record)
      puthelp "NOTICE $nick :Mode Spy désactivé sur $channel."
      return 1
   }
} else {
   puthelp "NOTICE $nick :Usage: !spy <on\/off>"
   return 0
}
}

if $spy(active) {
   bind join -|- * spy:join
   bind part -|- * spy:part
   bind ctcp -|- ACTION spy:ctcp
   bind mode -|- * spy:modefixed
   bind topc -|- * spy:topc
   bind sign -|- * spy:sign
   bind kick -|- * spy:kick
   bind nick -|- * spy:nick
   bind pubm -|- * spy:pub
   bind msgm -|- * spy:msg
   bind notc -|- * spy:notice
}

proc spy:join {nick uhost hand channel} {
global spy
if {([lsearch -exact [string tolower $spy(record)] [string tolower $channel]] != -1) || ($spy(record) == "*")} {
   foreach chan $spy(chans) {
      puthelp "PRIVMSG $chan :\[12$channel\] 9$nick ($uhost) has joined $channel"
   }
   return 1
}
}

proc spy:part {nick uhost hand channel} {
global spy
if {([lsearch -exact [string tolower $spy(record)] [string tolower $channel]] != -1) || ($spy(record) == "*")} {
   foreach chan $spy(chans) {
      puthelp "PRIVMSG $chan :\[12$channel\] 9$nick ($uhost) has left $channel"
   }
   return 1
}
}

proc spy:ctcp {nick uhost hand dest keyword arg} {
global spy
if {([lsearch -exact [string tolower $spy(record)] [string tolower $dest]] != -1) || ($spy(record) == "*")} {
   foreach chan $spy(chans) {
      puthelp "PRIVMSG $chan :\[12$dest\] 13* $nick $arg"
   }
   return 1
}
}

proc spy:modefixed {nick uhost hand channel mode {victim ""}} {
global spy
if {$victim != ""} { append mode " $victim" }
spy:mode $nick $uhost $hand $channel $mode
}

proc spy:mode {nick uhost hand channel mode} {
global spy server
if {([lsearch -exact [string tolower $spy(record)] [string tolower $channel]] != -1) || ($spy(record) == "*")} {
   foreach chan $spy(chans) {
      if {$nick == ""} {
         puthelp "PRIVMSG $chan :\[12$channel\] 9*** [lindex [split $server :] 0] sets mode: $mode"
      } else {
         puthelp "PRIVMSG $chan :\[12$channel\] 9*** $nick sets mode: $mode"
      }
   }
   return 1
}
}

proc spy:topc {nick uhost hand channel topic} {
global spy server
if {([lsearch -exact [string tolower $spy(record)] [string tolower $channel]] != -1) || ($spy(record) == "*")} {
   foreach chan $spy(chans) {
      if {$nick == ""} {
         puthelp "PRIVMSG $chan :\[12$channel\] 9*** [lindex [split $server :] 0] changes topic to '$topic'"
      } else {
         puthelp "PRIVMSG $chan :\[12$channel\] 9$nick changes topic to '$topic'"
      }
   }
   return 1
}
}

proc spy:sign {nick uhost hand channel reason} {
global spy
if {([lsearch -exact [string tolower $spy(record)] [string tolower $channel]] != -1) || ($spy(record) == "*")} {
   foreach chan $spy(chans) {
      puthelp "PRIVMSG $chan :\[12$channel\] 9$nick ($uhost) has quit IRC ($reason)"
   }
   return 1
}
}

proc spy:kick {nick uhost hand channel knick reason} {
global spy
foreach chan $spy(chans) {
   puthelp "PRIVMSG $chan :\[12$channel\] 9$knick was kicked by $nick ($reason)"
}
return 1
}

proc spy:nick {nick uhost hand channel newnick} {
global spy
if {([lsearch -exact [string tolower $spy(record)] [string tolower $channel]] != -1) || ($spy(record) == "*")} {
   foreach chan $spy(chans) {
      puthelp "PRIVMSG $chan :\[12$channel\] 9$nick is now known as $newnick"
   }
   return 1
}
}

proc spy:pub {nick uhost hand channel rest} {
global spy
if {([lsearch -exact [string tolower $spy(record)] [string tolower $channel]] != -1) || ($spy(record) == "*")} {
   foreach chan $spy(chans) {
      puthelp "PRIVMSG $chan :\[12$channel\] <$nick> $rest"
   }
   return 1
}
}

proc spy:msg {nick uhost hand rest} {
global spy
foreach chan $spy(chans) {
   puthelp "PRIVMSG $chan :\[4Private\] <$nick> $rest"
}
return 1
}

proc spy:notice {nick uhost hand rest} {
global spy
foreach chan $spy(chans) {
   puthelp "PRIVMSG $chan :\[7Notice\] <$nick> $rest"
}
return 1
}

bind chat -|- * spy:chat
proc spy:chat {hand idx arg} {
global spy
foreach chan $spy(chans) {
   puthelp "PRIVMSG $chan :\[8Party-Line\] <$hand> $arg"
}
return 1
}

bind dcc -|- * spy:dcc
proc spy:dcc {hand idx arg} {
global spy
foreach chan $spy(chans) {
   puthelp "PRIVMSG $chan :\[8DCC\] <$hand> $arg"
}
return 1
}

putlog "Spy v1.1 by Neon loaded!"
thanks for any help

Pitchat
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

The spy:part proc should have 5 not 4 "arguments" .. check the tcl-commands.doc file for the bind part :P
Once the game is over, the king and the pawn go back in the same box.
Locked