I7 recognizes one synonym and not the others

[code]Burma-Shave is a wearable thing on the sink.

Understand “can/shaving cream/cream” as Burma-Shave.[/code]

The parser understands Burma-Shave and shaving cream. Can and cream it doesn’t Anyone know why?

Try without the space.

Understand "can/shaving/cream" as Burma-Shave.

Remember, slashes only work on the worlds immediately next to it, so your original statement gets parsed as “(can/shaving) (cream/cream)”–which is “can cream” or “shaving cream.” Marshall’s solution is good. If you want to make sure that the player has to type “shaving cream” and not just “shaving” (which I don’t recommend) you can use “or”:

Understand "can" or "shaving cream" or "cream" as Burma-Shave.

(You should probably allow “Burma” and “shave” without the hyphen while you’re at it.)

Solution worked. Now another shaving-related problem.

[code]The foam is a thing. It is undescribed.

The hand is part of the player.

The description of Burma-Shave is “It’s the brushless shaving cream. There’s a little button on the top of the can.”

A button is part of Burma-Shave.

Instead of pushing the button:
if player holds Burma-Shave:
say “You push the button on top of the can.”;
now the foam is in the hand.[/code]

The action fails.

Parser says:

OK, Einstein, what next?

take can
Taken.

What’s the word, bird?

actions
Actions listing on.

push button
[pushing the button]
You push the button on top of the can.
[pushing the button - failed]

What’s failing? Is the foam not getting in the hand?

Pushing the button failed.

It says it failed cuz you made an “instead” rule. It’s telling the parser “instead of pushing the button” so the parser THINKS the button pushing failed. But cuz you made more instructions afterward, then whatever you actually tell the parser should happen, despite the “action” failing. Am i making sense? If not, someone else should chime in. :sunglasses:

What Marshall said. Inform considers an action to have failed (and says so if you’ve got actions listing on) if it didn’t get to the “Carry Out” stage (I think)–which it didn’t in this case, because the “Instead” rule cuts it off. But it shouldn’t actually keep the foam from getting into your hand.

The distinction between successful actions and failed actions matters when you’re giving orders to other characters, and it can matter in other cases like when you’re counting how many times you’ve performed a certain action, but it’s probably not going to cause you any trouble here.

Getting weirder:

I changed to a check rule, and pushing the button succeeded, but the parser told me nothing obvious happened. The foam still isn’t getting into the hand.

Check pushing the button: if player holds Burma-Shave: say "You push the button on top of the can."; now the foam is in the hand.

Report:

push button
[pushing the button]
You push the button on top of the can.

Nothing obvious happens.
[pushing the button - succeeded]

And you’re sure the foam is not getting in your hand? (Strangely, this isn’t the first time I’ve asked this of someone today…)

When I inventory, it just says I carry the Burma-Shave.

You have to add the container property to the hand: “The hand is a container.” in order to put something in it. It might be better to simply put the foam in your inventory and make its description (when carried) something like “A mound of foam sitting on your palm.” Parts of the player aren’t visible unless they’re specifically examined, so you won’t see the foam in your inventory. You have to examine your hand to see it.

What about when you examine the hand? Didn’t you make the hand a part of the player? Not sure if that would automatically show up in your inventory. Just thinking outloud here. I made a bong out of a pineapple today so my advice might not be totally on-track.

edited to add: see what i mean? Matt beat me to the question about examining the hand.

Can I define the hand as both a container and a part of the player?

Yes, you can, but things that are in the hand won’t be visible in your inventory or in the room description. Some trial code:

[code]A can of Burma-Shave is on the sink.

Understand “burma/shave/shaving/cream” as Burma-Shave.

Some foam is a thing. It is nowhere. The description of the foam is “A hefty sample of Burma-Shave’s signature product.”

The description of Burma-Shave is “It’s the brushless shaving cream. There’s a little button on the top of the can.”

A button is part of Burma-Shave. The description of the button is “It’s the button on top of a can of shaving cream. Surely you’ve seen one before.”

Instead of pushing the button:
if player holds Burma-Shave:
say “A mound of foam squirts onto your palm.”;
now the foam is carried by the player;
otherwise:
say “A stream of foam shoots out of the can and dissolves on the floor.”[/code]

EDIT: Some design principles I used for the above. You may find them useful or not, YMMV.

  1. It’s better to keep the world model as simple as possible. Sometimes it might be important to note that a ring is on the left-ring finger of the player, but most of the time you can just say that the player is wearing a wedding ring and let the player infer where. Similarly here; if the player is carrying some shaving foam, they’ll infer that it’s in their hand, and you can support that inference with descriptions of objects/actions. It’s more like painting than modeling.

  2. If a thing can be interacted with, it should have a description. (And modern IF design philosophy seems to tend toward describing every noun in every room description even if you can’t interact with it.) Certainly though, in this case, you should have a description for the button.

  3. When you write an instead action, you should provide a message to the player for every outcome, because instead ends the action (unless you specifically continue it.) In this case, you have an if statement, but you need to let the player know what happens if the if statement fails (i.e. they’re not holding the can when they try to push the button), otherwise they get no output at all, which is confusing.

  4. If a player performs an action, you usually don’t need to tell them they did it. (Unless, perhaps, they have reason to suspect they’ll fail.) In other words, the response to “push button” doesn’t need to start with “You push the button…”

That got the foam into my hand, now I just gotta figure how to put the foam on my face. Can I make the face a container?

Turns out I can. Thanks all above.

Easier to just add “face” as an alias for yourself:

[code]Understand “face” as yourself.

Instead of dropping the foam: [add this so we don’t have to consider the case where the player is not holding the foam]
say “The foam dissolves away.”;
now the foam is nowhere.

Instead of putting the foam on the player:
say “You smear shaving cream all over your face.”;
now the foam is nowhere.[/code]

Still failing the check shaving rule.

[code]Understand “face” as yourself.

Instead of dropping the foam:
say “The foam dissolves away.”;
now the foam is nowhere.

Instead of putting foam on the player:
say “You smear shaving cream all over your face, working it into the skin.”;
now player wears foam.

A face is part of the player. The face is a supporter.

Check shaving:
if player does not wear foam:
say “Dry shave? No way, man!”;
stop the action.[/code]

Report:

take razor
[taking the razor]
Taken.
[taking the razor - succeeded]

Anticipatin’ your next move.

shave face
(the face)
[shaving the face]
Dry shave? No way, man!
[shaving the face - failed the Check shaving]

It might be that your two definitions of ‘face’ are conflicting. Try deleting the line that starts “A face is part of…”

Dot dood it. Thanks.