| View previous topic :: View next topic |
| Author |
Message |
stafu Voice
Joined: 02 Oct 2008 Posts: 2
|
Posted: Thu Oct 02, 2008 4:49 am Post subject: TCL error: wrong # args error. |
|
|
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 |
|
 |
Furbs Voice
Joined: 01 Oct 2008 Posts: 7 Location: Adealide, South Australia, Australia
|
Posted: Thu Oct 02, 2008 8:16 am Post subject: Re: TCL error: wrong # args error. |
|
|
try like
| Code: | | proc spr:setweapon { nick host hand chan {arg ""} } { |
|
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Thu Oct 02, 2008 9:14 am Post subject: |
|
|
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 |
|
 |
stafu Voice
Joined: 02 Oct 2008 Posts: 2
|
Posted: Thu Oct 02, 2008 11:31 am Post subject: |
|
|
Thanks guys. Taking out the chan arg fixed it.  |
|
| Back to top |
|
 |
|