I’m a bit of a stickler when it comes to formatting of my text. Not that I get it correct all the time…but it does bother me when I see something out of whack. As I am continuing to practice my Inform 7 skills and increase my knowledge of the language constructs, I found myself being tripped up with one aspect of paragraph breaks repeatedly….hence this post to try and help me remember this.
One thing I run into enough is just the simple paragraph breaks that follow after hard stops at the end of some text. (http://inform7.com/learn/man/doc79.html). This seems easy enough and works the way I expected it too most of the time.
The clock tower is scenery in the town-square. The description of the clock tower is "You look up at the clock tower and see the time is [time of day]."
This produces the following results as expected.
>x tower You look up at the clock tower and see the time is 11:10 pm. >
Where I tend to run into trouble is when my description becomes a bit more complicated, where I may have nested logic in there so I’ll have to break it out into a new phrase. BTW: examples are really nonsensical for illustration purposes only…better ways to do things like this I’m sure.
The description of the clock tower is "[clock-tower-description]". To say clock-tower-description: if turn count is 2: say "You look up at the clock tower and see the time is [time of day]."; otherwise: if turn count is 3: say "You really want to see the time again?"; otherwise: say "You've looked at this before."
That produces the following output
>l town square You can see a clock tower here. >x clock tower You look up at the clock tower and see the time is 9:01 am. >x clock tower You really want to see the time again? >x clock tower You've looked at this before. >
You’ll notice the extra spacing. between the printed text and the next prompt. To fix that problem is a really easy fix, but wasn’t obvious to me at first.
The description of the clock tower is "[clock-tower-description][run paragraph on]"
Adding the [run paragraph on] phrase is letting the substituted text handle all line and paragraph breaks without the printing of the description adding it’s own.
I’m guessing that even this isn’t the best way to do things, but it is working for me for now.