formatting (line break) bug in a text substitution? (I7)

Because I brilliantly decided to use destructible objects, I thought I’d try using a text substitution for the relevant room’s description, so that the text could describe various objects as being destroyed or not destroyed according to a set of truth states. The only problem is, I also have a piece of text that only triggers when the player enters the game/room for the very first time, and I can’t seem to get the line breaks right–it looks like just having something in an if-statement adds an extra line break or something, but it’s not clear to me how exactly this works or how to suppress the behavior the way I want it.

My code basically looks like this:

The Boring Room is a room.  "[the boring-room-state]".

To say the boring-room-state:
	if first-condition is false:
		if second-condition is true:
			say "Uninteresting text 1.";
			if third-condition is false:
				say "Some text here.[if unvisited][line break]Some more text here.[run paragraph on][end if]";
				if fourth-condition is true:
					say "Uninteresting text 2.";
					say "Uninteresting text 3."

The problem is third-condition’s “Some text here” and “Some more text here.” As it currently stands, the line breaks display correctly the first time through, but when I leave the room with my PC and come back, I have an extra line break after “Some text here.” Could anyone offer some pointers, or let me know what I’m supposed to look this up under? I tried poking around in Aaron Reed’s book but suspect I am not looking in the right place. Thank you in advance for your help.

This is just a guess (since you didn’t post a full working example, and I’m too lazy to flesh out your code into one), but would moving the “[run paragraph on]” out of the “[if unvisited]…[end if]” section perhaps help?

I nearly always use the Terrible Offset Periods Normal Form, which would look like this:

if third-condition is false:
         say "Some text here[if unvisited].[paragraph break]Some more text here[end if].[run paragraph on]";

In fact you can convert the entire thing to TOPNF, which makes it somewhat simpler:

The Boring Room is a room.  "[the boring-room-state].".

To say the boring-room-state:
	 say "Some text here[if unvisited].[paragraph break]Some more text here[end if]";

Note that the room description property ends with a period, so the boring-room-state phrase will never print a period at the end of its output. It will only contain internal periods. This avoids the need for run-paragraph-on entirely.

(Although this will trip you up if you want the room description to sometimes end with a question mark. Things get uglier then.)

Zarf, yours did the trick (I tried it first, haven’t tried vyznev’s proposed fix). Thank you both!

I use that a lot, but I get tripped up when I need something other than a period at the end. Especially when it’s in quotation marks. Here’s something I used in A Killer Headache:

[code]The sentence-ending punctuation is a text that varies. The sentence-ending punctuation is usually “.”;

To say period:
Now the sentence-ending punctuation is “.”;

To say comma:
Now the sentence-ending punctuation is “,”;

To say question mark:
Now the sentence-ending punctuation is “?”;

To say exclamation point:
Now the sentence-ending punctuation is “!”;

To say end sentence:
Say the sentence-ending punctuation;
Say period.

There’s also an extension for punctuating quoted text properly: … index.html