intfiction.org

The Interactive Fiction Community Forum
It is currently Sat Jan 19, 2019 4:54 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Sun Jan 06, 2019 10:54 am 
Offline

Joined: Fri Aug 07, 2015 5:44 am
Posts: 15
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
Code:
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
Code:
glk_select(gg_event)
and then looping until
Code:
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? ;)

Thanks in advance!


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sun Jan 06, 2019 11:48 am 
Offline

Joined: Sat Jan 23, 2010 4:56 pm
Posts: 5884
Have you taken a look at my Unified Glulx Input extension? It's intended to let you do input planning like this.

https://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.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Jan 07, 2019 10:07 am 
Offline

Joined: Fri Aug 07, 2015 5:44 am
Posts: 15
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.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Mon Jan 07, 2019 7:53 pm 
Offline
User avatar

Joined: Wed Oct 14, 2009 4:02 am
Posts: 2579
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: https://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.


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: GiannisG, necrodeath and 18 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group