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.

bind for msg instead of pub

Help for those learning Tcl or writing their own scripts.
Post Reply
c
cache
Master
Posts: 306
Joined: Tue Jan 10, 2006 4:59 am
Location: Mass

bind for msg instead of pub

Post by cache »

I'm trying to get a command to work via PM instead of main room.. I tried changing pub to msg since thats how i see the samples in other scripts...

I have:

Code: Select all

#
set usedcmds69 [expr {[unixtime]-3}] 

bind msg - !69 cmds69 

proc cmds69 {nick uhost hand chan arg} { 
 global usedcmds69 
 if {[set t [expr {[unixtime]-$usedcmds69}]] < 3} { 
  putquick "NOTICE $nick :You have to wait [expr {3-$t}] sec(s) before you can use this command."
  return 0 
 } 
  if {$arg == ""} {
    putserv "NOTICE $nick :Usage: !69 <who>"
    return 0
 } 
 set usedcmds69 [unixtime] 
 set 69who [lrange $arg 0 end]
 putquick "privmsg $nick :\001ACTION $69who blah blah\001" 
} 
#
But when I try that I get this error:

Code: Select all

[20:09] Tcl error [cmd69]: wrong # args: should be "cmd69 nick uhost hand chan arg"
Thanks
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Tcl-commands.doc:
MSG
bind msg <flags> <command> <proc>
procname <nick> <user@host> <handle> <text>

Description: used for /msg commands. The first word of the user's
msg is the command, and everything else becomes the text argument.
Notice how there's no <chan> argument passed to a msg-bind proc.
c
cache
Master
Posts: 306
Joined: Tue Jan 10, 2006 4:59 am
Location: Mass

Post by cache »

Ohh duh at me, I forgot.. works now thanks :)
Post Reply