In Unified Glulx Input, is there yet any way to run testme-like commands for character input, or might there be any time in the semi-near future?
I tried the workaround of starting in the parser with line input so that I could at least enter the command ‘test me’, and then just hoped individual keystrokes might womp through, but unsurprisingly that doesn’t work.
There currently is not. Adding such a thing might not be too hard.
What would it look like? If you want to do it in the current version of Inform, you have to fit it into the current TEST declaration syntax, which looks like
Test me with "command / command / command".
(Where the commands can contain anything but quotes. Slashes can be escaped as [/]. Um, and they’re limited to Latin-1 characters – but the current library can’t process Unicode characters in line input, so no loss.)
We could define more special formats, perhaps
Test me with "normal input / $link 23 / $char Q / $char escape / $charcode 325 / $timer".
You’d implement this by gussying up CheckTestInput (in the UGI code) to recognize a leading dollar sign and return a different event type in a_event. The caller is able to filter out unwanted event types, as you’ve already discovered.
Bit of a nuisance, since you’d have to parse character-by-character in I6 code. But doable.
I am wrapped up with Lectrote right now, but if somebody wants to submit a patch, that would be great…
As for triggering the test in a keystroke-only game, you’d have to define a keystroke to be the TEST ME debug command! Crudely:
To test-me: (- special_word = 'me'; TestScriptSub(); -).
Thanks for the leads. I’ve no idea if changing CheckTestInput like so is within my capabilities (can probably tell in a few seconds when I glance at it) but failing that, I’ll get there with some help eventually.