[Hugo] out with multiple choices

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: 28923
Joined: Sat Apr 27, 2002 2:44 pm
Location: Colorado
Contact:

[Hugo] out with multiple choices

Post by Ice Cream Jonsey »

Let's say I wanted to do the following in Hugo:

Code: Select all

>out

Which way do you mean? Through the red door or the green door?
Is it possible to get "out" (as a direction) starting a question for the user like that, when there are two door objects in the room? How would I do that?
the dark and gritty...Ice Cream Jonsey!

Merk
Posts: 192
Joined: Mon Nov 22, 2004 3:19 pm
Location: Wichita, KS
Contact:

Post by Merk »

Sure. I did this in TTS. There is spot where a ladder leads up (south of you) and steps lead up (north of you). If the player tries to go UP, the game asks them to be more specific.

I didn't do it exactly like you want, though. I think I give a message like "you can climb the ladder to the south or the stone steps to the north" -- something like that. They'll either type "climb ladder" or "climb steps" or maybe "north" or "south". What you're looking for is something that the Hugo engine itself does -- disambiguation. But that only happens when it's trying to match objects to a verb definition, and more than one object qualifies without any rules to treat one as more important than the other.

I know of know good way to mimic *that* behavior. In order for the user to answer the question, you'd either have to (a) have verbs set up that *are* the answers, or (b) maybe give a custom prompt. But that's not ideal, because the user should be able to pick neither, and type something else entirely.

You *might* be able to do it with a PreParse() routine. I think, though, that PreParse() doesn't get called until the engine has already parsed the command line into the word[] array. Actually, it'd have to be like that, else PreParse() would have nothing to look at. If that's the case, the engine will already have complained that their answer ("red door" or "green door") doesn't start with a verb.

But again, you could make pseudo verbs "red" and "green". Have a flag any time the game is actually expecting the user to type one of them (otherwise the flag is false). When it's false, the VerbRoutine can call the library "that's not a verb I recognize" mesasge (or whatever it says).

If I think of any other ideas, I'll post again. It seems like maybe I'm forgetting something that might help.

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

Post by Ice Cream Jonsey »

Thanks, Merk. Yeah, there are definitely some ways to hit this up. I guess I like the slickness of the game asking a direct question to the user, but if it doesn't end up being in the game it won't be the end of the world. Thank you again for your perspective!
the dark and gritty...Ice Cream Jonsey!

Merk
Posts: 192
Joined: Mon Nov 22, 2004 3:19 pm
Location: Wichita, KS
Contact:

Post by Merk »

I'm disappointed that nothing really clever comes to mind. I mean, you *could* mimic the behavior by just asking the question and then pausing with a prompt, but it just wouldn't be as slick as real disambiguation because anything that *doesn't* answer the question wouldn't get parsed by the engine.

For now, you could just state that it's not clear (without actually phrasing it as a question), and then do something better if a better idea comes along. If you do figure something out, I'd be happy to know what. There are times where I'd have used the same kind of thing if there was a way.

Zork VI

Post by Zork VI »

>out

Which way do you mean? Through the red door or the green door?

>look green door

While considering an exit, a large impact is made to the top portion of your skull. The last thing you see is a large, hairy, poorly lighted creature draging you through the YELLOW door (the one behind you), that then precedes to devour you whole and semi-concious.

You scored 0 out of 8719 points earning you the rank of, Wondering Prophet.

RESTART, RESTORE, or EXIT?

>restore

EXIT is not spelled RESTART. I'll now correct this mis-spelling for you. Arn't I wonderful?

Zork X

Post by Zork X »

>out

Which way do you mean? Through the red door or the green door?

>look green door

The door flies off its hinges and smacks you in the face! Blood running down your eyes, a hand leaving the mark dripping red, the last thing you see is an edge of textured, floating green, above your face before it smashes and connects to the ground through your head.

You scored 9 out of 2032032039 points, giving you the rank of Wonderful Russian.

RESTORE, RESTART, EXIT?

>exit

This game isn't good enough for you, eh? Fuck you! For that, we'll restart and you can play from the beginning because you missed the gum wrapper, you fucken twit.

Vitriola

Post by Vitriola »

Poor Alana.

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

Post by Ice Cream Jonsey »

Merk wrote:I'm disappointed that nothing really clever comes to mind. I mean, you *could* mimic the behavior by just asking the question and then pausing with a prompt, but it just wouldn't be as slick as real disambiguation because anything that *doesn't* answer the question wouldn't get parsed by the engine.

For now, you could just state that it's not clear (without actually phrasing it as a question), and then do something better if a better idea comes along. If you do figure something out, I'd be happy to know what. There are times where I'd have used the same kind of thing if there was a way.
Yeah, I doubt I will come up with something more elegant, but if I do I'll update this thread or mail you. The prompt doesn't bother me all that much, I suppose, and I think newbies would be able to comprehend it instantly.
the dark and gritty...Ice Cream Jonsey!

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

Post by Ice Cream Jonsey »

Zork X wrote:This game isn't good enough for you, eh? Fuck you! For that, we'll restart and you can play from the beginning because you missed the gum wrapper, you fucken twit.
Hey now. That was more a Hitch-Hiker's Guide thing. Although if I remember correctly you could waste a lot of time in Zork III if you didn't do something unmotivated.

I think you can get Fallacy of Dawn in an unwinnable state and that always bugged me. But I think you had to start shooting people to get it that way. And hell, in that case a game (of life?) should be "unwinnable."
the dark and gritty...Ice Cream Jonsey!

Post Reply