TombEngine 1.0.2 scripting interface

Welcome to the TombEngine scripting API. This is a work in progress and some information might be wrong or outdated. Please also note that this is primarily a reference document, not a tutorial, so expect descriptions to be fairly sparse.

At the time of writing, there is a tutorial describing the basics of Lua, as well as a number of example scripts, on the wiki here.

Module Hierarchy (boring but important)

Other than the "special tables" (GameVars, LevelVars and LevelFuncs), every module described herein is held in a master table called TEN. For example, to call GetMoveableByName, you would have to do:

local door = TEN.Objects.GetMoveableByName("door_type4_14")

To save on typing, you can put the following at the start of a Lua file:

local Util = require("Engine.Util")
Util.ShortenTENCalls()

This will put the modules and classes in the global table. In other words, it means you can do the following:

local door = GetMoveableByName("door_type4_14")

Always check logs/TENLog.txt

If you are scripting levels, TombEngine will often kick you back to the title screen, even if errorMode (see Flow.Settings) is set to ErrorMode.WARN or ErrorMode.SILENT.

This might get annoying, but it's on purpose. If your Lua script contains a syntax error (e.g. you're missing end at the end of a function), the Lua interpreter will not be able to continue running the script. If it tried to keep running, you'd probably see some pretty strange behaviour, and would possibly get a crash regardless.

If this happens, check logs/TENLog.txt and look for an error message with the word "unrecoverable".

Enjoy.

- squidshire

1 Modules

Effects Functions to generate effects.
Flow Functions for use in Flow.lua, settings.lua and strings.lua
Inventory Inventory manipulation
Logic Saving data, triggering functions, and callbacks for level-specific scripts.
Misc Functions that don't fit in the other modules.
Objects Moveables, statics, cameras, and so on.
Strings On-screen strings.

2 Classes

Flow.Animations New custom animations which Lara can perform.
Flow.Fog Fog
Flow.InventoryItem Represents the properties of an object as it appears in the inventory.
Flow.Level Stores level metadata.
Flow.Mirror A mirror effect.
Flow.Settings Settings that will be run on game startup.
Flow.SkyLayer Describes a layer of moving clouds.
Objects.AIObject AI object
Objects.Camera Basic cameras that can point at Lara or at a CAMERA_TARGET.
Objects.Moveable Represents any object inside the game world.
Objects.Sink Sink
Objects.SoundSource Sound source
Objects.Static Statics
Strings.DisplayString A string appearing on the screen.

3 Primitive Classes

Color An RGBA or RGB color.
Rotation Represents a rotation.
Vec3 Represents a 3-dimensional vector.

4 Enums

Flow.InvID Constants for items that can be used with GetItem and SetItem.
Effects.BlendID Constants for blend mode IDs.
Objects.ObjID Constants for object IDs.

5 Lua utility modules

EventSequence Event sequence - a chain of functions to call at specified times, modeled after TRNG's organizers.
Timer Basic timer - after a specified number of seconds, the specified thing happens.
Util Misc Util functions
generated by LDoc 1.4.6 Last updated 2022-09-07 20:56:06