Re-printing text that was printed earlier

Mostly I want it to not print anything except at say time.

If it kept track of the newline state until say time and then printed all the necessary newlines, then you could adjust the state before that moment and make it do anything you wanted.

4 Likes

Alright, here’s a new version. I’ll put it on Github once I’ve stress-tested it a bit more, but it appears to work on both Z-machine and Glulx. Paragraphing now appears to work properly, at least in a few test cases, including capturing absolutely nothing.

The one case where I think it may not work properly, based on how I coded it, is if you print something that should prompt a paragraph break, then print empty captured text, that paragraph break might be lost. But I haven’t been able to make this happen in practice, so some arcane quirk of Inform’s paragraphing code might be fixing this problem before it happens.

It also now provides the phrase “say the/-- captured text without formatting”. This does exactly what you’d expect. I was hoping I could use phrase options, but you can’t do that in say phrases.

Bonus: I finally found a reason to “use ineffectual”, the use-option that does nothing! This extension now replaces Text Capture completely, but a lot of other extensions specifically depend on Text Capture, so I needed to dike out each heading of Text Capture and replace it with nothingness. But Inform (9.3 at least) crashes if you replace a non-empty heading with an empty one. So I put “use ineffectual” into each heading to placate it.

Formatting Capture.i7x (7.3 KB)

Please do put it through its paces; I’ve ensured the basic effect works on both Z8 and Glulx, but I want a general utility extension like this to be as bug-free as possible.

2 Likes

So far, in all the cases I’ve tried,

(call rules that print stuff)

is showing the same behavior as

start capturing text;
(call rules that print stuff)
stop capturing text;
say the captured text;

(I’m using Glulx in version 6L38.)

Thanks.

1 Like