Removing Empty Lines From Printout

Here is my problem. As my code grows for this game/story I have to manipulate [line break]'s and [paragraph break]'s to keep things printing with equal spacing from line to line. If I eliminate a [line break] in one place and an action elsewhere is triggered in the same location it may either omit the line break all together or amass them as in the example here.

[code]You slide in behind a pile of discarded crates in one of the many narrow passages of the east quarter. You hope the Balak Patrol will not search the shadows too deeply.

look balak

From your cover behind the crates you watch the Balak Patrol harass the patrons of the east quarter as to your where-abouts.

look patrol

The Balak Patrol is searching the eateries and salons of the east quarter in an effort to find your trail.

look balak patrol

In a state of agitation the Balak Patrol leaves the area to look for you somewhere other than the East Market.

What I want to know is - Is there a piece of code that can be written which will negate a group of [line breaks]'s such as this at the specific location at which the code is running them? Something like “remove line breaks” which can be inserted at the exact spot in the code which produces the stacked result.

No. I7’s printing mechanism prints line breaks as it goes. (It can buffer up one at a time, but if it’s going to print four, at least three are already out there.) And there’s no facility for remove text that’s already out there.

It is possible to set up line breaks and paragraph breaks so that they add up correctly. This isn’t easy, however, and this is definitely one of the worst things about I7.

Thanks zarf, I will keep fooling with it as I go maybe something will click eventually. If any one comes up with an idea this sounds like something that could be beneficial to have.

The thing is Inform isn’t saving up these blank lines, it’s printing them as it goes. So by the time your proposed “remove line breaks” runs they’re already out on the screen.

If you turn on rules listing (RULES ON) you’ll see which rules are giving line breaks and can add a [no line break] to the relevant text.

A kludge: the extension that I think is called “Text Output Filtering” fixes line breaks, but at the expense of memory and speed in a large game.

Another option might be to invoke text capture (which is an extension) just before you think a bunch of unwanted line breaks will be produced, search and replace the line breaks in the captured text, and print the text at the appropriate time. I think there is an extension that does this.


Thanks all, I will take a look at these extensions.