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
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.