Action not performing as I expected

I want the player to have to remove the cap from the tube of toothpaste before he can squeeze the tube.

[code]The tube of toothpaste is a thing on the sink.

The description of the tube of toothpaste is “Ipana.”

The cap is part of the tube of toothpaste.

Understand “remove [something] from [something]” as removing it from.

Instead of removing the cap from the tube of toothpaste:
if the cap is part of the tube of toothpaste:
say “You take the cap from the tube of toothpaste.”;
now the player carries the cap;
otherwise:
say “The cap isn’t on the tube of toothpaste.”

Instead of squeezing tube of toothpaste:
if cap is on tube of toothpaste:
say “You need to remove the cap first.”;
stop the action;
otherwise:
say “You squeeze a bit of toothpaste onto the brush.”;
now the toothbrush is full;
stop the action.[/code]

But I7 is allowing me to squeeze the tube (putting a squiggle of toothpaste on the toothbrush) without removing the cap.

The condition “if X is on Y” represents the support relation (a book being on a table) rather than the incorporation relation (a lid being part of a box). In this case you’ve used incorporation to represent the cap being on the tube, but you’re testing for support in your second rule.

So if I just take out this line:

if the cap is part of the tube of toothpaste:

then that ought to get it, right?

No, you change “if cap is on tube of toothpaste” to “if cap is part of tube of toothpaste” in the last block of code.

Thanks again.