Documentation
Types
SentenceConfig

SentenceConfig

type SentenceConfig = {
    pause?: boolean | number;
    voice: Sound | null;
    character: Character | null;
    voiceId: string | number | null;
    color?: Color;
    metadata?: SentenceMetadata;
    avatar?: DialogAvatar | false;
} & Font;

For SentenceMetadata, see below. For DialogAvatar, see Dialog.

User-facing partial config is SentenceUserConfig.

For Font, see Font.

pause

Whether / how long to pause after the sentence. boolean or duration.

voice

The voice that will say the sentence.

If you specify voice, voiceId is ignored.

character1.say("hello!", {
    voice: new Sound({
        src: "/your/path/to/voice.mp3"
    })
});

voiceId

Unique identifier for the voice. It can be a string or a number.

For example, if you have a lot of voice files, you can use voiceId to pick a file.

const voiceScene = new Scene("voice-scene", {
    voices: {
        "a_1_1": "/your/path/to/voice.mp3"
    }
});
 
voiceScene.action([
    character1
        .say("hello!", {
            voiceId: "a_1_1"
        }),
]);

Or use a handler to resolve paths:

const voiceScene = new Scene("voice-scene", {
    voices: (id) => `/static/game/sound/bgm/${id}.mp3`
});

character

The character that speaks the sentence. Overrides the previous character when set.

color

Text color for the sentence.

new Sentence("hello!", {
    color: "red"
});
 
new Sentence("hello!", {
    color: "#ff0000"
});
 
new Sentence("hello!", {
    color: {
        r: 255,
        g: 0,
        b: 0
    }
});

metadata

Runtime-only object attached to the sentence (SentenceMetadata, Record<string, unknown>). Not serialized with save files. Use plain serializable data when possible. Read back via Sentence.getMetadata().

avatar

Per-line dialog avatar override: static source, resolver, or false to hide the avatar for this line. See Dialog.