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.

Problem with "timer loop" or topic arg

Help for those learning Tcl or writing their own scripts.
Post Reply
K
Kaio
Voice
Posts: 3
Joined: Fri Feb 20, 2009 3:52 pm

Problem with "timer loop" or topic arg

Post by Kaio »

Teh script: http://pastebin.com/m2d5a0a1c

I get this error if i call the script with ?topic_status

#
error: Tcl error [topic_status]: wrong # args: should be "topic_status topic"



I have no idea how to pass the argument or a other method to get the topic title
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Make sure the argument-list in the proc header matches the parameters passed when the binding triggers (see doc/tcl-commands.doc).

Also, you'll have to modify your utimer-command to pass the very same number of parameters if you intend to use that recursive calling. This would also have to be done in a safe manner, so I'd recommend using lists there.
IE:

Code: Select all

utimer 30 [list command param1 param2 param3]
NML_375
K
Kaio
Voice
Posts: 3
Joined: Fri Feb 20, 2009 3:52 pm

Post by Kaio »

i noticed...it issnt the timer who does the error... but i cant find out ...


(sorry for the bad english ;P)
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

'k, let me point you in the right direction then:
doc/tcl-commands.doc wrote: (4) PUB
bind pub <flags> <command> <proc>
procname <nick> <user@host> <handle> <channel> <text>

Description: used for commands given on a channel. The first word
becomes the command and everything else is the text argument.
Module: irc
This means, that when the binding triggers, <proc> will be called with 5 parameters (being nick user@host handle channel and text). Your proc must be able to accept these parameters as arguments...

In your case, your proc has only 1 argument, which you've called topic. Obviously, that's 4 arguments short of what bind expects, and more important, it's not the order bind expects..

Hence, bind calls the proc with the wrong number and order of arguments, and you get the error posted.

Solution?
Adjust your proc to accept the proper amount of parameters:

Code: Select all

proc yourproc {nickname host handle channel text} {
Then adjust your proc to make use of these arguments appropriately.
NML_375
K
Kaio
Voice
Posts: 3
Joined: Fri Feb 20, 2009 3:52 pm

Post by Kaio »

It works! Thank you very much ^^
Post Reply