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

Guide to TCL scripting for Eggdrop 1.6


[ Previous ] [ Index ] [ Next ]


12.4 Advanced math

You already know the incr command but sometimes you might want to do a bit more than just adding up and substracting from numbers.
You can perform more advanced math with the expr command.
The syntax of a expr command is expr <calculation>.

The <calculation> is what you want to calculate.
You can make the calculation as long as you like. The normal computer characters apply, which are a plus sign (+) for adding up, a minus sign (-) for substracting from, an asterix (*) for multiplying, a slash (/) for dividing and a percent sign (%) for the remainder.
The expr command goes through the calculation in the "official" way which means that asterix's are handle before the plus signs for example.

The expr command can do a lot more than just calculating, but that won't be discussed here.
You can find more about these other functions in the man pages of TCL to which a reference is in Chapter 3.4.
Also note that the expr command evaluates it's input like timer and utimer, therefor you must escape any brackets and such if you want those into your calculation.


[ Previous ] [ Index ] [ Next ]


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