LogoPixi’VN
ナレーションJS/TSによるナレーション

Input prompt

Explains how to prompt the player for input in Pixi’VN, including usage, retrieval, and removal of input requests.

UI 画面

You can find an example of the input prompt dialog UI in the interface examples section.

ink

このメソッドは ink 構文で使用できます。 See more here.

In visual novels, you may need to ask the player to enter text, numbers, dates, or other values.

Pixi’VN provides functions to handle input prompts. The developer can require the player to enter a value (the game will not continue until a value is provided), while the UI is responsible for displaying the prompt.

選択の実行

To prompt the player for input, use the narration.requestInput function.

content/labels/start.label.ts
import { narration, newLabel } from "@drincs/pixi-vn";

export const startLabel = newLabel("start", [
    () => {
        narration.dialogue = "Hello";
    },
    () => {
        narration.dialogue = "What is your name?";
        narration.requestInput({ type: "string" });
    },
    () => {
        narration.dialogue = `My name is ${narration.inputValue}`;
    },
    () => {
        narration.dialogue = "How old are you?";
        narration.requestInput({ type: "number" }, 18);
    },
    () => {
        narration.dialogue = `I am ${narration.inputValue} years old`;
    },
    () => {
        narration.dialogue = "Describe who you are:";
        narration.requestInput({ type: "html textarea" });
    },
    () => {
        narration.dialogue = `${narration.inputValue}`;
    },
    () => {
        narration.dialogue = "Restart";
    },
]);

取得

To get input prompt information, use:

if (narration.isRequiredInput) {
    openInputModal(narration.inputType);
}

削除

To remove the input prompt request, use narration.removeInputRequest.

narration.removeInputRequest();

このページの内容