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.

Outputting color codes in a dictionary type script

Help for those learning Tcl or writing their own scripts.
Post Reply
c
cimeran
Voice
Posts: 9
Joined: Fri Mar 04, 2011 11:52 pm

Outputting color codes in a dictionary type script

Post by cimeran »

Please note: I fixed this error by stripping curly braces from the definitions before they were output by the bot....

Howdy all. I'm using this http://www.egghelp.org/tclhtml/3478-4-0-0-1-eggdb.htm script to do simple getting/setting of messages. Trying like the dickens to set a message to use some color like so:

!learn test One word is \002bold\002 and \00312some are in\003 color.

But when it gets echoed back it literally prints the backslashes and numbers rather than formatting the message. The script speaks thusly:

putserv "privmsg $target :$msg"

So it seems like it should end up bolded, in color, whatever. Any ideas?

Thanks in advance.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

There is no substitution done on the entered text, neither is there of the contents of $msg in that line of code you posted. Thus, \002 will be printed literally, and not the control-codes you expected.
You could use the "subst" command to force another iteration of substitutions, though you'll have to be careful to not introduce remote exploits (make sure you use -nocommands -novariables for starters).

Also, this script has a few issues with mixed lists and strings, though I don't think these will affect the use of "subst".
NML_375
c
cimeran
Voice
Posts: 9
Joined: Fri Mar 04, 2011 11:52 pm

Post by cimeran »

Thanks for the information. I've solved the problem, but as I get more comfy in tcl I'll try to address the issues you mention.


nml375 wrote:There is no substitution done on the entered text, neither is there of the contents of $msg in that line of code you posted. Thus, \002 will be printed literally, and not the control-codes you expected.
You could use the "subst" command to force another iteration of substitutions, though you'll have to be careful to not introduce remote exploits (make sure you use -nocommands -novariables for starters).

Also, this script has a few issues with mixed lists and strings, though I don't think these will affect the use of "subst".
Post Reply