Every object except the Player Start Position can have a single script attached to them. The script can have multiple custom functions and take advantage of built-in functions, and has its own memory pool for variables.
Scripts have the ability to change their own object, impact other objects, and also store global variables or send global messages to all other scripts in the scene.
Scripts optionally can be selected to run at the start of a level, or to be activated by another object sending them the signal to run.
By default, unless a script uses some of the built-in functions or has a setting to run the code every X seconds, a script runs from top to bottom and ends after its first run.
Every script also has its own list of “picked” objects, which can be referenced for triggering effects on other objects, with -1 or obj.self() being the default index number for a command to affect itself.
Script execution flags are comments in LUA that can be added to your objects script to alter the way the script behaves or whether an object is included in other levels when merging or stacking levels together.
- –!FIRST
Run any script with this tag before all normal and last scripts - –!LAST
Run any script with this tag after all the first and normal runtime scripts - –!NOEXPORT
Prevent this object from being imported into another object as a stacked level, useful when collaborating on levels with others