Outputting text to a transcript only.

Not sure if this is even possible with Inform (whether dropping to I6 or not), but I would like to send some text to a transcript but not to the screen. For example, if this was going to the interpreter output screen:

West of House
You are standing in an open field west of a white house, with a boarded 
front door.
There is a small mailbox here.

>open mailbox
Opening the small mailbox reveals a leaflet.

Then something like this might go to the actually transcript:

West of House
You are standing in an open field west of a white house, with a boarded 
front door.
There is a small mailbox here.

>open mailbox
<<This text is only visible in the transcript>>
Opening the small mailbox reveals a leaflet.

This would be written into the source code something along the lines of the following pseudocode:

After opening the mailbox:
    if transcripting:
        say "<<This text is only visible in the transcript>>".
    say "Opening the small mailbox reveals a leaflet."

I’m sure it’s not that simple, but is something like this even possible?

In the Z-machine, yes. I think you’d do something like this (untested).

Include (-
[ StartTranscriptOnly ;
    @output_stream -1;
];

[ StopTranscriptOnly ;
    @output_stream 1;
];
-).

To start transcript-only text:
    (- StartTranscriptOnly(); -).
To stop transcript-only text:
    (- StopTranscriptOnly(); -).

This just turns the primary output stream off and on again. If another output stream, such as the transcript, is open, it’ll still receive anything printed in the interim.

In Glulx, I’m not entirely sure how Glk output streams work. I think it may be something similar.

Cool, thanks!! I’ll give that a try.

Daniel, that worked great for z-machine.

I worked out some code that seems to work in Glulx

	
Section - Glulx Commands (for Glulx only)

To say echo stream of main window:
	(- glk_stream_set_current( glk_window_get_echo_stream(gg_mainwin) );  -)
	
To say stream of main window:
	(- glk_set_window(gg_mainwin); -)

to start transcript-only:
	say echo stream of main window.
	
to stop transcript-only:
	say stream of main window.

I don’t know much about Glulx, for you experts out there…any reason this shouldn’t work generally? This works in my simplistic tests, anything I’m not considering?

One thing to test: what if you have transcript-only text while printing to the status bar or another window?

That will work as long as transcripting is on. Check “if (gg_scriptstr ~= 0)” first and skip the entire operation if it’s not.

(gg_scriptstr and glk_window_get_echo_stream(gg_mainwin) should always be the same thing. But you don’t want to do glk_stream_set_current(0) and then print anything. Errors.)