61 lines
1.5 KiB
HTML
61 lines
1.5 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
|
|
<html>
|
|
<head>
|
|
<title>Scripts</title>
|
|
<link href="style.css" rel="stylesheet" type="text/css">
|
|
</head>
|
|
<body background="images/back.gif">
|
|
<!--START-->
|
|
|
|
<h3>Scripts</h3>
|
|
|
|
When you create a script, you want to access the arguments passed to it
|
|
(either when using the script action, or when calling the script as a
|
|
function from a program (or from another, or even the same script). These
|
|
arguments are stored in the variables argument0, <tt>argument1</tt>, ...,
|
|
<tt>argument15</tt>. So there can be at most 16 arguments. (Note that when
|
|
calling the script from an action, only the first 5 arguments can be
|
|
specified.) You can also use <tt>argument[0]</tt> etc.
|
|
|
|
<p>
|
|
Scripts can also return a value, so that they can be used in
|
|
expressions. For this end you use the return statement:
|
|
|
|
<p>
|
|
<blockquote>
|
|
<pre><b>return</b> <expression></pre>
|
|
</blockquote>
|
|
|
|
<p>
|
|
Execution of the script ends at the return statement!
|
|
|
|
<p>
|
|
<b>Example</b><br>
|
|
Here is the definition for a little script that computes the square of the
|
|
argument:
|
|
|
|
<p>
|
|
<blockquote>
|
|
<pre>
|
|
{
|
|
<b>return</b> (argument0*argument0);
|
|
}
|
|
</pre>
|
|
</blockquote>
|
|
|
|
<p>
|
|
To call a script from within a piece of code, just act the same way as
|
|
when calling functions. That is, write the script name with the argument
|
|
values in parentheses.
|
|
|
|
|
|
<!--END-->
|
|
</body>
|
|
</html>
|
|
|
|
<!-- KEYWORDS
|
|
scripts
|
|
calling scripts
|
|
return value
|
|
--> |