| bind pubm - choc said_choc proc said_choc { nick host handle chan text } { puthelp "PRIVMSG $chan :MmMmm ... chocolate!" } |
bind <type> <flags> <trigger> <procname>In this script, the type is pubm. This type of bind causes the bot to monitor what is said in the channel, looking for any occurences of the trigger, which in this script is choc. The flags in this bind are - which is used to indicate that it doesn't matter to the bot who actually says the trigger, i.e. anyone can trigger it. Notice that the procname in the bind is said_choc.
proc <procname> { <parameter list> } {In this case, the procname is given as said_choc, so that it is the name mentioned in the bind. Now we need to look at the parameter list.
<various TCL commands>
}
puthelp "PRIVMSG $chan :MmMmm ... chocolate!"Notice that the puthelp command takes exactly one argument, and that that argument is a string --- in our case, an explicit string, as indicated by the quotation marks enclosing it. What this TCLcommand does, is twofold:
PRIVMSG <target> :<message>Note the colon in front of the message. In our case, the target is the channel where the person who triggered the bind, spoke. The name of that channel was stored by the bind in the parameter list in the variable we chose to call chan.