Subtitles
The subtitles
object can be used to display subtitles, generally during a fullscreen cinematic of some kind where the cinematic bars are visible. The most common usage of this object is to display subtitles over the bottom cinematic bar during cindy scenes at the start of (or during) battle.
Once created, the subtitles
object may be started with subtitles:begin
and text may then be displayed with subtitles:set_text
. Displayed text may subsequently be hidden with subtitles:clear
. This is the (strongly) recommended method for using this object.
Alternatively, subtitles can be pushed onto the object with timings, prior to subtitles:begin
being called, with subtitles:push_back_subtitle
. Lastly, a subtitle file with built-in timings may be loaded with subtitles:read_subtitles_file
.
Loaded in Campaign | |
Loaded in Battle | |
Loaded in Frontend |
A subtitles
object can be retrieved from a battle
object by calling battle:subtitles
. If the subtitles
object is intended to be used to show subtitles during a cutscene, it should be noted that cutscene
objects created from the script library interface already create a subtitles
object which can be retrieved with cutscene:subtitles
. The cutscene
library also calls subtitles:begin
and sets the positioning of the subtitles to be "bottom-centre"
.
Once a handle to an subtitles object is obtained, functions may be called on it to query or modify its state in the following form.
Example - Specification:
<object_name>:<function_name>(<args>)
Example - Creation and Usage:
local s = bm:subtitles()
s:clear() -- calling a function on the object once created
Displaying a subtitle does not intrinsically play any audio. Voiceover audio, if desired, must be played separately using battle_sound_effect
objects.
The subtitles
object must be aligned on-screen before any subtitles can be displayed. Valid alignment keys are as follows:
"top_left"
"top_right"
"top_centre"
"mid_left"
"mid_right"
"mid_centre"
"bottom_left"
"bottom_right"
"bottom_centre"
Alignment keys are used when calling subtitles:begin
and subtitles:set_alignment
.
-
subtitles:begin(
alignmentstring
)
-
Starts the subtitles object with an alignment - this must be called before any subtitles are set with
subtitles:set_text
. Alternatively, if a subtitle sequence has been preloaded then that sequence is started.Parameters:
1
Subtitles alignment on-screen. Valid alignment keys can be found in the
Alignments
section of this documentation.Returns:
nil
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 11065
-
subtitles:set_text(
subtitle keystring
)
-
Instructs the subtitle object to display some subtitle text on-screen, which can subsequently be hidden with
subtitles:clear
.Parameters:
1
Subtitles key to display, corresponding to a record from the
scripted_subtitles
table.Returns:
nil
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 11101
-
subtitles:end_subtitles()
-
Stops the currently active sequence. After calling this function no subtitles will be shown until
subtitles:begin
is called.Returns:
nil
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 11128
-
subtitles:clear()
-
Clears any subtitles currently being displayed or queued to be displayed. This can be used to remove subtitles displayed with
subtitles:set_text
, or clearing/halting a subtitle sequence that was preloaded.Returns:
nil
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 11151
-
subtitles:set_alignment(
alignmentstring
)
-
Sets the on-screen alignment of displayed subtitles. Valid alignment keys can be found in the
Alignments
section of this documentation.Parameters:
1
alignment
Returns:
nil
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 11163
-
subtitles:read_subtitles_file(
file pathstring
)
-
Loads a csv file containing subtitle information. This is an old method of loading subtitles from a file.
Parameters:
1
file path
Returns:
nil
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 11193
-
subtitles:push_back_subtitle_entry(
start timenumber
,
end timenumber
,
textstring
)
-
Pushes a subtitle entry with timings to be displayed when
subtitles:begin
is called. The subtitle entries are pushed as plain text, meaning no localisation lookup is performed. Therefore, this function should not be called outside of development.Parameters:
1
Start time in ms after
subtitles:begin
is called.2
End time in ms after
subtitles:begin
is called.3
Unlocalised text to display.
Returns:
nil
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 11211
-
subtitles:push_back_subtitle(
start timenumber
,
end timenumber
,
subtitle keystring
)
-
Pushes a subtitle entry with timings to be displayed when
subtitles:begin
is called. The subtitle entries pushed should be keys for records in thescripted_subtitles
table.Parameters:
1
Start time in ms after
subtitles:begin
is called.2
End time in ms after
subtitles:begin
is called.3
Subtitles key to display.
Returns:
nil
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 11239
-
subtitles:change_if_borders_drawn(
draw bordersboolean
)
-
By default, a thin black horizontal border is drawn behind a subtitle when it is displayed. This function may be called to disable or re-enable this behaviour.
Parameters:
1
draw borders
Returns:
nil
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 11276
-
subtitles:change_if_top_border_drawn(
draw top borderboolean
)
-
Enables or disables the display of a second thin black border at the top of the screen when subtitles are displayed. This may be useful if subtitles are being displayed at the bottom (which they generally are), without cinematic borders (which is rare, but possible), and it's desired to have a matching black border at the top of the screen. This behaviour is disabled by default - use this function to enable it.
Parameters:
1
draw top border
Returns:
nil
defined in ../../common/EmpireBattle/Source/BattleScript/BattleEditorScriptInterface.cpp, line 11297