A function is an independent section of code that receives information from a program and performs some action with it. Once a function has been written, you do not have to think again about how to perform the operations in it. Just call the function, and let it handle the work for you. You only need to know what information the function needs to receive, that is, the parameters, and whether it returns a value to the statement that called it.
Screen.write() is an example of a function which provides an easy way to display formatted text. It receives a string from the function that called it and displays the string on the screen. Screen.write is a void function, meaning it has no return value.
Two things set functions apart from the other variable types: instead of being declared with the "var" keyword, functions are declared with the "function" keyword, and functions have the function operator, "()", following their names. Data to be passed to a function is included within these parentheses.
Several sets of builtin functions are included as part of the ScriptEase interpreter. These functions are described in this manual. They are internal to the interpreter and may be used at any time. In addition, ScriptEase ships with a number of external libraries or .jsh files. External libraries must be explicitly included in your script to use the functions in them. See the description of the include directive in the preprocessor.
ScriptEase allows you to have two functions with the same name. The interpreter uses the function nearest the end of the script, that is, the last function to load is the one that to be executed when the function name is called. By taking advantage of this behavior, you can write functions that supersede the ones included in the interpreter or .jsh files.
Function return statement
Passing information to functions
Simulated named parameters
Function property arguments
Error checking for functions