Flexible Windows

version 13/130803 by Jon Ingold

  • Home page
  • Beginning
  • Previous
  • Next



  • Chapter 6 - Echo streams
        
    To set the/-- echo stream of (win1 - a g-window) to the/-- stream of (win2 - a g-window):
        (- glk_window_set_echo_stream({win1}.ref_number, glk_window_get_stream({win2}.ref_number)); -)
        
    To set the/-- echo stream of (win1 - a g-window) to the/-- echo stream of (win2 - a g-window):
        (- if (glk_window_get_echo_stream({win2}.ref_number)) {glk_window_set_echo_stream({win1}.ref_number, glk_window_get_echo_stream({win2}.ref_number)); } -)
        
    To echo the/-- stream of (win2 - a g-window) to the/-- stream of (win1 - a g-window):
        (- glk_window_set_echo_stream({win1}.ref_number, glk_window_get_stream({win2}.ref_number)); -)
        
    To shut down the/-- echo stream of (win - a g-window):
        (- if (glk_window_get_echo_stream({win}.ref_number)) { glk_window_set_echo_stream({win}.ref_number, GLK_NULL); } -)
        
    To decide whether (win - a g-window) has an/-- echo stream:
        (- (glk_window_get_echo_stream({win}.ref_number)) -)


    [The following phrase allows us to print text directly to the echo stream of a window, bypassing the window itself. We can, for example, use it to print text directly to the transcript, without showing the written text during play at all. For example, if the SCRIPT ON command is active, the echo stream of the main window is almost certain to be the transcript. If we want to write one block of text to the transcript alone, and a second block of text to both the screen and the transcript, we could do this:

        say "[echo stream of main-window]This text goes only to the transcript. [stream of main-window]This text goes to both the main-window and the transcript."
    ]

    To say echo stream of (win - a g-window):
        (- if (glk_window_get_echo_stream({win}.ref_number)) { glk_stream_set_current( glk_window_get_echo_stream({win}.ref_number) ); } -)
        
    To say stream of (win - a g-window):
        (- glk_set_window({win}.ref_number); -)