Documentation for PAC's Lua functions

void pass()
pass is a function doing nothing
You can use it for testing or for not needed callbacks
void LoadScene(LuaScene scene)
Loads a new Scene/Room

Door Example expects a Spine point object near the door:

function door()
LoadScene("cockpit")
end
GoToPoint("cockpit", door)
void InterruptibleOff()
Prevent the player to skip a interaktion and walking somewere else
void InterruptibleOn()
Enable interruption again
void PlayAnimation(Number trackIndex, LuaSpineAnimation newAnimation, bool loop, std::optional<sol::function> callback)
Plays immediately an animation on the calling Spine object
int trackIndex: Spines animation track.
string newAnimation: Animation name that will be played.
bool loop: Should the animation be looped at the end.
function callback: called on the end of the animation, also on looped animations.
void AddAnimation(Number trackIndex, LuaSpineAnimation newAnimation, bool loop, Number delay, std::optional<sol::function> callback)
Adds an animation on the calling Spine object that will be played after the current animation ends
int trackIndex: Spines animation track.
string newAnimation: Animation name that will be played.
bool loop: Should the animation be looped at the end.
function callback: called on the end of the animation, also on looped animations.
void PlayAnimationOn(LuaSpineObject object, Number trackIndex, LuaSpineAnimation newAnimation, bool loop, std::optional<sol::function> callback)
See PlayAnimation
SpineObject object: Objects ID that should be effected
int trackIndex: Spines animation track.
string newAnimation: Animation name that will be played.
bool loop: Should the animation be looped at the end.
function callback: called on the end of the animation, also on looped animations.
void AddAnimationOn(LuaSpineObject object, Number trackIndex, LuaSpineAnimation newAnimation, bool loop, Number delay, std::optional<sol::function> callback)
See AddAnimation
SpineObject object: Objects ID that should be effected
int trackIndex: Spines animation track.
string newAnimation: Animation name that will be played.
bool loop: Should the animation be looped at the end.
function callback: called on the end of the animation, also on looped animations.
void SetSkin(LuaSpineSkin skin)
Set Spine skin on an Spine object
string skin: Spines Skin name
void SetSkinOn(LuaSpineObject object, LuaSpineSkin skin)
See SetSkin
SpineObject object: Objects ID that should be effected
string skin: Spines Skin name
void PlayDialog(LuaDialog dialogName, std::optional<sol::function> callback)
Plays a dialog by name
string dialogName: Name of the skin that will be set.
void AddToInventory()
Adds the current item to the inventory.
The items skin will be set to inventar_default_skin
The item will be moved from the scene to inventory_items
void AddToInventoryWithSkin(LuaSpineSkin skin)
See AddToInventory
string skin: A skin that will be set insted of inventar_default_skin
void AddToInventoryOn(LuaSpineObject object)
See AddToInventory
SpineObject object: Objects ID that should be effected
Note: The object has to be in the scene, this function does not create new objects. The object can be placed outside of the scenes view.
void AddToInventoryWithSkinOn(LuaSpineObject object, LuaSpineSkin skin)
See AddToInventory
SpineObject object: Objects ID that should be effected
string skin: A skin that will be set insted of inventar_default_skin
Note: See AddToInventoryOn's note.
void RemoveFromInventory()
DEPRECATED use SetDeleted
void RemoveFromInventoryOn(LuaSpineObject object)
DEPRECATED use SetDeleted
void SetDeleted()
Set deleted in the current object.
Objects get only deleted at the end of the frame.
void SetDeletedOn(LuaSpineObject object)
See SetDeleted
SpineObject object: Objects ID that should be effected
Note: SetDeleted can not be called on the last frame of an animation via a Spine event.
returns: a list of positions GetPointNames()
Get all Spine points from this Spine object
returns: a list of positions GetPointNamesOn(LuaSpineObject object)
See GetPointNames
Lua Example:

