egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problem with "timer loop" or topic arg

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
Kaio
Voice


Joined: 20 Feb 2009
Posts: 3

PostPosted: Fri Feb 20, 2009 3:59 pm    Post subject: Problem with "timer loop" or topic arg Reply with quote

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
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Fri Feb 20, 2009 4:35 pm    Post subject: Reply with quote

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:
utimer 30 [list command param1 param2 param3]

_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Kaio
Voice


Joined: 20 Feb 2009
Posts: 3

PostPosted: Fri Feb 20, 2009 6:54 pm    Post subject: Reply with quote

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


(sorry for the bad english ;P)
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Fri Feb 20, 2009 7:27 pm    Post subject: Reply with quote

'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:
proc yourproc {nickname host handle channel text} {

Then adjust your proc to make use of these arguments appropriately.
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Kaio
Voice


Joined: 20 Feb 2009
Posts: 3

PostPosted: Fri Feb 20, 2009 7:45 pm    Post subject: Reply with quote

It works! Thank you very much ^^
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber