all you need is to know about bind, channel (both descripted in TCL-Commands.doc), proc and basic variable use. For the last two, you might want to take a look into any existing script, you should get it very fast.
if you want to use a password checking for the command like in "op <pass> #channel", you would also ned to read passwdok (TCL-Commands.doc) and lindex (TCL manual) (dont forget to use [split $var] before lindex).
give it a try, if it doesnt work, we will show you the mistakes ^-^.
Go here for your examples. You can also download any script and study it, pick apart its guts and work out what each part does. Also Google is your friend.
The lifecycle of a noob is complex. Fledgling noobs gestate inside biometric pods. Once a budding noob has matured thru gestation they climb out of their pod, sit down at a PC, ask a bunch of questions that are clearly in the FAQ, The Noob is born