Text Window Input-Output Control

version 2 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next

  • Section: Command prompts

    The extension provides added control over the three different command prompts provided by the Inform library. Here are the three rules and activities provided for controlling the prompts:

        The "printing the command prompt" activity now controls the printing of the standard prompt seen for most commands. The character used for the prompt itself is defined, as in the standard Inform library, by the "command prompt" global variable.

        The final prompt, which is printed after the game ends, is controlled by the "flexible print the final prompt rule".

        The yes-no prompt, which is printed in response to yes-no questions, is controlled by the "yes-no prompting" rulebook. The prompt for yes-no questions can be set using the "yes-no prompt" global variable, which is initially defined as ">>". (Inform's standard library has no yes-no prompt; instead, the input directly follows the question, on the same line.)

    Both the flexible print the final prompt rule and the default yes-no prompting rule call the printing the command prompt activity. If we want to customize all of the prompts in the game in the same way, that activity is the most natural place to start. For example, to clear the current input window after each command, we might write:

        Before printing the command prompt:
            clear the current text input window.

    A note on yes-no prompting: If we are not accepting input in a separate window and want to maintain Inform's standard yes-no behavior, we can restore that behavior by setting the yes-no prompt to "" when play begins and adding the following rule to our story text:

        Yes-no prompting:
            say " [run paragraph on]";
            rule succeeds.