Input without the enter key

This is a discussion / support forum for the Hugo programming language by Kent Tessman. Hugo is a powerful programming language for making text games / interactive fiction with multimedia support.

Hugo download links: https://www.generalcoffee.com/hugo
Roody Yogurt's Hugo Blog: https://notdeadhugo.blogspot.com
The Hugor interpreter by RealNC: http://ifwiki.org/index.php/Hugor

Moderators: Ice Cream Jonsey, joltcountry

User avatar
Ice Cream Jonsey
Posts: 28881
Joined: Sat Apr 27, 2002 2:44 pm
Location: Colorado
Contact:

Input without the enter key

Post 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?
the dark and gritty...Ice Cream Jonsey!

Roody_Yogurt
Posts: 2179
Joined: Mon Apr 29, 2002 6:23 pm
Location: Milwaukee

Post 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.

User avatar
Ice Cream Jonsey
Posts: 28881
Joined: Sat Apr 27, 2002 2:44 pm
Location: Colorado
Contact:

Post 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. :)
the dark and gritty...Ice Cream Jonsey!

Roody_Yogurt
Posts: 2179
Joined: Mon Apr 29, 2002 6:23 pm
Location: Milwaukee

Post 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.

User avatar
pinback
Posts: 17672
Joined: Sat Apr 27, 2002 3:00 pm
Contact:

Post 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!
I don't have to say anything. I'm a doctor, too.

User avatar
Ice Cream Jonsey
Posts: 28881
Joined: Sat Apr 27, 2002 2:44 pm
Location: Colorado
Contact:

Post 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.
the dark and gritty...Ice Cream Jonsey!

Roody_Yogurt
Posts: 2179
Joined: Mon Apr 29, 2002 6:23 pm
Location: Milwaukee

Post by Roody_Yogurt »

I think it looks dumb, too! Which is why I did something about it!

Post Reply