Slight Inform 7 question: capitalize substitutions

How do you capitalize an object substitution?

For example:

Hovel is a room. “[Crumbling trash] lies everywhere.”

Some crumbling trash is scenery in Hovel.

The output is

Hovel
crumbling trash lies everywhere.

How do I make crumbling trash capitalized in this context?

Well, it depends what you mean by upper case. The Inform documentation refers to title case as what I’d guess you mean…

room 1 is a room.

the codex is a thing in room 1.

crumbling trash is scenery in room 1.

instead of examining the codex:
	let X1 be "[crumbling trash]" in upper case; [all caps]
	let X2 be "[crumbling trash]" in title case; [1st letter caps]
	say "[X1] [X2]";

Are you sure there’s no easy way to make a substitution capitalized at the beginning of a sentence?

It’s probably not the most elegant solution, but this definitely works:

To say Crumbling trash: let N be "[crumbling trash]" in sentence case; say "[N]".

Oh, man. I completely misunderstood the question. I didn’t even consider you wanted that, for some reason. Please don’t ask me why.

It’s chapter 19, section 4 of the Inform documentation, by the way. I know I got intimidated by the final chapters. It’s tough to know what to search for at first.

And also, welcome, and keep asking questions!

Basically, ‘in sentence case’ can be used to make indexed text capitalise at the beginning of a sentence (which is what you want here), as per 19.4 of the documentation. Unfortunately, an object substitution doesn’t count as indexed text. I assume you’re bracketing objects in line with Aaron Reed’s suggest to get BENT. I’d say it might just be simpler that when an object is the first word of a sentence, unbracket it after making sure you’ve definitely implemented the object. Obviously, if it’s critical that you bracket, the code I just showed does the trick just fine.

Easy to generalize as well:

Hovel is a room. "[crumbling trash in sentence case] is here". 

Some crumbling trash is a thing.

To say (O - an object) in sentence case:
	let T be "[O]" in sentence case;
	say T.

I think this is safe, too:

To say (Obj - object) in mixed case: (-  print (Cap) {Obj}; -).
Hovel is a room. "[Crumbling trash in mixed case] lies everywhere."
Some crumbling trash is scenery in Hovel.

The differences from “say in sentence case” would be two:
the above doesn’t invoke the indexed text machinery,
and it preserves existing uppercase letters in the printed name.
("[empty bottles of Coke in sentence case]" would result in ‘Empty bottles of coke’, whereas “[empty bottles of Coke in mixed case]” would print ‘Empty bottles of Coke’.)

What if an object is the first word of a sentence in a Library message?

The library messages starting with object names all use articles of some sort: “The trash…” or “Some trash…”