Input without the enter key
Moderators: Ice Cream Jonsey, joltcountry
- Ice Cream Jonsey
- Posts: 30184
- Joined: Sat Apr 27, 2002 2:44 pm
- Location: Colorado
- Contact:
Input without the enter key
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?
the dark and gritty...Ice Cream Jonsey!
-
- Posts: 2256
- Joined: Mon Apr 29, 2002 6:23 pm
- Location: Milwaukee
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:
(where the only way to get out of the loop is to hit 'q' or 'h')
Not sure if that's what you mean.
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
Not sure if that's what you mean.
- Ice Cream Jonsey
- Posts: 30184
- Joined: Sat Apr 27, 2002 2:44 pm
- Location: Colorado
- Contact:
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. :)
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. :)
the dark and gritty...Ice Cream Jonsey!
-
- Posts: 2256
- Joined: Mon Apr 29, 2002 6:23 pm
- Location: Milwaukee
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:
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.
- pinback
- Posts: 17919
- Joined: Sat Apr 27, 2002 3:00 pm
- Contact:
- Ice Cream Jonsey
- Posts: 30184
- Joined: Sat Apr 27, 2002 2:44 pm
- Location: Colorado
- Contact:
-
- Posts: 2256
- Joined: Mon Apr 29, 2002 6:23 pm
- Location: Milwaukee