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 

Invalid Command Name

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


Joined: 20 Apr 2008
Posts: 80

PostPosted: Sun Jun 01, 2008 3:06 pm    Post subject: Invalid Command Name Reply with quote

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:

Quote:
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:

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


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sun Jun 01, 2008 4:41 pm    Post subject: Reply with quote

The flaw is this:
Code:
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, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Nimos
Halfop


Joined: 20 Apr 2008
Posts: 80

PostPosted: Tue Jun 03, 2008 8:32 am    Post subject: Reply with quote

yea, I see...

I already fixed it myself yesterday
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