Confused about capitals

Hi,

Is there an easy way to force Inform to stick a capital at the start of a built sentance ?

Can you make it track full stops somehow?

Say we have a scientist and they are talking to Mrs Jones.

We can define The scientist - but that always gives a capital, or the scientist - but that drops the definite artcle.

So if we build a sentance with say “[the person-name ] is [action-name] [person2-name]”;

we’d get ‘the scientist is talking to Mrs Jones’ (wrong) or ‘Mrs Jones is talking to The scientist’ (also wrong) .

I don’t want to have to write a chunk of code that somehow takes words and the builds a phrase (to be honest I wouldn’t know how to do so in Inform) .

In hope as I’m stuck…

I may be misunderstanding the question, but you can capitalize the ``the’’ in the substitution to have the text it prints also capitalized:

say "[The person-name] is [action-name] [person2-name].";

You can also use this.

say "(something)" in sentence case;

Hope this helps.

Hi,

Many thanks for the replys. Do either of these methods keep track of past ‘say’ commands and if they contained a full stop?

I have a batch that build up what an npc is doing, sometimes there is a full stop, sometimes its a list (blah, blah, blah etc).

So I’m getting capital letters when there was a list or no caps at the start of a sentence.

I was wondering if that was what you meant. Neither of those two methods track previous says, but that can in fact be done in Glulx, albeit with some long-winded code:

[code]To decide what Unicode character is a full stop: (- 46 -).
To decide what Unicode character is a question mark: (- 63 -).
To decide what Unicode character is a bang: (- 33 -).
To print (C - a Unicode character): (- glk_put_char_uni({C}); -).
To decide what Unicode character is (C - a Unicode character) in uppercase: (- glk_char_to_upper({C}) -).
To decide what Unicode character is (C - a Unicode character) in lowercase: (- glk_char_to_lower({C}) -).

At beginning of sentence is a truth state that varies. At beginning of sentence is true.
To effect sentence capitalization of (C - a Unicode character) (this is sentence capitalization):
if at beginning of sentence is true:
if C is not C in uppercase: [a letter to capitalize]
print C in uppercase;
now at beginning of sentence is false;
otherwise if C is not C in lowercase: [a letter already capitalized]
print C;
now at beginning of sentence is false;
otherwise:
print C;
otherwise:
if C is a full stop or C is a question mark or C is a bang:
now at beginning of sentence is true;
print C.
To say no automatic capitalization:
now at beginning of sentence is false.

To force sentence capitals: (- @aload (+ sentence capitalization +) 1 sp; @setiosys 1 sp; -).
A startup rule (this is the force sentence capitals rule):
force sentence capitals.

Section “Demo”

There is a room.
When play begins:
say “testing …[no line break][no automatic capitalization] one, two, three. test. test?”[/code]

Hmmm, many thanks for this - yes it is a bit complicated to say the least. I’m guessing that it would not work on a z machine interpreter due to the to print section? I wonder if there would be a way of grabbing the input to say and the somehow running through it looking for a stop - never heard of an explanaiton make called a bang before :slight_smile:

In C you could zip though a character string and in good old Basic there was the instr function in many implementations would using indexed text be a solution?

Say, unfortunately, cannot be completely overridden. Even if it could, a lot of the text printed by the Standard Rules isn’t printed via say. That’s why the Glulx code intercepts at a lower level.

The effect above can be also be accomplished on the Z-machine, though by a slower, more heavyweight process. See Ron Newcomb’s Output Filtering.

But if you control all of the printing that needs recapitalization (I had assumed not in my last reply), both of these suggestions are like sandblasting tissue paper. It would be much simpler to declare a truth state that varies to track whether you’re at the beginning of a sentence, and then have your own code check and update that truth state. You can use the trick in the Rocket Man example for substitutions that don’t have capitalized variants.