StoryTeller - stingray.StoryTeller object reference - Stingray Lua API Reference

stingray.StoryTeller object reference

Description

A class that can play stories, or cutscenes.

Each game world maintains its own StoryTeller object, which you can retrieve by calling World.storyteller().

Note that in addition to playing stories from the Lua StoryTeller object, you can also play stories from flow.

Functions

Parameters

self :

stingray.StoryTeller

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

id :

integer

The ID of the story whose end time you want to retrieve.

Returns

number

The global end time of the story.

Parameters

self :

stingray.StoryTeller

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

id :

integer

The ID of the story to test.

Returns

boolean

Returns true if the story is playing, or false otherwise.

Parameters

self :

stingray.StoryTeller

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

id :

integer

The ID of the story.

Returns

number

The length of the story.

Parameters

self :

stingray.StoryTeller

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

level :

stingray.Level

The level that contains the story to play.

name :

string

The name of the story to play.

Returns

integer

An ID for the playing story that you can use to control playback.

Parameters

self :

stingray.StoryTeller

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

id :

integer

The ID of the story.

mode :

integer

The new loop mode to set for the story. Can be any loop mode value.

Returns
This function does not return any values.

By default, stories loop over the entire range of the story.

Parameters

self :

stingray.StoryTeller

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

id :

integer

The ID of the story to set up.

start :

integer

The start time of the new loop range.

stop :

integer

The end time of the new loop range.

Returns
This function does not return any values.
Parameters

self :

stingray.StoryTeller

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

id :

integer

The ID of the story whose speed you want to set.

speed :

number

The speed at which to play the story, expressed as a multiplier of the normal speed.

Returns
This function does not return any values.

The default is 1.0, which means the story plays at normal speed. A value of 0.5 would play the story at half speed.

If you want complete manual control over how the time in the story is advanced, set the speed to 0.0 and use set_time() to manually advance the time in the story.

Parameters

self :

stingray.StoryTeller

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

id :

integer

The ID of the story whose time you want to set.

time :

number

The new time within the story.

Returns
This function does not return any values.
Parameters

self :

stingray.StoryTeller

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

id :

integer

The ID of the story whose start time you want to retrieve.

Returns

number

The global start time of the story.

Parameters

self :

stingray.StoryTeller

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

id :

integer

The ID of the story you want to stop.

Returns
This function does not return any values.
Parameters

self :

stingray.StoryTeller

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

id :

integer

The ID of the story whose time you want to retrieve.

Returns

number

The current time within the story.

Loop modes

The constants in this group refer to the different ways that the StoryTeller can handle reaching the end of a story or the end of a loop range.

This is the default mode.

It will not loop back to the beginning.

PING_PONG : integer

When the story reaches the end, it will continue to play the story backward until it reaches the beginning, then continue forward again.