Skip to content

Choice

Shows the choice display

Parameters

NameTypeOptionalDescription
questionTextContentQuestion. String or object with translations
...choicesActionChoiceExtendedChoice[]Title, children aka actions that runs when choice is selected, and other choice info

Usage

ts
engine.script({
  start: [
    a.choice(
      "What would you say to Triss?",
      {
        title: "Goodbye, Triss",
        children: [a.function(() => console.log("Bye, Triss"))],
      },
      {
        title: "Stay with me",
        children: [a.function(() => console.log("Love with Triss"))],
      }
    ),
  ],
});
ts
engine.script({
  start: [
    a.choice(
      "What would you say to Triss?",
      ["Goodbye, Triss", [a.function(() => console.log("Bye, Triss"))]],
      ["Stay with me", [a.function(() => console.log("Love with Triss"))]]
    ),
  ],
});
novely
start
  !choice
  \What would you say to Triss?
  =
    \Goodbye, Triss
    =
      !function
        %() => conosle.log("Bye, Triss")
  =
    \Stay with me
    =
      !function
        %() => console.log("Love with Triss")

Released under the ISC License.