Was reading a recent topic on line breaks and I think this is a good time to ask–
What is a good way to avoid line breaks when a condition (ie an ‘if’ test) is placed after sentence-ending punctuation within quoted text? I have something like the following in my game–
say "Water begins to flow from the spigot.[if the large bucket is on the drain]It splashes into the bucket!"
It results in–
[code]Water begins to flow from the spigot.
It splashes into the bucket!
[/code]
I solve this problem by–
say "Water begins to flow from the spigot. [if the large bucket is on the drain]It splashes into the bucket!"
Which yields–
[code]Water begins to flow from the spigot. It splashes into the bucket!
[/code]
But then if the bucket is not on the drain, I get this—
[code]Water begins to flow from the spigot.
[/code]
To solve this, I put an ‘[otherwise][line break]’ after the “It splashes…!”
Found out that an [end if] works just as well. But what, exactly, is the proper way to type ‘if’ tests within quoted text, to get exactly one paragraph break before the next prompt??
I do it mostly by avoiding exclamation points, so that I can write
say "Water begins to flow from the spigot[if the large bucket is on the drain]. It splashes into the bucket[end if]."
But you are looking for the more general case, which is why you used an exclamation point in the example to begin with.
For those cases, I bypass Inform’s auto-line-break rules entirely, by avoiding true punctuation and writing my own paragraph breaks.
To say period: (- print "."; -);
To say exclam: (- print "!"; -);
Every turn:
say "Water begins to flow from the spigot[period][if the large bucket is on the drain] It splashes into the bucket[exclam][end if][paragraph break]";
The [period] and [exclam] print the appropriate character but Inform doesn’t count them as sentence-ending.
Thank you so much, Zarf. I know that this was really kind of a ‘trivial’ matter, but I am trying to keep my game from looking sophomoric, eliminating extra or no paragraph breaks. Thanks for the tips.