Menu
Menu
lets you create a menu in your visual novel. It is used to navigate between different parts of the story.
Menu.prompt("What should I do?")
.choose("Go left", [
character1.say("I went left"),
scene1.jumpTo(scene2)
])
.choose("Go right", [
character1.say("I went right")
])
Static Method
prompt
Create a menu with a prompt.
prompt: SentencePrompt | Sentence | null | undefined
- The prompt to display to the playerconfig?: MenuConfig
- MenuConfig
Public Method
constructor
Overload 1 of 5
prompt: SentencePrompt
- See SentencePromptconfig?: MenuConfig
- MenuConfig
Overload 2 of 5
prompt: Sentence
- The prompt of the menu, See Sentenceconfig?: MenuConfig
- MenuConfig
Overload 3 of 5
prompt: SentencePrompt | Sentence
- The prompt of the menuconfig: MenuConfig
- MenuConfig
Overload 4 of 5
prompt: null
- No prompt for the menuconfig?: MenuConfig
- MenuConfig
Overload 5 of 5
prompt: SentencePrompt | Sentence | null
- The prompt of the menuconfig: MenuConfig
- MenuConfig
Chainable Method
choose
Add a choice to the menu.
Overload 1 of 3
new Menu("what should I do?")
.choose({
prompt: "go left",
action: [
character1.say("I went left"),
]
})
choice: MenuChoice
- The choice of the menu, See MenuChoice
Overload 2 of 3
new Menu("what should I do?")
.choose(new Sentence("go left"), [
character1.say("I went left"),
])
prompt: Sentence
- The prompt of the choice, See Sentenceaction: ActionStatements
- The action of the choice, See ActionStatements
Overload 3 of 3
new Menu("what should I do?")
.choose("go left", [
character1.say("I went left"),
])
prompt: SentencePrompt
- See SentencePromptaction: ActionStatements
- The action of the choice, See ActionStatements
hideIf
Magic method to hide the last choice if the condition is true.
menu.choose(
"Go left",
[character.say("I went left")]
).hideIf(persis.isTrue("flag"));
Note: This method will override the last choice's config.hidden
condition: Lambda<boolean> | LambdaHandler<boolean>
- The condition to check
disableIf
Magic method to disable the last choice if the condition is true.
Note: This method will override the last choice's config.disabled
menu.choose(
"Go left",
[character.say("I went left")]
).disableIf(persis.isTrue("flag"));
condition: Lambda<boolean> | LambdaHandler<boolean>
- The condition to check
enableWhen
Add a choice, only enable when the condition is true.
menu.enableWhen(persis.isTrue("flag"), "Go left", [
character.say("I went left")
]);
condition: Lambda<boolean> | LambdaHandler<boolean>
- The condition to checkprompt: Sentence | SentencePrompt
- The prompt of the choiceaction: ActionStatements
- The action of the choice
showWhen
Add a choice, only show when the condition is true.
menu.showWhen(persis.isTrue("flag"), "Go left", [
character.say("I went left")
]);
condition: Lambda<boolean> | LambdaHandler<boolean>
- The condition to checkprompt: Sentence | SentencePrompt
- The prompt of the choiceaction: ActionStatements
- The action of the choice