Documentation
Character

Character

⚠️

This page is under construction.

⚠️

Beta feature, subject to change.

Character controls the dialogues of the character.

Note: Character do not control the appearance of the character or image. For that, you can use Image.

Public Method

constructor

  • name: string | null - If null, then it is a narrator. Narrator do not show any name in the dialogue box.
  • config?: DeepPartial<CharacterConfig> - CharacterConfig

Chainable Method

say

Overload 1 of 4

Say a sentence.

character
    .say("Good morning!")
    .say("How are you?")
  • content: string - The content of the sentence
  • config?: SentenceUserConfig - SentenceUserConfig

Overload 2 of 4

Use custom Sentence object.

character.say(
    new Sentence(character, [
        "Good morning, I am ",
        new Word("Alice", {color: "#f00"}), // Some words can be colored
    ])
) // will output "Good morning, I am Alice" with "Alice" in red color

Note: The dialogues's name will be the same as the sentence's name.

Overload 3 of 4

Use mixed content of string and Word object.

character.say([
    "Hello, ",
    new Word("Alice", {color: "#f00"}), // Some words can be colored
]) // will output "Hello, Alice" with "Alice" in red color

Overload 4 of 4

Use short-hand for SentencePrompt.

character.say`Hello, ${Word.color("Alice", "#f00")}!` // will output "Hello, Alice" with "Alice" in red color
  • texts: TemplateStringsArray - The template string array
  • ...words: SingleWord[] - SingleWord

setName

Set the name of the character.

character
    .setName("Alice (angry)")
    .say("What do you want?")
  • name: string - The name of the character