tclscript.com
main projects forum manpages tutorial

Script Search - Enter pattern to search for (wildcards accepted):
  Monday, January 05, 2009 Advanced Search | Ask Feathers | New Files | Popular Files | Links | Contact  


Eggdrop TCL Tutorial


  1. TCL Procedure Structure
  2. Eggdrop Bindings
  3. Sample Script


Procedure Structure
The basic tcl procedure structure consists of the following:


  • proc keyword
  • arguments/parameter declarations contained in braces "{}"
  • body of code also contained in braces


So a basic TCL procedure would look something like this:

proc myprocedure {arg1 arg2} {
     (tcl code inside here)
}


Eggdrop Bindings
An eggdrop binding is a way to respond to certain events.
The basic eggdrop binding declaration structure contains the following:


  • bind keyword
  • type of bind
  • attributes/flags a user must have to trigger the binding
  • mask matched against the type of binding such that it is triggered
  • procedure to call when event is triggered


The basic binding declaration would look something as follows:

bind (type) (attributes) (mask) (procedure call)

Example Script (refer to tcl-commands.doc that comes with eggdrop)

bind join - * myjoinprocedure
 1

proc myjoinprocedure {nick uhost handle channel} {
 2
   putserv "PRIVMSG $nick :Hello there!" 
3
}


1 - This line declares the bind event. (See tcl-commands.doc for other bind events)
2 - This line declares the procedure that the event calls (See tcl-commands.doc for the arguments to use for each binding)
3 - This line messages the user that joins the channel the bot is in with "Hello there!"




Check back in the future for more help topics...

back to top