L3DT users' wiki
Large 3D terrain generator

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 script editor window. Both of these options will open the 'function browser' window, shown below:


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 <classes.landtype.GetBaseTextureNameByID i>

// echo the value of the string to the event log
echo s

The output of which is:


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 <application.GetExeDir>

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 <file.OpenDlg "proj" <project.GetProjectPath> "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 <project.GetProjectPath>.

plugins/general/zeoscript/reference/functions.txt · Last modified: 2017/08/31 05:09 (external edit)
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki