Request for enhancement: style support for upper case

I’m working on a little extension to support a tutorial mode, where the game will point out things you can do (i.e., “Hey there’s a can there. Type TAKE CAN to pick it up.”)

Anyway, there doesn’t seem to be a way to force output to be upper-case.

In the web tier (haven’t tested this yet) can be done using fonts.

But in other envs, it would be nice if dialog could recognize that CSS style and convert output to upper case.

In the meantime, I’m just using bold.

1 Like

I’m appreciating again how fast it is to create a custom solution for this kind of thing, and how fast to test it in the skein.

On the Z-machine backend, it would be…not easy, perhaps, but doable. There’s a register called REG_UPPER that’s set to 1 to mean “print the next character in uppercase”. You could set it to some other value to mean “print in uppercase until the current div or span ends”.

The “only capitalize one letter at a time” thing is pretty deeply ingrained in the Å-machine, iirc, but everything in a style class is optional depending on backend support, and the web interpreter just passes it to the browser, which may or may not support text-transform: uppercase. Downside: the transcript, and any copy-pasted output, will still be lowercase.

Okay, I’m not at all familiar with Dialog, but thinking about Z-machine use, could you first print the output to an array, then cycle through the array and if the ZSCII (or Unicode, no clue which one would be used) is between two numbers (position of “a” and “z”), then you remove [position of “a” - position of “A”] from it and print that number?

If I’m looking at this all wrong (probably am since wrong language) then just ignore this. :slight_smile:

No, you’re right, that’s exactly how the Z-machine backend does it! Uses output stream 3 to put it into an array, then prints every character from the array, uppercasing the first one and none of the others.

Another way to improve this situation, now that I think about it, would be to have REG_UPPER 2 mean “print the next two characters in uppercase”, REG_UPPER 56 mean “print the next 56 characters in uppercase”, and REG_UPPER -1 mean “print in uppercase until I explicitly reset this value”. Then add an (uppercase $N) builtin to access this, and put the -1 case into the style-handling code.

The question is, would this be a useful enough feature to be worth the work? Or does it come up rarely enough that iterating over the characters in Dialog code (instead of in Z-machine code) is adequate?

2 Likes