Functions

From ADRIFT 5 Manual Wiki
Revision as of 00:39, 13 September 2013 by Saabie (Talk | contribs) (user functions update)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

A function is a procedure that can be called, which returns a value. Functions can optionally take parameters.

There are four types of functions in ADRIFT. These are:

Every item in ADRIFT can be referred to by it's key. If you type a key (or a function that resolves to a key) of a Location, Character, Object, Group or Event then you can access all the properties of that item, in addition to special functions such as listing and counting etc.
A special feature of item functions is that you can chain them together. If you use a function that returns the key of any of the above items then you can append another function to access properties of that item.
These are distinguished from normal text by placing the percent (%) symbol before and after them. They sometimes have parameters which are enclosed in [square brackets].
The contents of Variables are accessed by placing the percent (%) symbol before and after their name, and when arrays are used the index of the wanted element is enclosed in square brackets.
These are a special set of functions that can only be used within Expressions. Most of these are either math functions or functions used to change a string of text.
Expression functions that take parameters enclose them in (parentheses).
These are functions which you create yourself. Multiple references can be defined which become parameters in the function call.
The function returns the contents of its Text box, which will usually use one or more of the above function types to generate the wanted text.
User functions are used in the same way as general functions, with the percent(%) symbol before and after, and any parameters in square brackets.


<<< KeysMain PageItem functions >>>