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 not binding

Old posts that have not been replied to for several years.
Locked
B
Barron

TCL not binding

Post by Barron »

Hey. I'm trying to make it bind to a certain command. But when someone enters the text, it doesn't bind it.
bind pub - !info show:info
proc show:info { nick chan hand } {
putserv "PRIVMSG $chan :MysticBots is a MysticNetwork service that provides real EggDrop bots for your channel. $nick, if you have a channel, you can get a bot for yourself."
return 0
}
is the code. Did I code that wrong?
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Re: TCL not binding

Post by user »

If you take a look in your log/or stay on the partyline with the right .console settings, you'll notice a error message appearing as the proc is triggered.

The bind will cause the proc to be called with a fixed number of arguments (depending on what kind of bind you're using...check tcl-commands.doc for details). Unless your proc is designed to accept that number of argumens it won't work.
B
Barron

Post by Barron »

[00:29] Tcl error [msg:help]: called "msg:help" with too many arguments
I get that with
proc msg:help { nick } {
puthelp "NOTICE $nick :Currently, we have these commands."
return 0
}
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

Why are you posting again about the same error when I already told you how to solve it? If you have a problem understanding parts of my reply, please tell me, and I'll try to explain in a bit more detail.
B
Barron

Post by Barron »

The bind will cause the proc to be called with a fixed number of arguments
What did you mean here?
User avatar
user
 
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

Barron wrote:What did you mean here?
That you can't just leave out the arguments you don't need from the proc. A proc called by a msg bind will recieve 4 arguments no matter what and must be able to handle these some how. Either by having four variable names or using the special variable name 'args' (that can handle any number of arguments (even none)).

Check the 'binds' section of doc/tcl-commands.doc to find out what these arguments are and in what order they are passed along or else you might end up mixing things up. Your previous proc were only capable of handling ONE argument (no more, no less) and thus, when the bind called it with four arguments it had to go wrong :)

Get it?
Locked