local points = GetPointNamesOn("inventory_object")
for i = 1, #points do
print(i, points[i])
end
SpineObject object: Objects ID that should be effected
void GoToPoint(LuaSpinePoNumber point_name, std::optional<sol::function> callback)
Send the player to a point's position of this Spine object.
string point_name: Name of the point the player should go to
function callback: Function that will becalled when the layer reaches the position
void GoToPointOn(LuaSpineObject object, LuaSpinePoNumber point_name, std::optional<sol::function> callback)
See GoToPoint
SpineObject object: Objects ID that should be effected
string point_name: Name of the point the player should go to
function callback: Function that will becalled when the layer reaches the position
void StopWalking()
Stop player in position
returns: Tupe(x, y) GetPointPosition(LuaSpinePoNumber point_name)
Debug function to get the position of a Spine point.
string point_name: Spine point name
void SetPositionToPoint(LuaSpinePoNumber point_name)
Set's an objects position to a Spine point
string point_name: Spine point name
void SetPositionToPointOn(LuaSpineObject object, LuaSpinePoNumber point_name)
See SetPositionToPoint
SpineObject object: Objects ID that should be effected
string point_name: Spine point name
void SetOnToPointFrom(LuaSpineObject object, LuaSpineObject from, LuaSpinePoNumber point_name)
SpineObject object: Objects ID that should be effected
string from: Objects ID that provides the point
string point_name: Spine point name
void SetHidden()
Hides a Spine object.
void SetHiddenOn(LuaSpineObject object)
See SetHidden
SpineObject object: Objects ID that should be effected
void SetVisible()
Unhides a Spine object.
void SetVisibleOn(LuaSpineObject object)
See SetVisible
SpineObject object: Objects ID that should be effected
void SetLayer(Number layer)
Sets the render layer of an Object. Via layers it's also able to make objects under a specific laxer not interactable.
int layer: Layer number
void SetLayerOn(LuaSpineObject object, Number layer)
See SetLayer
SpineObject object: Objects ID that should be effected
void SetInactivLayerBorder(Number layer)
Set all objects with a lower layer this value not interactable. Usefull for a menu, inventory or an intro playing ontop of a scene.
int layer: Layer [default: 0]
void AttatchToPointer()
Attatch the spine object to the mouse pointer
void AttatchToPointerOn(LuaSpineObject object)
See AttatchToPointer
SpineObject object: Objects ID that should be effected
void DeattatchAllFromPointer()
TODO not implemented jet
void DeattatchFromPointer()
Deatatch the Spine object from the pointer
void DeattatchFromPointerOn(LuaSpineObject object)
See DeattatchFromPointer
SpineObject object: Objects ID that should be effected
returns: bool IsAttatchedToPointer()
Is the attatched spine object to the mouse pointer
returns: bool IsAttatchedToPointerOn(LuaSpineObject object)
See IsAttatchedToPointer
SpineObject object: Objects ID that should be effected
returns: bool IsSomethingAttatchedToPointer()
Is something attatched to the mouse pointer
void SetRotation(Number rotation)
Rote a Spine object
float rotation: A number between 0.0 and 365.0
void SetRotationOn(LuaSpineObject object, Number rotation)
See SetRotation
SpineObject object: Objects ID that should be effected
float rotation: A number between 0.0 and 365.0
void SetScale(Number scale)
Scale a Spine object
float: Scale
void SetScaleOn(LuaSpineObject object, Number scale)
See SetScale
SpineObject object: Objects ID that should be effected
float: Scale
returns: Number GetTime()
Get time in secunds since the start of the game
void SetPlayerMaxSpeed(Number max_speed)
Set players max walking speed. Can be set to 0 if the player should not be able to walk.
float speed: Max speed value
void CreateObject(String spine_file, String id, Number scale)
Creates a game object from a Spine file
string spine_file
string id
float scale
void PlayAudio(LuaAudio file)
Play a audio file via script. It's much better to use Spine events to trigger sound to get them in sync with the animation
string file: The audio file
void StopAudio(LuaAudio file)
Stop a audio file via script.
string file: The audio file
returns:a bool indication if the audio is playing isAudioPlaying(LuaAudio file)
Checks if a audio file is playing.
string file: The audio file
void SetSpeechBubbleToPoint(LuaSpinePoNumber point_name)
Set SpeechBubble to a Spine point
string point_name: Spine point name
void SetSpeechBubbleToPointOn(LuaSpineObject object, LuaSpinePoNumber point_name)
See SetSpeechBubbleToPoint
SpineObject object: Objects ID that should be effected
string point_name: Spine point name
returns: the name as string GetID()
Get the objects ID
void SetPlayerScaleX(Number scale)
Set the players scale
float: Scale
void SetLanguage(LuaLanguage language)
Set language
string: example 'de' or 'en'
void Exit()
Exit the game
Not supported on iOS
void SaveGame()
Write a savegame
void LoadGame()
Load the savegame
void DeleteSaveGame()
Clears the savegame file