[i7] change the text of player's command to upper case?

I have noticed recently that the following command has the side effect of converting “say Hello Luke” to “say hello luke”.

change the text of the player's command to "say Hello Luke";

This is odd, because it is my understanding that whereas Z-code player commands are case-insensitive, Glulx allows case sensitive player commands (and yes, I have verified that I am compiling this in Glulx). Indeed, if I don’t try to ‘change’ the player’s command and simply type in ‘say Hello Luke’ at the command line, the two upper case letters are preserved: it is only if I try to ‘change’ the command to some text that includes upper case that the upper case letters are converted to lower case.

I wonder if this behaviour is intentional and if it is specified anywhere. Is there a rationale for it? I can’t find any reference to a ‘change the text of’ statement auto-converting anything into lower case: neither at inform7.com, nor on this forum.

I wonder if there is an alternate way to successfully change the player’s command to something that includes upper case letters. I did try stuff like…

change the text of the player's command to "SAY HELLO LUKE" in upper case

…just to see if I could effect a change in the results, but nope - it always comes out lower case, regardless.

[P.S. Don’t try to make sense of WHY I am implementing dialogue in this ‘say Hello Luke’ fashion because I’m not. That was just a quickie example I invented for the purpose of illustrating this apparent deficiency in the language. The actual mechanic I am designing is much more complex, has nothing to do with dialogue, and involves processing words from player commands for output WITHOUT associating them with any pre-existing object; thus, I cannot substitute the ‘official’ name for an object, and can only rely on what the player actually typed as a guide to how it should be capitalised - but it seems I can’t do that if I also need to change anything in the command prior to letting i7 process it, because the ‘change’ operation obliterates case.]

This doesn’t seem to be mentioned anywhere in the documentation, but it’s likely due to the parsing mechanisms on the Z-machine. The Z-code version of the parser distinguishes case, so if you feed it “JUMP” or “Jump” instead of “jump” you’ll get an unknown word error. Inform folds case when setting the player’s command to avoid running into bugs because of this. The Glulx parser, on the other hand, expects case to be preserved from the player’s input, so it doesn’t care about the case of words when parsing. So folding case isn’t really necessary there.

After a bit of experimentation I’ve made a tiny extension which changes this behavior. If you include it nothing will change on Z-machine, but the case of the modified command will be preserved on Glulx. Might also be worth filing a bug report.

1 Like

Draconis: Basically you encapsulated an i6-level hack in an extension. Neato. Makes it cleaner, I suppose. That’s very helpful. Thank you!