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.

Invalid Command Name

Help for those learning Tcl or writing their own scripts.
Post Reply
N
Nimos
Halfop
Posts: 80
Joined: Sun Apr 20, 2008 9:58 am

Invalid Command Name

Post by Nimos »

I wrote a little script, which forwards all msgs to the bot to me, and lets me talk to the last talker through the bot.

if I write something now, I get this error in Partyline:
Tcl Error [forward]: Invalid Command name "(the nick I have)"
whats wrong with my script?

and is there a better way to check if someone is online than "onchan" ?

Code: Select all

bind msgm - * forward

set owner "Nimos"
set ownerchan "#nimos"

proc forward {nick host hand text} {

global lastnick owner ownerchan

if {![$nick == $owner]} {
       if {[onchan $owner $ownerchan]} {
              puthelp "PRIVMSG $owner :$nick $text"
              set lastnick "$nick"
              }
} else {
        puthelp "PRIVMSG $lastnick :$text"
        }
}
 
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

The flaw is this:

Code: Select all

if {![$nick == $owner]} {
Basically, you tell tcl to execute $nick as a command with first argument being == and second argument being $owner. Most likely not what you intended...

I'd suggest you use the string equal command to compare the strings, although you could do a simple comparison somewhat like the code suggests you thought of doing. With the second option however, don't treat it as a command.
NML_375
N
Nimos
Halfop
Posts: 80
Joined: Sun Apr 20, 2008 9:58 am

Post by Nimos »

yea, I see...

I already fixed it myself yesterday
Post Reply