5.5 Local and global strings
There are two types of strings. Local ones and global ones.
A local string only exists while a procedure is running and a global string exists as long as your script
is running so in this case while your bot is running.
All the strings created outside a procedure are automaticly global strings and all the strings created
within a procedure are automaticly local strings.
While you are in a procedure you can turn a local string into a global string by using the global
Global and local strings work in exactly the same way, the only difference is when and where they exist.
The syntax of a global command is global <strings>.
Every string must be seperated by a space and if you want to have a global array, you only have to give the
array name, not the string of the array too.
Also because this command already knows that what you are giving as input is a string, you musn't put a $ in
front of the names of your strings. A $ is used to identify something as being a string and replace that part
with the contents of the string.
Basically putting a $ in front of it will replace the whole name of the string including the $ with the
contents in that string. For example if $test contained "hello" and you were to do global $test,
TCL would make of this global hello and that's not what we want, in this case, now do we.
If we would take the set example where we have the array test with the strings "(when)" and
"(what)" in it, you also don't have to use the global command like global test(when) test(what), but you
can use global test which would give you access to the global strings "(what)" and "(when)" of the
array test aswell.
The global command converts entire arrays, not just individual strings.
A final note: the global command is usually put on the first line of the procedure. This is not
neccesary, but it's more like an unwritten rule.
It's also easier to overview your script if the global is on the first line rather than somewhere
hidden deep inside the procedure.