Magical way to generate (seemingly) random line breaks

So I was seeing spurious line breaks when testing my code. For instance:

>z
Time passes.

>z
Time passes.


>

No obvious reason for the extra blank line on the second one. Commented out every line of code I could find in the rules and phrases where it seemed to be occurring. Finally narrowed it down to this phrase:

To say (speech text - a text) as (speaker - a thing) near (locale - a thing):
	let X be number of moves from the location to the location of the locale, using even locked doors;	
	let ST be the substituted form of speech text;	
	if locale is in the location:
		say ST;
	otherwise if X is 1:
		let BR be best route from the location to the location of the locale, using even locked doors;
		say "You can hear someone speaking [BR] from here.";
	Now the last utterance of the speaker is ST;	

The idea of this phrase is that characters in other rooms could speak, and this phrase would not only prevent them from being heard elsewhere, but would capture any speaker’s last utterance and allow the player to ask them to repeat it later.

It’s not at all clear what’s happening in there that could cause an extra line break, but after playing with it I discovered that using the word “say” itself like this generates the line break when the phrase is called, although I’m not sure why. So I had another character somewhere talking who made this happen. Looking back on it, yeah, this definition is kind of perverse, but it was the wording I liked best :slight_smile: What’s most surprising to me, actually, is that Inform allows this definition at all!

3 Likes