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.

Tcl error [test]: syntax error in expression

Old posts that have not been replied to for several years.
Locked
]
]Facility[

Tcl error [test]: syntax error in expression

Post by ]Facility[ »

have a problem with this script:

bind pub - "!test" test

proc test {nick userhost hand chan target} {
if {$nick == \]Facility\[} {putchan $chan "Test #1"}
else {putchan $chan "Test #2"}
}

eggdrop says: Tcl error [test]: syntax error in expression "$nick == \]Facility\["

same without \ in front of ] and [ --->Tcl error [test]: syntax error in expression "$nick == ]Facility["

hope you can help... thx
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

You need to enclose the word/phrase in a Tcl string.

This can be done using ""

IE

"\]blah\["
]
]Facility[

Post by ]Facility[ »

thx... now it makes the if command... but then... Tcl error [test]: invalid command name "else"

Code is now:

bind pub - "!test" test

proc test {nick userhost hand chan target} {
if {$nick == "\]Facility\["} {putchan $chan "Test #1"}
else {putchan $chan "Test #2"}
}
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

This is due to the genral formatting of your script.

Tcl executes code, based on blocks or lines. All depending, how it is listed.

To start a block you open a bracker {.

ANd you close like so }

The problem is, if you close the bracket, then go to a new line, Tcl treats it as complete.

As such, havign the else command the way you would with mIRC, doesn't work in Tcl.

mIRC uses what they call a lazy interpreter, where things are pretty much worked around, and it has no real format to it.

To fix this, you will need to change the way the if-elseif-else block is placed together.
]
]Facility[

Post by ]Facility[ »

big thx... i will try it
Locked