captions
The written form of every line anybody speaks. This game is voiced, and a spoken line ships with its text on screen at the same time: it is how the line survives a failed generation, a muted player and a noisy room.
screens.captions
The written form of every line anybody speaks. This game is voiced, and a spoken line ships with its text on screen at the same time: it is how the line survives a failed generation, a muted player and a noisy room.
local Captions = require("screens.captions")
Captions.say("The tide's early. It's always early.", "The Lingster")
Three routes reach the same queue, so a slice that cannot require this module still gets its line on screen:
Captions.say(text, who, seconds?)— the direct call.Rules.emit("hernsew:say", text, who, seconds?)— the signal, no require.sound.voicealready raises this for every line it speaks and every line it fails to speak.Rules.state["hernsew.caption"] = { text = …, who = … }— the blackboard.
who is the speaker's name as it should read on screen ("The Lingster",
"Skerr"). Pass seconds when the clip's real length is known —
audio.info(bytes).durationMs / 1000 is the right number — so the text is up
for exactly as long as the voice is. Left out, it is estimated from the line's
length, which is close enough for a line nobody voiced.
A line arriving while another is up waits its turn rather than stamping over it;
past three waiting it is dropped, because a caption nobody can read in time is
not a caption. screens.frontend calls Captions.tick once a frame and draws
whatever it returns.
Scoped to this part · feeds back into the world's score.