version 13/130803 by Jon Ingold
Chapter: Echo streams and the transcript
With multiwindowed layouts, we may run into questions about what should be written to the transcript--if we have three windows, all of them displaying text, which of these should go to the transcript. The Inform library provides for only the main window to write to the transcript, but by using "echo streams" we can exercise much more control over what gets written.
Glulx allows each window to specify a maximum of one echo stream. An echo stream is another window or more often, a file on the hard disk, to which the output of the stream is "echoed". The most common use for this functionality is to allow for the main window to be echoed to the transcript file (the standard behavior of Inform after the player has entered the SCRIPT ON command). Flexible Windows provides a number of phrases that allow for the testing, assignment, and specification of echo streams.
First, we can test whether a given window has an echo stream like so:
if the side-window has an echo stream
This will be true whether the side-window is echoing to the transcript or to another window.
We can also find out whether the transcript is currently be written to an external file (in other words, whether the transcript stream itself currently exists or not):
if we are writing to the transcript
And we can directly set any window to write to the transcript:
echo the stream of the side-window to the transcript
Any number of windows can be simultaneously echoed to the transcript.
We can also direct windows to echo to other windows--essentially, both windows will display the same text at the same time. This probably has no real use apart from brief special effects, but is available nonetheless. These two phrases set the echo stream of the side window so that it will echo the main window's content:
set the echo stream of the side-window to the stream of the main-window
echo the stream of the main-window to the stream of the side-window
We can also set a window's echo stream to be the same as the echo stream of another window:
set the echo stream of the side-window to the echo-stream of the main-window
A window stops echoing when either the window itself, or the stream to which it was echoing, is closed. We can also manually cease echoing a window's ouput:
shut down the echo stream of the side-window
Finally, it is possible to write directly to the echo stream of a window, bypassing the window itself. This is likely to be most useful for selectively streaming information to the transcript:
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."