====== Calling functions ======
ZeoScript commands consist of a function name, followed by a space-separated list of function arguments. Below is the archetypal example, which prints "Hello World!" to the event log:
echo "Hello World!"
Here, the ''echo'' function takes one argument (a string).
===== Finding functions and prototypes =====
At the time of writing, there are some 400 functions that may be called by ZeoScript. To view the list of available functions, use the '//Extensions->atFuncBrowser->Function browser//' item in the L3DT menu, or the '//Tools->Function browser//' menu item in the [[bundydocs>l3dt:userguide:scripts:editor|script editor window]]. Both of these options will open the 'function browser' window, shown below:
{{ :plugins:general:atfuncbrowser:funcbrowser.png |:plugins:general:atfuncbrowser:funcbrowser.png}}
In this window you can see the prototypes of all the available functions. Note that the functions are nested in a tree, which represent the //namespaces// used to categorise zeofunc extension functions.
For example, the highlighted function:
string GetBaseTextureNameByID(ushort InputCode);
...is nested in the 'classes.landtype' namespace, indicating that it is a member function of the class 'landtype'. The entry in the tree also indicates that this function has a return type of string, and takes one argument that is an unsigned short (ushort) integer.
To call this function, you can do the following:
// declare a ushort for the land type code
ushort i
set i 256
// declare a string to contain our return value
string s
// call the function, and use ''set'' to set the value of the string variable.
set s 
// echo the value of the string to the event log
echo s
The output of which is:
C:\Users\Aaron\AppData\Roaming\Bundysoft\L3DT\Std 2.5.4.0\Resources\Climates\common\sand\yellowsand1.jpg
===== Function nesting =====
Function calls may be nested in ZeoScript to pass the arguments of one script call to another. To do this, we nest the function call between < angled braces > syntax, as seen in the example below:
echo 
The above example calls the 'application.GetExeDir' function to retrieve the directory containing L3DT's executable, which is then passed to the 'echo' function for writing to the event log.
A more meaty example is:
project.SaveProjectFile  "L3DT Project files (*.proj)|*.proj|">
In the above example, the function  'project.SaveProjectFile' is called to save the map project, with the filename given by a call to the 'file.OpenDlg' function, which in turn asks the user to input the filename. The default filename in the dialog is the current project filename, as retrieved by .