[I7] Changing things at just a push of a button?

In Bob Bates’ Arthur, and many other games, it was possible to change the screen layout by pressing F1, F2 etc… Is that still possible to implement now and if not why not? (I can’t see why it would be possible 23 years ago but not now.)

It is possible to intercept the function keys as interrupts for line input. (It’s a defined Z-machine capability, and I finally added it to Glulx last year.) You’ll have to do some I6 work to turn this on.

However, because it’s been so rarely used post-Infocom, interpreters may not support the feature. You’d have to do a bunch of testing.

You can certainly do it with Glulx, though using the function keys exclusively is probably not be a great idea: many fkeys get repurposed by the OS or by the user–especially on laptops–you won’t find them on mobile devices, etc. Also, it’s possible that some interpreters might reserve them for the terp’s use; I’m not sure what the Glulx spec says about that.

The only Inform project I can think of that offers multiple layouts is Glimmr Canvas Editor, which places windows differently depending on whether the canvas you’re working with is portrait or landscape. But doing that is simple–all you need to switch layouts is recognize that the key has been pressed, then close all of your glulx windows and reopen them with the appropriate new settings.

If your layout switches are tied to a single keypress, then you will have another issue: You would need your layout keys to be always awaiting single-key input, but presumably your game should otherwise generally be waiting for line input–and these two types of input are mutually exclusive in Glulx. (The ability to detect certain keys, including function keys, during line input has recently been added to Glulx, but I’m not sure if you could trust all interpreters on that at this point.)

The easiest way to implement layout changes would be to use hyperlinks, graphic buttons, or a typed command (e.g. TOGGLE LAYOUT) to change the layout, rather than a keystroke. Alternatively, you could install something like Smarter Parser, which reimplements the parser using single keystrokes, and then the issue of detecting special keys during line input would pretty much go away. (Again, though, I’m not sure you can use the function keys in all interpreters–they don’t seem to work in the Inform IDE, for one thing.)

EDIT: I see Zarf has already mentioned the new Glulx capability.

The project I’m working on looks like it’s going to have a very busy status bar, so being able to toggle big-bar/little-bar at the push of a button seems like it’d be a neat extra. Because it’s an extra and because I’d also have it work with bespoke out-of-world actions as well, it’s not really a big deal if not everyone is able to use the function key shortcuts. That said, I could try for broader use by having it tied to the - and + buttons.

Grid windows such as the status bar do support mouse input, so you could also have a shrink/expand “button” in the status bar itself (e.g., a plus or minus sign as appropriate for the current state). Anyone without function keys could then just click on the +/- with the mouse…

That’s a superb suggestion, I might well do just that!

Re: a TOGGLE LAYOUT command,

I started (but have filed in a cupboard) a glulx version of Leadlight. And it has a status bar with multiple elements you can toggle on or off separately . So the way I did it was, to enter status bar editing mode, you enter the command CONFIG. Then a little numbered menu appears (1 Exits 2 Health bar 3 Compass, etc). At that point, tapping the numbers in the menu (no pressing RETURN) toggles the corresponding elements of the status bar on or off. So the player can toggle away til they like what they see, then they press RETURN again to go back to the parser.

  • Wade