Glulx Input Loops

version 1/101121 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next



  • Section - Handling for a char event

    First input loop event-handling rule for a char-event when the focal event type of the current input loop is char-event (this is the basic char event handling rule):
        now keystroke-code is the character code returned;
        now keystroke is the keystroke-code resolved to an indexed text;
        #if utilizing input loop debugging;
        say "-->Keystroke ([the keystroke-code cleansed for printing]) received.[line break]";
        #end if;

    First input loop event-handling rule when the focal event type of the current input loop is char-event (this is the char event null assignment rule):
        if the current glk event is not char-event:
            now keystroke-code is the null char;
            now keystroke is "";
            #if utilizing input loop debugging;
            say "-->Input other than char-event received. Assigning null char to keystroke-code variable.[line break]";
            #end if.

    Last input loop event-handling rule for a char-event when the focal event type of the current input loop is char-event (this is the complete char event handling rule):
        stop input loop processing.

    The char event null assignment rule is listed before the basic char event handling rule in the input loop event-handling rules.

    To say (N - a number) cleansed for printing:
        if (N > 31 and N < 127) or (N > 160 and N < 384):[i.e., we have a standard keystroke and not an unprintable one]
            say "[N]: '[char-code (N)]'";
        otherwise:
            say "[N]".