The most noticible thing is
Code: Select all
proc pub_xplod {nick uhost hand chan $ranxplod} {
I know many people new to Tcl have dificulties understanding why this line is like it is, but the goal behind this 1 must be out of eyesight.
Can you tell me what this was supposed to do?
The Tcl proc command has the following format
proc <name> {[argument1] [arguemnt2] [arguementX]} {<body>}
<item> = required
[item] = optional
When writting code, you break it down into re-usable functions (in Tcl, they are called procedures), so when a often used peice of code is needed, instead of typing it all out, you simply call that needed code.
When you do this, you will often need to change some fo the items within the code. EG, when you want to remove a certain letter from a string of letters, you need to know the letter that needs removing, and the string to remove it from. There would be no point in making a re-usable function for this, if you are using the same letter and string everytime.
So, to do this, you need some way of knowing the string, and character to remove. To do this, you pass them as arguments to the procedure.
EG, I made a procedure called removeletter. so I call it as
When you do this, you need some way, to collect this data inside of a procedure. This is what the first line of the proc command is all about.
Thus
Code: Select all
proc testcode {nick uhost hand chan arg} {
This allows for 5 arguements to be passed to this procedure. Each one of them, getting there own name. These names, can be whatever you want, so long as you know, what type of information is being passed to the procedure.
In your example, it is done incorrectly.
Using the information I have provided, and reading a copy of tcl-commands.doc, you should be able to find out what is wrong with the above code.