SUNiNET - Your Eggdrop & TCL resources site
[ Home Eggdrop TCL Links About ]

Guide to TCL scripting for Eggdrop 1.6


[ Previous ] [ Index ] [ Next ]


5.2 Setting strings

Strings can be set and unset with the set and unset commands.
The syntax of a set command is set <string> <value> and
of the unset command it's unset <string>.
Besides set and unset there is also append.
This command works in the same way as the set command, but the difference is that this command adds something to the string instead of changing it.
The append command adds something directly at the end of a string and is equal to set <string> "$<string><value>".

The <string> is the name of the string you want to change.
The name must consist of letters, marks (-) and/or numbers only. If you put any other characters in it it might cause errors because the script inteprets them wrong.

The <value> is what you want to set the string to or append to the string if you are using append.
This can be a number, some text, the output of a command or anything else for that matter.
What you want to put in your string is not limited to anything, but some characters do need to be escaped by a backslash for instance to make sure TCL doesn't interpret them wrong.
Also note that if you want to put a piece of text in a string that you enclose it in quotes.

Besides setting a string, you can also unset a string. This simply makes the string non-existend again as it was before you created it.

NOTE: TCL will return an error when you try use a string that doesn't exist (a string can exist with nothing in it (set test "") though).


[ Previous ] [ Index ] [ Next ]


Design & Graphics by Shawn Borton
Copyright © 2000-2005 Marijn van Zon