Text Window Input-Output Control

version 2 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next



  • Section - Yes-No question prompting

    [There is one other situation in which the prompt is not controlled by the standard prompt printing activity. This is when the player answers a yes-no question, such as in response to whether she wishes to quit or restart the game, or to the "if the player consents" phrase. To handle these cases, we provide a rulebook and a global variable for holding an alternate prompt that can be used in the input window for yes/no questions only.]

    The yes-no prompting rules are a rulebook.

    The yes-no prompt is a text variable. The yes-no prompt is ">>"

    [Ths saving, switching, and restoring of the prompt text is a bit awkward, but it allows for a different prompt to be used w/o requiring the surrounding behavior--i.e., the before and after rules for the command prompt activity to be specified twice--i.e., with one activity for the standard prompt, and one for the yes-no prompt.]

    Last yes-no prompting rule (this is the default yes-no prompting rule):
        say line break;
        let saved-prompt be the command prompt;
        now the command prompt is the yes-no prompt;
        carry out the printing the command prompt activity;
        now the command prompt is the saved-prompt.