SUNiNET - Your Eggdrop & TCL resources site
[ Home Eggdrop TCL Links About ]

Guide to TCL scripting for Eggdrop 1.6

[ Previous ] [ Index ] [ Next ]

7.4 Executing when it's something else

It is also possible to put a second if command after your first if command.
This can be used for instance when you first want to check string A and if it doesn't comply with your conditions you want it to check string B.

The way to do this is by putting elseif after your closing brace.
What comes after elseif works in exactly the same way as the normal if command.
A small example:

if {$nick == "SomeNick"} {
  <first body>
} elseif {$chan == "#eggdrop"} {
  <second body>

In this case if $nick equals "SomeNick" <first body> will be executed.
The commands in <second body> will be ignored even if $chan equals "#eggdrop". However, if $nick would not equal "SomeNick", but $chan would equal "#eggdrop" than <second body> will be executed. If neither of the strings match nothing will be executed and the script will move on.

You can put in as many elseif commands as you like. After the first one a second one can be placed and so on.

[ Previous ] [ Index ] [ Next ]

Design & Graphics by Shawn Borton
Copyright © 2000-2005 Marijn van Zon