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 

TCL error: wrong # args error.

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


Joined: 02 Oct 2008
Posts: 2

PostPosted: Thu Oct 02, 2008 4:49 am    Post subject: TCL error: wrong # args error. Reply with quote

Hey guys. I'm very new to TCL and I'm trying to make a scissors paper rock script. However when I message my choice to the bot it gets this error:

[16:42] Tcl error [spr:setweapon]: wrong # args: should be "spr:setweapon nick host handle chan arg"

Here are the bits of code that relate to the bit that's getting the error:

Code:
bind msg    -    spr   spr:setweapon

proc spr:setweapon {nick host handle chan arg} {
    global botnick spr_player1 spr_player2 spr_started spr_playerstat spr_player1_w spr_player2_w
    if {$spr_started == 0} {
        puthelp "PRIVMSG $chan :Game not running. Type !spr <nick> to play."
        return 0
    }
   if {$arg == ""} {
      puthelp "notice $nick :You need to /msg $botnick <scissor, paper or rock>"
   }
   if {$nick == $spr_player1} {
      if {$arg == "scissor"} {
         set spr_player1_w scissor
      }
      if {$arg == "paper"} {
         set spr_player1_w paper
      }
      if {$arg == "rock"} {
         set spr_player1_w rock
      }      
   }
   if {$nick == $spr_player2} {
      if {$arg == "scissor"} {
         set spr_player2_w scissor
      }
      if {$arg == "paper"} {
         set spr_player2_w paper
      }
      if {$arg == "rock"} {
         set spr_player2_w rock
      }      
   }
   spr:checkwin
}


I'm sure it's not the cleanest way to do what I'm trying to do, but at the moment I'm just testing/playing, but I can't work out why it's giving me that error. I've tried a bunch of different things and there's still always some problem.

Any ideas?
Back to top
View user's profile Send private message
Furbs
Voice


Joined: 01 Oct 2008
Posts: 7
Location: Adealide, South Australia, Australia

PostPosted: Thu Oct 02, 2008 8:16 am    Post subject: Re: TCL error: wrong # args error. Reply with quote

try like

Code:
proc spr:setweapon { nick host hand chan {arg ""} } {
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Thu Oct 02, 2008 9:14 am    Post subject: Reply with quote

One suggestion, msg bindings do not provide a channel-argument, so remove that from your proc-head...
See the doc/tcl-commands.doc file that comes with your eggdrop for further details regarding different commands and bindings.

Code:
proc spr:setweapon {nick host hand arg} {

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


Joined: 02 Oct 2008
Posts: 2

PostPosted: Thu Oct 02, 2008 11:31 am    Post subject: Reply with quote

Thanks guys. Taking out the chan arg fixed it. Smile
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