How do I fix my toilet so it flushes?

Here is some code I’ve written–poorly in all likelihood. I also tried “instead” instead of “carry out” for flushing the toilet. In both cases I receive this message in the game: “I only understand you as far as wanting to flush.”

A toilet is a thing. Toilet is fixed in place. Toilet is in stall #1. The description of toilet is "It's a toilet. As you would expect in a girls' bathroom, the seat is down." Understand "flush" as flushing. Flushing is an action applying to one thing. Carry out flushing a toilet: say "The water swirls away into oblivion."

What am I missing?

Your understand line needs to be:

Understand “flush [something]” as flushing.

The way you had it, literally only the command “flush” by itself would do anything, so if you typed “flush toilet”, it was seeing toilet as something extra. Any understand line for an action applying to something needs to have that something as part of the command.

-Kevin

Very quick and helpful reply Kevin. Most appreciated. My toilet is flushing away!

You may also want to add this.

Rule for supplying a missing noun while flushing: now the noun is the toilet.

Now typing in “flush” will automatically choose the toilet to flush rather than ask for a noun.

Hope this helps.

This made the light go off about rules for me…section 17.30’s example is really good. However, this brought up something confusing for me. In the example below, “flush” doesn’t seem to default to the toilet if another item is in the stall. What do I need to add?

[code]“rule-test” by Andrew

stall 1 is a room. a dirty penny is a thing in stall 1.

A toilet is a thing. Toilet is fixed in place. Toilet is in stall 1. The description of toilet is “It’s a toilet. As you would expect in a girls’ bathroom, the seat is down.”

understand the command “flush [something]” as something new.

Understand “flush [something]” as flushing. Flushing is an action applying to one visible thing.

Rule for supplying a missing noun while flushing: now the noun is the toilet.

Carry out flushing a toilet: say “The water swirls away into oblivion.”[/code]

However, the below does.

Does the player mean flushing the toilet: it is very likely.

The “rule for supplying” seems much more flexible, especially if you later might want to flush a DNS cache or a wound, but other than that, is there any big difference between “Rule for” over “Does the player mean”? Or are they equally good for simple cases?

The “supplying a missing noun” activity only applies to cases where the grammar has defined both “verb” and “verb [something]”, and the player uses the first form. Your current code doesn’t do that for “flush”, so the activity never runs – instead, the parser tries to implicitly choose a noun.

Thanks, I think I see. That’s why someone said “you may want to add this.” I assumed it was already taken care of. It’s very good to know these details–they’re impossible (and probably counterproductive) to keep track of when getting introduced to I7, and now I think I have enough knowledge that they mean and reveal something.

I was going on the fact that this was already defined.

Understand "flush" as flushing.

So, typing in “flush” would work here.

[code]“Test”

Flushing is an action applying to one thing. Understand “Flush” as flushing.

Rule for supplying a missing noun while flushing: now the noun is the toilet.

Carry out flushing a toilet: say “The water swirls away into oblivion.”.

Test me with “flush / flush toilet”.

Stall 1 is A Room.

A toilet is in stall 1. The toilet is fixed in place. The description of toilet is “It’s a toilet. As you would expect in a girls’ bathroom, the seat is down.”.[/code]

However, typing in “flush toilet” won’t. For that to work, you need “flush [something]”, like so.

[code]“Test”

Flushing is an action applying to one thing. Understand “Flush” and “Flush [something]” as flushing.

Rule for supplying a missing noun while flushing: now the noun is the toilet.

Carry out flushing a toilet: say “The water swirls away into oblivion.”.

Test me with “flush / flush toilet”.

Stall 1 is A Room.

A toilet is in stall 1. The toilet is fixed in place. The description of toilet is “It’s a toilet. As you would expect in a girls’ bathroom, the seat is down.”.[/code]

You can also have a similar thing with action requiring two nouns, like so.

[code]“Test”

Rule for supplying a missing noun while locking:
now the noun is the standard door;
say “([the noun])[command clarification break]”.

Rule for supplying a missing noun while unlocking:
now the noun is the standard door;
say “([the noun])[command clarification break]”.

Rule for supplying a missing second noun while locking:
now the second noun is the key;
say “(with [the second noun])[command clarification break]”.

Rule for supplying a missing second noun while unlocking:
now the second noun is the key;
say “(with [the second noun])[command clarification break]”.

Understand “Lock” and “Lock [something]” as locking it with.

Understand “Unlock” and “Unlock [something]” as unlocking it with.

The Testing Room is A Room. A key is in the testing room. The key unlocks the standard door.

The standard door is a locked door. The Standard Door is south of The Testing Room. The Other Room is south of The Standard Door.

Test me with “unlock / lock / unlock door / lock door / unlock door with key / lock door with key / unlock door with key / s”.[/code]

Here, there are rules for supplying both the noun and the second noun. However, it won’t work without the “understand” lines defining the corresponding vocabulary.

Hope this helps.

Thanks for the clarification. I meant to say that I misunderstood your “add” as “put this in anywhere.” It’s interesting to know why certain things are necessary, and when it doesn’t all make sense at first, explanations help speed up the whole understanding process.

Also, the unlocking example is incredibly useful, so thanks for going the extra mile, again.

Well, I don’t believe it matters whether the rules for supplying a missing noun or second noun go before or after the relevant “understand” lines, so you can pretty much put them anywhere. The most important thing is that they are both there. That said, it is much better to keep them in the same section of code, given that they work together.