External functions

From HEWIKI
(Redirected from External Functions)
Jump to: navigation, search

Contents

External Functions are different from regular functions, which are created in HSL. External functions (sometimes also called Exposed Functions or System Functions), are run in C++ code, but are accessible via an HSL signature.

All of the signatures of external functions are available in the _ExternalFunctions script. If the signature is not in that script, it cannot be run (even if code exists for it in C++).

External Functions can be called by regular functions, or by class method scripts.

Built-in functions

Some external functions are only available to client or server, depending on context. However, a Built-in function is a type of external function which is always available to HeroScript, whether called from client, server, or any other application which uses HeroScript.

Built-in functions might do anything from creating and destroying nodes, to string conversions, to complex 3D math, and many other tasks. Many of these functions could have been written in HSL, but were instead written in C++ for speed or convenience.

Usage differences between HSL functions and External Functions

There are two main differences between external functions and regular HSL functions:

  1. If a regular HSL function is not in the calling script, it is necessary to specify its home script by prepending a script name to the function (orc_combat:damage()). For external functions, this is not necessary. In other words, external functions can be treated as local functions by any script in the game.
     
  2. HSL functions can be embedded more easily into a complex expression; however, some external functions will generate a script error if an attempt is made to embed them, rather than calling them on their own line.

Syntax

When calling an external function, the syntax is the same as for a regular function:

  <functionname> (arguments)

Syntax examples

  foo()
 
  stringvar = itos(27)

List of external functions

IMPORTANT: There are two external functions scripts each, on client and server:

  1. _ExternalFunctions: The prepended "_" means that these functions exist in Clean Engine
  2. ExternalFunctions: This script contains any additional external functions which have been added by the licensee (your own team). Instructions for adding new functions can be found at HeroScript Extension Plugin.


For a complete list of CleanEngine External Functions:

Client external functions

Server external functions

See also

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox