Buffer, then accept input via hyperlink OR character input

I’m trying to create function in Inform 7 that allows me to get an input from the player (sometimes yes or no, but not always), where the player can input their selection by pressing an appropriate key or clicking a hyperlink.

I’ve managed to get both to work independently; I can get a character with VM_KeyChar() and then keep looping until the input is validated as an acceptable option, or I can get a hyperlink input by waiting for a timed event with glk_select(gg_event) and then looping until the glulx replacement command is an acceptable option. But I can’t work out a way to do both - as when I wait for a character input, the game will not progress until a character is pressed, and when I wait for a timed event, I don’t know how to simultaneously check for the most recent character input.

I’m hopeful there’s a super straightforward way to be able to accept either, and one of the experts here can enlighten me? :wink:

Thanks in advance!

Have you taken a look at my Unified Glulx Input extension? It’s intended to let you do input planning like this.

github.com/erkyrath/i7-exts/blo … 0Input.i7x

The down side is that it’s not integrated with the more familiar extensions like Multiple Windows or so on. Which it sounds like you’re using. (I forget which one “glulx replacement command” is from.) So you’d have to get rid of those and do everything through UGI, which is some amount of starting over.

Hi Zarf,

Thanks a lot that looks very interesting and I’m sure somewhere within that is the solution to my problem. I have pretty much zero experience of I6 so I’m a bit lost but will do my best to try and see if I can sort it. I am indeed using flexible windows.

My first look at the commenting suggests that perhaps InputRDataInterruptInput is the function I need to be able to cancel a char input. I will investigate further!

EDIT: Hmm, this might be a bit above my head. I might just have to wait for the day that the extension is made compatible with flexible windows.

Yeah, sorry this is far from ideal right now. Events is really a weak spot in the extension ecosystem.

My recommendation would be to convert from one type of input to the other. By using a glulx input handling rule you can filter for one type of event and then map it to the other by changing the “glk event type” variable. If you need to change the value you can also change “glk event value 1”. You can see any example here: github.com/i7/extensions/blob/d … ks.i7x#L38

This shouldn’t require any I6. But it will still be a bit complicated. If you can show the full code you’re using we should be able to help you write the conversion code.

Hi Dannii, sorry I thought I replied to this a while ago but clearly it didn’t post successfully. Just wanted to say thank you so much, that trick has worked beautifully for me.

Glad to hear it! :slight_smile: