[−][src]Module sulis_state::script
This module contains Sulis' scripting API. Most structs are inserted into lua scripts as objects. The documentation for each struct describes the available functions on each object when interacting with them within a lua script.
There are currently four kinds of scripts:
- AI Scripts: These are attached to a given actor in their resource definition under
ai
. Whenever the parent entity is active, theai_action(parent, state)
method is called. - Area / Trigger Scripts: These are called by triggers, conversations, and cutscenes.
Named script functions are called, via a
fire_script
type containing anid
for the script and afunc
. - Ability Scripts: These are called when activating an ability or when an active ability
meets certain conditions. The entry point for the script is
on_activate(parent, ability)
. When using a targeter,on_target_select(parent, ability, targets)
is the return from that targeter. - Item Scripts: Similar to ability scripts, but called when using an item. The entry point is
on_activate(parent, item)
.
Since standard Lua methods for referencing other script files will not work, Sulis includes a simple facility to include the contents of a script into another script. This is done with a line in the target script: --INCLUDE <other_script_id> The entire contents of the referenced script will be placed into the script file in place of the --INCLUDE directive at evaluation time. --INCLUDE directives are only evaluated one level deep at this time.
Re-exports
pub use self::script_callback::CallbackData; |
pub use self::script_callback::FuncKind; |
pub use self::script_callback::ScriptCallback; |
pub use self::script_callback::ScriptHitKind; |
pub use self::script_callback::TriggeredCallback; |
pub use self::targeter::TargeterData; |
Modules
script_cache | |
script_callback | |
targeter |
Structs
AreaTargeter | A created AreaTargeter, built from a |
InstructionState | |
ModuleExport | A data structure representing all data that will be
transfered from this module to the specified subsequent module.
This is created with |
Script | Script Helper module for easily calling various script methods |
ScriptAbility | Represents a specific active ability. This is passed into ability
scripts in the |
ScriptAbilitySet | Represents the set of abilities that a given Entity has access to.
This will only include active abilities, not passive ones.
See |
ScriptActiveSurface | Represents a surface that already exists, and is being passed into a Lua script. Not used during effect creation |
ScriptAppliedEffect | An already applied effect, in contrast to an effect being created
via |
ScriptColorAnimation | A color animation changing a parent entity's base or secondary
color. Created normally by |
ScriptEffect | An effect, normally created via |
ScriptEntity | Represents a single entity for Lua scripts. Also can represent an invalid,
non-existant entity in some cases. Many script functions pass a parent
which is a script entity, and often targets, which is a |
ScriptEntitySet | Represents a set of ScriptEntities, which can be created from a variety of
sources. This is passed to many script functions as a |
ScriptImageLayerAnimation | An animation that adds one or more ImageLayers to the parent creature for rendering. These override any racial or inventory image layers, with "empty" being used to hide an image layer on the parent. All layers are removed when the animation is complete. |
ScriptInterface | The ScriptInterface, accessible in all Lua scripts as the global |
ScriptInventory | The inventory of a particular creature, including equipped items and quickslots. |
ScriptItem | A ScriptItem, representing a specific item in a player or creature inventory,
quick slot, or the party stash, depending on the |
ScriptMenu | A user interface menu being created by a script. Normally created
by |
ScriptMenuSelection | A user menu selection |
ScriptParticleGenerator | A flexible animation type, which can be used to create particle effects, simple
frame based animations, or anything in between.
Typically created by |
ScriptScaleAnimation | An animation that changes the size of an entity.
Normally created via |
ScriptStashItem | A representation of an item in the stash |
ScriptState | A script state, containing a complete lua state. |
ScriptSubposAnimation | An animation that moves the pixel precise coordinates of
an entity. Normally created via |
ScriptUsableItem | A representation of an item that is usable and in a particular QuickSlot for a parent entity. |
Enums
ScriptItemKind | A kind of Item, represented by its owner (Stash, QuickSlot, or a generic item with a specified ID) |
Functions
entity_with_id |
Type Definitions
Result |