******************* ** Scripting ** ******************* If you have some specific calculations that you perform over and over again, you can automate them with a script. A script is simply a text file that contains a series of expressions, commands and comments, with each on a separate line. A command is a line that begins with the "@" symbol. The next identifier after that symbol should be one of the following commands: exec - Treats the rest of the line as the filename of an external script to run. if - Evaluates the rest of the line as an expression, and then skips the following line if the result is false (0.0). label - Marks a place in code for use with a @goto statement. The next identifier on the line is used as the name of the label. goto - Moves the current script location to the specified location marked by a @label command or a ":" symbol. print - Evaluates the rest of the line as an expression and prints the results without an endline and without printing the expression first. println - Evaluates the rest of the line as an expression and prints the results with an endline but without printing the expression first. printex - Evaluates the rest of the line as an expression and prints the results with the expression first but without an endline. printexln - Evaluates the rest of the line as an expression and prints the results with the expression first and with an endline. disp - Treats the rest of the line as text to be printed onto the screen without an endline character. displn - Treats the rest of the line as text to be printed onto the screen with an endline character. error - Treats the rest of the line as text to be printed into the error log with an endline character. abort - Ends the script with an error message. end - Ends the script without an error message. rem - Ignores the rest of the line (comment). A comment can also be indicated by placing "//" or "'" at the beginning of the line. Similarly, a label can also be indicated by placing a ":" at the beginning of the line. Any line that is not a command, comment or label is interpreted as an expression to be evaluated by the engine. These are normally variable assignments, although they could also be used to seed the random number generator with the seed() engine function. The following is an example script for solving quadratic equations: ' QUADRATIC.TXT ' ' Calculates solutions to a quadratic equation. ' @displn @displn --- Quadratic Solver --- @displn   Ax² + Bx + C @disp A = @println a @disp B = @println b @disp C = @println c ' calculate discriminant d=b²-(4·a·c) @if d<0 @goto no_real @if d==0 @goto one_real @if d>0 @goto two_real @end : no_real '@displn No real solution. d=-d @disp Solution: @print (-b)/(2·a) @disp  ± @print sqrt(d)/(2·a) @displn i @end : one_real @disp Solution: @println (-b)/(2·a) @end : two_real @disp Solution: ( @print (-b-sqrt(d))/(2·a) @disp , @print (-b+sqrt(d))/(2·a) @displn ) @end This script prints some opening info, calculates the discriminant, checks to see what kind of solution there is, branches to the appropriate location and then calculates and displays the results. Note that "a", "b" and "c" must be assigned before executing the script. This is a very simple scripting language and is fairly limited, but it does demonstrate the exciting possibilities. Paradox has progressed to such a level that it can now itself be programmed!