Basic syntaxTrafficScript is a simple, command-based language. A command is called a 'statement', and each statement is terminated with a ';'. Comments begin with a '#' symbol, and finish at the end of the line: # Store the value '2' in the variable named $a $a = 2; # call the 'connection.close' function connection.close(); Variables are indicated by the '$' symbol. There is no typing in TrafficScript, and you do not need to pre-declare a variable before you use it. Variables are not persistent - they go out of scope when a rule completes. You can use variables in expressions to calculate new values (numbers and strings). Common mathematical, comparison and boolean operators are available, and '.' is used to concatenate strings. # Set the value of $a to 1.75 $a = 1 + 1/2 + 0.25; # create a new string with the '.' operator $fullname = $firstname . " " . $lastname; Functions are called using the normal bracket-and-argument-list syntax, and many functions can take different numbers of arguments. Function names often contain two or three parts, separated by '.'; this conveniently groups functions into different families. $path = http.getPath(); $cookie = http.getCookie( "ASPSESSIONID" ); $browser = http.getHeader( "User-Agent" ); For more details please refer to the ZXTM TrafficScript documentation.
Owen Garrett
[Zeus Dev Team] 01 July 2005
|
Recent Articles
Other Resources
|


