Sentence
⚠️
This page is under construction.
Sentence is a part of the Character. It is used to construct a dialogue.
Constructing a sentence:
import { Sentence } from 'narraleaf-react';
const character = new Character("character 1");
const sentence = new Sentence([
"Hello, ",
Word.color("world", "#f00") // words can be colored,
], {
character,
});
or
const sentence = new Sentence("Hello, world");
or
const sentence = new Sentence([
"Hello, ", persis.get("playerName"), "!"
]);
Public Method
constructor
text: SentencePrompt
- See SentencePromptconfig?: Partial<SentenceUserConfig>
- SentenceUserConfig
copy
Copy the sentence
const sentence = new Sentence("Hello, world");
const sentence2 = sentence.copy();
- Returns:
Sentence