Inform 7 – Paragraph Breaks in Text Substitutions

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.

Advertisements

One thought on “Inform 7 – Paragraph Breaks in Text Substitutions

  1. [line break] or [paragraph break] are both possibilities. My usual solution is, wherever possible, to end the text string that contains the substituted text with a full-stop. This wouldn’t work in your example above, as one of the possibilities ends in a question mark, but ordinarily:

    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]”;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s