Glulx Input Loops

version 1/101121 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next



  • Chapter: Event loop flow

    Now that we have identified all of the appropriate terms, here is the full flow for a primary loop:

        1. Follow the before rules for the input looping activity (hook for authors).
        2. Update the status line.
        3. Follow the input loop setup rules for the focal event type of the loop.
        4. Wait for input.
        5. Follow the input loop event-handling rules for the glk event received. If the outcome is:
            a. success/stop input loop processing: go to step 6.
            b. failure/continue input loop processing: go to step 3.
            c. delay input handling (success): go to step 3.
        6. Follow the Glulx Entry Points (glulx input handling) rulebook for the received event. If the outcome is:
            a. success/failure/no decision: go to step 7.
            b. replace player input: the player's input is replaced with the glulx replacement command (see Glulx Entry Points); go to step 7.
            c. require input loop to continue: go to step 3.
        7. If the focal event type of the loop is line event and we have interrupted line input, restart it now.
        8. Follow the after rules for the input looping activity (hook for authors).
        9. (Loop ends)

    And here is the flow for a secondary loop:

        1. Follow the before rules for the input looping activity (hook for authors).
        2. Update the status line.
        3. Follow the input loop setup rules for the focal event type of the loop.
        4. Wait for input.
        5. Follow the input loop event-handling rules for the glk event received. If the outcome is:
            a. success/stop input loop processing: go to step 6.
            b. failure/continue input loop processing: go to step 3.
            c. delay input handling: go to step 6.
        6. Follow the after rules for the input looping activity (hook for authors).
        7. (Loop ends)
            a. If the input loop event-handling rules ended in success, the Glulx Entry Points (glulx input handling) rulebook in the parent loop will fire for the event processed.
        
    The examples below, particularly "Under Doom," illustrate some of the ways in which we can use both types of loop. The Glimmr Form Fields extension also makes extensive use of Glulx Input Loops.