Transcript recording of output to bannerwindows?

I’m working on a game where approximately half of the interesting content occurs in a bannerwindow, and have discovered that the script command only records content from the main window. I’ve spent a few hours digging through the adv3 code and can’t figure out what I need to hack to change this.

It looks like I could keep a separate file to record the contents of the bannerwindow, and could probably then write the main window contents there as well, but I was kind of hoping to hook into the existing mechanisms.

Anyone have advice?

-Chris

Banners use the BannerOutputStream class for output. Its writeFromStream() method is responsible for showing text on screen. All you have to do is override that method and do a call to logConsoleSay():

[code]modify BannerOutputStream {
// We override this in order to write output from banners to the main
// window’s log file.
writeFromStream(txt)
{
// Allow the overridden method to perform whatever it does.
inherited(txt);

    // Log all output to the main window's log file.
    logConsoleSay(MainWindowLogHandle, txt);
}

}[/code]

It just occurred to me that the above will log all banners, including the status line, which is definitely not what you want.

One way to have only specific banners have their output written to the main log file is to subclass BannerOutputStream instead of modifying it, and also subclass BannerWindow. First, we create a BannerOutputStreamMainLog subclass of BannerOutputStream:

class BannerOutputStreamMainLog: BannerOutputStream { writeFromStream(txt) { inherited(txt); logConsoleSay(MainWindowLogHandle, txt); } }

Now we need a subclass of BannerWindow that uses BannerOutputStreamMainLog. BannerWindow uses createOutputStream() to create its BannerOutputStream, so we override that in our subclass to use a BannerOutputStreamMainLog instead. We will use the default implementation with the only change being the creation of a BannerOutputStreamMainLog instance instead of a BannerOutputStream one:

[code]class BannerWindowMainLog: BannerWindow {
createOutputStream()
{
// Create a banner output stream.
outputStream_ = new transient BannerOutputStreamMainLog(handle_);

	// Set up the default filters.
	outputStream_.addOutputFilter(typographicalOutputFilter);
	outputStream_.addOutputFilter(new transient ParagraphManager());
	outputStream_.addOutputFilter(styleTagFilter);
	outputStream_.addOutputFilter(langMessageBuilder);
}

}[/code]

Now whenever you need banners that write to the main log file, make them of class BannerWindowMainLog instead of BannerWindow.

Thanks Nikos, I’ve tested this and it solves the problem nicely. I had actually looked at logConsoleSay(), but thought I was on the wrong track because the only place that is used in adv3 is in the LogConsole class (in output.t) which isn’t referred to anywhere else.

I really appreciate the help… I was expecting a pointer maybe, not a complete implementation. :slight_smile:

-Chris