Faucett in a sink

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
Tdarcos
Posts: 9342
Joined: Fri May 16, 2008 9:25 am
Location: Arlington, Virginia
Contact:

Faucett in a sink

Post by Tdarcos »

I'm trying to have a faucet in a sink that the user can get water out of it. I'll flesh it out but I just want to have the system recognize I can do this.

Given the following

Code: Select all

object sink "sink"
{
	in Kitchen
	article "a"
	is static, container
}
object faucet "faucet"
{
	in Sink
	article "a"
	is static, openable
	is not open
}

This is what happens (forget the redundant descriptions, I'll drop those later):

You're in the control center
You are in the main control center. You can go in any of the twelve directions from here.

>in

You're in the kitchen off the control center
You are in a typical kitchen/break room of an office but expanded since people often spend considerably more time than normal here. There is a stove with an
oven, a refrigerator, a microwave oven, a sink with a faucet, a coffee pot on a coffee maker, and some packets of coffee sitting on the counter. There really
isn't much you'd want to do here. Go OUT to return to the control center.
A stove with an oven, a microwave oven, a sink, a refrigerator, and a coffee maker are here. Inside the sink is a faucet. Sitting on the coffee maker is a
coffee pot.

>open faucet
That doesn't make any sense.

If faucet is a component instead of an object then it doesn't show up as being in the sink. And I still can't open it. Funny, it worked for the drain valve in Teleporter Test, only that was in the room, not in an object. Do I have to tell the sink or the faucet it's reachable from the kitchen or something?
"I really feel that I'm losin' my best friend
I can't believe this could be the end."
- No Doubt, Don't Speak

User avatar
Tdarcos
Posts: 9342
Joined: Fri May 16, 2008 9:25 am
Location: Arlington, Virginia
Contact:

Post by Tdarcos »

Adding the following

Code: Select all

object hose "hose"
{
	in Kitchen
	article "a"
	is static, openable
	is not open
}
Gives the same error trying to open it as the faucet when in the kitchen.
"I really feel that I'm losin' my best friend
I can't believe this could be the end."
- No Doubt, Don't Speak

User avatar
Tdarcos
Posts: 9342
Joined: Fri May 16, 2008 9:25 am
Location: Arlington, Virginia
Contact:

Post by Tdarcos »

Found the problem.

Code: Select all

object faucet "faucet"
{
	in Sink
	article "a"
	adjectives "faucet"
	is static, openable
	is not open

}
I needed to give the faucet an adjective even though it was the same as its name, and then it will recognize the "open" command. I think I'll add "turn" and "on" and "off" for it too.
"I really feel that I'm losin' my best friend
I can't believe this could be the end."
- No Doubt, Don't Speak

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

Post by Roody_Yogurt »

Actually, instead of adjective, you should be giving it the noun "faucet" (and yes, the noun and adjective properties are completely separate from the name property, as far as the parser is concerned).

Also, you may want to look at Future Boy!'s plumbing code, as that might save you some work: http://hugo.gerynarsabode.org/index.php?title=Plumbing

User avatar
Tdarcos
Posts: 9342
Joined: Fri May 16, 2008 9:25 am
Location: Arlington, Virginia
Contact:

Post by Tdarcos »

Roody_Yogurt wrote:Actually, instead of adjective, you should be giving it the noun "faucet" (and yes, the noun and adjective properties are completely separate from the name property, as far as the parser is concerned).
Why, what's the significance? Is there a reason for using "noun" (or is it "nouns", or both) over "adjectives", and why do you say "adjective", is that just straight English response or is it also an alias for "adjectives"? How would you know which?
Roody_Yogurt wrote:Also, you may want to look at Future Boy!'s plumbing code, as that might save you some work: http://hugo.gerynarsabode.org/index.php?title=Plumbing
Thanks for the suggestion, right now I just have the faucet in the kitchen sink to fill the coffee pot. It provides a whole bunch of fun things. The coffee pot is initially on top of the coffee maker empty, if you start the coffee maker without putting water in the pot, the (dry) coffee pot shatters and melts. If you say "fill pot" or "fill pot from faucet" and you left the pot on the coffeemaker, it tells you you're not holding it. If you didn't start the faucet it tells you it's not running. (Oh damn, I need to add the verb "run" so someone can "run faucet" if it's not there.) So then you can put the pot on the coffee maker and start it, to get a pot of hot water. So I don't think I need that much capability yet.

Actually, come to think of it I might use the plumbing capability in the other bathroom.
"I really feel that I'm losin' my best friend
I can't believe this could be the end."
- No Doubt, Don't Speak

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

Post by Roody_Yogurt »

Tdarcos wrote:
Roody_Yogurt wrote:Actually, instead of adjective, you should be giving it the noun "faucet" (and yes, the noun and adjective properties are completely separate from the name property, as far as the parser is concerned).
Why, what's the significance? Is there a reason for using "noun" (or is it "nouns", or both) over "adjectives", and why do you say "adjective", is that just straight English response or is it also an alias for "adjectives"? How would you know which?
I believe the parser gives higher priority to noun properties over adjective properties, so if you have another object with "faucet" as a noun, that object will always be chosen, instead of getting a proper, 'Which faucet do you mean?' response (of course, it's unlikely that you'll have two faucets in one room, but still, there's something to be said about doing things the right way).

And yeah, "adjectives" is an alias of "adjective" and "nouns" is an alias of "noun." I usually just refer to the single form.

Bainespal
Posts: 151
Joined: Fri Jul 09, 2010 8:59 am

Post by Bainespal »

Roody_Yogurt wrote: I believe the parser gives higher priority to noun properties over adjective properties, so if you have another object with "faucet" as a noun, that object will always be chosen, instead of getting a proper, 'Which faucet do you mean?' response (of course, it's unlikely that you'll have two faucets in one room, but still, there's something to be said about doing things the right way).
Also, my understanding of the Hugo Book (page 46 according to the notation on the page, literally page 56 in the PDF doc) is that any combination of adjectives can come before a noun in the player's command. So, if the adjectives were "leaky" and "silver" and the noun was "faucet," the player could type "X LEAKY SILVER FAUCET" or "X SILVER" but not "X FAUCET SILVER LEAKY".

Post Reply