📌  相关文章
📜  harlowe prompt (1)

📅  最后修改于: 2023-12-03 15:31:06.080000             🧑  作者: Mango

Harlowe Prompt

Harlowe prompt is a built-in feature of the Harlowe story format in Twine. It enables the use of input prompts, where the user can enter text or make choices to continue the interactive fiction narrative.

Syntax

The syntax for using a Harlowe prompt is as follows:

(set: $variableName to (prompt: "This is the prompt text."))

The "prompt" macro is used to display the text of the prompt, which is enclosed in quotation marks. The user's response is stored in the variable specified in the "set" macro.

For example:

(set: $name to (prompt: "What is your name?"))
Support for Choices

Harlowe prompt also supports choices, where the user can select from a list of pre-defined options.

The syntax for using a choice prompt is as follows:

(set: $variableName to (prompt: "This is the prompt text.", optionName1, optionName2))

The prompt text is enclosed in quotation marks, followed by the list of options separated by commas.

For example:

(set: $color to (prompt: "What is your favorite color?", "red", "blue", "green"))
Markdown support

In addition to simple text prompts and choices, Harlowe also supports the use of Markdown within the prompt text. This allows for visually rich and dynamic prompts that can include images, links, and other formatting.

To include Markdown in a prompt, simply enclose the text within double square brackets.

For example:

(set: $description to (prompt: "Please describe your character [[(with emphasis on any distinguishing features, like a prominent scar or unusual clothing)]]"))
Conclusion

Harlowe prompt is a powerful tool for creating interactive fiction with Twine. Whether it's a simple text input or a complex choice prompt with Markdown formatting, the prompt feature enables a wide range of storytelling possibilities in your interactive fiction narratives.