External functions
|
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:
- 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.
- 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:
- _ExternalFunctions: The prepended "_" means that these functions exist in Clean Engine
- 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:
- Open the HeroScript Editor
- Choose File/Open for a Client Script or Server script, as appropriate
- Ensure that the "Show Engine" checkbox is selected
- Type _extern into the search filter box (be sure to include the leading underscore: "_")
- Select the _ExternalFunctions script
- Click the "Ok" button
- Choose Window/Functions and Methods, to get a side menu with all functions listed.
- Double-clicking on a function name will pop to that portion of the script, to see the function's signature.
- The _ExternalFunctions script is also loosely organized via category:
Client external functions
- Seamless World functions
- Account and Character functions
- Node functions
- Association functions
- Prototype functions
- String functions
- Marshal/Serialization functions
- HeroMachine functions
- Scripts and script reflection functions
- Animation Agent functions
- Animated Asset functions
- Timer functions
- Time functions
- Prop bucket functions
- GUI functions
- Minimap functions
- HeroBlade and/or Player Client functions
- Shadow functions
- Settings functions
- Debug functions
- Stencil functions
- Bones functions
- Character Parts functions
- Remote Call functions
- GM Notes functions
- Repository functions
- Waypoint Paths and Path Followers functions
- Command Layers functions
- Keyboard, Keys, and Keybindings functions
- Audio functions
- Camera functions
- Math functions
- Virtual Stage functions
- Facegen functions
- Skin functions
- Environment functions
- Trails functions
- Action Mark functions
- Messaging functions
- DOM Reflection functions
- Physics and Collision functions
- Particles and Emitters functions
- Environment scheme functions
- DLL Plugin Architecture functions
- Plug-in functions
- Key Value functions
- Uncategorized functions
Server external functions
- String functions
- Marshal/serialization functions
- HeroMachine functions
- Scripts and Script reflection functions
- Time functions
- Timer functions
- Remote Call functions
- Chat and Log messaging functions
- Area functions
- Editing functions
- Account and character functions
- Seamless world functions
- Node functions
- Arbitrary root node functions
- Spatial awareness functions
- DOM Reflection functions
- Prototype functions
- Association functions
- Math functions
- Repository functions
- Node delivery service functions
- Pathing functions
- Physics and Collision functions
- DLL Plugin Architecture functions
- Dream Manager functions
- Region nodes functions
- Pathfinding nodes functions
- Uncategorized functions