Indents in text

Is there a way to insert a tab or indent in a description or SAY command? I can use multiple white spaces but would like to align text and can’t find this feature. Thanks for any possible help.

Are you looking for “tab stop” functionality like you might find in a word processing program or a typewriter? For example, you would want to be able to do something like:

say "BARDOLPH:[tab]Well met, Corporal Nym.";
say "NYM:[tab]Good morrow, Lieutenant Bardolph.";

with the “[tab]” substitution automatically advancing to a single present indentation (or the next in a series)? Or are you looking for some more specific functionality?

Also, are you looking for this to work for fixed width font, variable width font, or both?

1 Like

Thanks for your response. I’m looking for basic tab stop functionality that you describe. But I must be missing something obvious. When I try your text with no tab and my defined HELP function

Instead of helping, say “BARDOLPH: Well met, Corporal Nym.”.

I get the text expected above. When I try:

Instead of helping, say “BARDOLPH: [tab] Well met, Corporal Nym.”.

I get the error “I was expecting that ‘tab’ would be something to ‘say’, but it didn’t look like any form of ‘say’ that I know.” I have tried everything I can think of and still get an error. Any more suggestions as to what I’m doing wrong?

The [tab] thing was a hypothetical. It doesn’t actually exist.

(Well, you can define it as something that can be said, but it can’t do a tab stop.)

I don’t think Inform really has any features like that. If you switch to fixed letter spacing, then you could mimic it to some extent, but otherwise since you don’t have any control over what fonts the interpreter is using there isn’t really any reliable way to line text up.

If you want to limit yourself to a specific web interpreter on a specific site, then you might be able to use some CSS tricks to do it, but that’s about all, I think.

2 Likes

Thank you so much. Even knowing that it doesn’t exist lets me move forward. I agree, a monospaced font will work just fine for this.

Basically, Inform expects conversation to be written in prose, not as script.

If that’s the case, then you might be able to use simple tricks like this (with citations to certain parts of Writing With Inform, the built-in documentation, that might be of interest):

"Indentation"

Place is a room.

Spaces per tab is initially 4.

To say (T - text) indented to level (N - number): [see WWI 11.1 What are phrases? and 11.3 Pattern matching]
    let spaces needed be N times spaces per tab;
    repeat with counter running from 1 to spaces needed:
	    say " "; 
    say "[T]"; 

After waving hands:
    say "You wave,[line break]" indented to level 3;
    say "and wave,[line break]" indented to level 4;
    say "and wave.[line break]" indented to level 5.

To say (T - text) padded to (N - number):
    let spaces needed be N minus the number of characters in T;
    if spaces needed is greater than zero:
	    say "[T]";
	    repeat with counter running from 1 to spaces needed:
		    say " "; 
    otherwise: [text too long to fit within "padded" length, so truncate it]
	    repeat with counter running from 1 to N:
		    say "[character number counter in T]";  [see WWI 20.3 Characters, words, punctuated words, unpunctuated word, lines, paragraphs]

After jumping:
    say "[fixed letter spacing]"; [see WWI 5.9 Text with type styles; this phrase only works with monospaced fonts]
    say "You" padded to 10;
    say "jump" padded to 10;
    say "jump" padded to 10;
    say "jump. [line break]";
    say "Then you" padded to 10;
    say "jump" padded to 10;
    say "some more.";
    say "[variable letter spacing]".

Test me with "wave / jump". [see WWI 2.8 The TEST command]
2 Likes

Fun fact: anywhere that you use:

    say "[any phrase in square brackets]";

(Just the phrase by itself without anything else in the quotes), you can equivalently write:

    say any phrase in square brackets;

(The same phrase without the quotes and brackets.)

This is just a stylistic choice; both produce identical code in the end, so you can use whichever method you prefer.

4 Likes