Function; Subtitle_Message_Handlerw - HWRM/KarosGraveyard GitHub Wiki
This function is defined in leveldata/multiplayer/lib/lib.lua
:
function Subtitle_Message_Handlerw(text, seconds, sound, playerID)
if playerID == Universe_CurrentPlayer() then
Subtitle_Messagew(text, seconds)
Sound_SpeechPlay(sound)
end
end
There is first a check to see if the desired player index matches the current player (the player who's game is currently executing the script). This is to avoid displaying the message multiple times as scripts are run by various machines.
Then, we call Subtitle_Messagew
to display the message, and Sound_SpeechPlay
to play a sound file.
Param | Type | Description |
---|---|---|
w_string |
userdata |
A userdata value containing a wide-char string. |
duration |
number |
The duration to display the message for, in seconds. |
sound_fx_path |
string |
A path to a sound file. |
player_index |
number |
The index of the player we want to display the message for. |
-- Fill in a template string found in a `.dat` file with the args supplied to it
-- and return a wide char string as userdata
local subtitleMessage = Message_FormatFs("$14782", localizedShipName)
Subtitle_Message_Handlerw(subtitleMessage, 2, "data:sound\\speech\\allships\\emperor\\STATUS_GETCRATESHIP_1", iPlayer)