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.
Help for those learning Tcl or writing their own scripts.
Nimos
Halfop
Posts: 80 Joined: Sun Apr 20, 2008 9:58 am
Post
by Nimos » Sun Jun 01, 2008 3:06 pm
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"
}
}
nml375
Revered One
Posts: 2860 Joined: Fri Aug 04, 2006 2:09 pm
Post
by nml375 » Sun Jun 01, 2008 4:41 pm
The flaw is this:
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
Nimos
Halfop
Posts: 80 Joined: Sun Apr 20, 2008 9:58 am
Post
by Nimos » Tue Jun 03, 2008 8:32 am
yea, I see...
I already fixed it myself yesterday