Page 1 of 1

Input without the enter key

Posted: Mon Jan 09, 2012 12:58 am
by Ice Cream Jonsey
Argh, I am sure I've asked this before. Can Hugo do input and act on it without the enter key being hit? Like if I wanted to let a player start a game by hitting "S" instead of "S" and then enter, is that possible?

Posted: Mon Jan 09, 2012 1:04 am
by Roody_Yogurt
You can't do it at a normal prompt, but you could do it at a pause. Take this code from the Guilty Bastards hint system:

Code: Select all

:GetHintKey
		pause
		if word[0] = 'Q', 'q', ESCAPE_KEY
			jump PickHintTopic
		if word[0] = 'H', 'h'
		{
			topic.hints_revealed++
			print newline
			jump PrintHints
		}
		jump GetHintKey
(where the only way to get out of the loop is to hit 'q' or 'h')

Not sure if that's what you mean.

Posted: Mon Jan 09, 2012 8:34 am
by Ice Cream Jonsey
That's perfect, I do believe!

Also, while I have you here, I'd like to ask one more question, then I'll listen off the air.

What is the term you gave the routine you put together to have the game's text begin at the top of the display, rather than the bottom? My new WIP has a three-line intro, and I'd rather it not begin at the bottom of the screen. :( I know we talked about this, but I forget what you were calling this functionality. :)

Posted: Mon Jan 09, 2012 10:56 am
by Roody_Yogurt
I use the locate command for that. The only thing is, locate doesn't work well in the main window in glk interpreters like Gargoyle, so in my games, I use it with my glk-checking extension:
http://roody.gerynarsabode.org/glk.h

I add a call to the routine "glkcheck" to the init routine, then, right before I print anything, I put the lines:

Code: Select all

if not glk
     locate 1, 3  !  I like three lines down. Do whatever.

Posted: Mon Jan 09, 2012 10:59 am
by pinback
Ice Cream Jonsey wrote:My new WIP has a three-line intro, and I'd rather it not begin at the bottom of the screen.
UMM, WHY DO YOU WANT THAT??

Nah, I'm just kidding. But I am curious!

Posted: Mon Jan 09, 2012 11:15 am
by Ice Cream Jonsey
I think it looks dumb! To have the text start at the bottom. Especially since I'll be asking players to have a giant window open otherwise.

Posted: Mon Jan 09, 2012 11:25 am
by Roody_Yogurt
I think it looks dumb, too! Which is why I did something about it!