Override Built-in Synonyms?

You can use a “does the player mean rule” to weight the parser’s choices.

Does the player mean examining the player's face: it is unlikely.

Of course, that rule as written only applies when examining someone’s face. If you expect the player to try punching people in the face, you can make the rule broader:

Does the player mean doing something to the player's face: it is unlikely.

Hm…

Gets me

(and ditto for the other two)… I assume there’s just some kind of syntax thing going on here…

My game’s all done, and now I’m adding synonyms and frills.

It seems to me that someone with a screwdriver and a notion to remove a wing from a plane might reasonably type in “remove left wing” instead of “unscrew left wing”.

Code:

Instead of taking off the ppleftwing: try unscrewing the ppleftwing instead.

Play:

Clearly it’s worrying about whether I’m “wearing” the wing before getting to my instead code.

I noticed that adding a similar code for something that’s not a part of something else is a little better, but it still gives the “f(first taking the item)” message.

I understand there’s some complicated method of overriding Inform’s natural impulses, but I’m not sure I’m ready to do something complicated.

Didn’t I see somewhere that you can have Inform respond to some completely arbitrary string from the player, whether or not it contains real commands?

Other ideas welcome as well.

Thanks

Try something like this (untested):

Does the player mean doing something to a face which is part of the player:

That didn’t work either, Emerald. I tried a few other permutations of it too.

Luckily I have only five NPCs. Guess I’ll name faces and hands and such for each of them, at least for now. It’s just too silly to have inform asking the player whether he wants to look at his own face.

Edited to add: Can’t get that to work either, actually.

Found the answer to my earlier question, about making “remove” act like “unscrew” under the right circumstances:

Before taking off the leftwing: try unscrewing the leftwing instead.

For the disambiguation:

[code]Definition: a face is your own if it is part of the player.

Does the player mean doing something to your own face: it is unlikely.[/code]
For the examining, you can use the same definition:

Instead of examining your own face: say "..."
Or, for a more general approach (you’ll probably want descriptions for other characters’ faces too):

Instead of examining a face when the noun is part of the player: [or some other character] say "..."

Whoops, sorry about that. I thought “player’s face” was the item’s name in code. Inform doesn’t recognize possessives out of the box.

Nitku’s solution is the best, I think – define “your own” as an adjective that you can use in code.

I noticed you have other body parts as well – pulse, hair, etc. You can handle all of those with a single rule if you make them all of a kind.

[code]A body part is a kind of thing.

A face is a kind of body part. A face is part of every person.
A pulse is a kind of body part. A pulse is part of every person.
Hair is a kind of body part. Hair is part of every person.

Definition: a body part is your own if it is part of the player.

Does the player mean doing something to your own body part: it is unlikely.[/code]

FYI, you can make the word “remove” mean different things in different contexts with understand rules.

Understand "remove [leftwing]" as unscrewing.

Now you don’t need a before rule, because the parser knows from the get-go that “remove” means “unscrew” when you’re talking about the left wing.

If you have several plane parts that can be removed, you can make them of a kind, and handle all of them with one understand rule.

[code]A plane part is a kind of thing.

The leftwing is a plane part.
The rightwing is a plane part.
The rudder is a plane part.

Understand “remove [plane part]” as unscrewing.[/code]

Nitku and Michael:

Thanks for the new info. This new code doesn’t throw an error, but it doesn’t actually work either. Code:

[code]A hand is a kind of thing. A hand is a part of every person.
A pulse is a kind of thing. A pulse is a part of every person.
A face is a kind of thing. A face is a part of every person. Understand “expression” and “jaw” and “nose” and “eyes” as face.
Hair is a kind of thing. Hair is a part of every person.

Definition: a face is your own if it is part of the player.
Definition: a hand is your own if it is part of the player.
Definition: a pulse is your own if it is part of the player.
Definition: hair is your own if it is part of the player.

Does the player mean doing something to your own face: it is unlikely.
Does the player mean doing something to your own pulse: it is unlikely.
Does the player mean doing something to your own hair: it is unlikely.

Instead of examining your own face:
say “There are no mirrors here, you know.”

The description of Mom’s face is “Mom has a kind face, deeply lined but optimistic. Her eyes are full of compassion. She looks tired.”[/code]

Game play:

>look at face Which do you mean, your face, Granny's face or the bird's face?

Anyone know why this isn’t working?

I especially don’t want the bird’s “face” to come under discussion at all. I have noticed that animals seem to be special cases of humans.

Can I say something like:

Does the player mean doing something to an animal's face: it is impossible.

I’d also be open to coding body parts for non-player humans only, one by one, but I couldn’t really figure out how to do that either.

I’m starting to regret giving anyone a face…

It is actually working but perhaps you expected it to work a bit differently. Whenever the disambiguation question pops up, it suggests every possible item the player can see and you can’t exclude things from this list. You can only make them less or more likely to be selected automatically, so “Does the player mean…” doesn’t have any effect after the parser has decided it can’t pick the most likely option and has to ask the player for a clarification. (You can see that your code works as intended when there’s only one NPC in the room.) In this case, the player’s face is “unlikely”, but the granny’s and the bird’s faces are equally likely so the game can’t choose.

As far as I know there isn’t a (easy) way to exclude things from the disambiguation question list, and perhaps there isn’t need for it either because player just might want to examine their own face.

As for the animal face problem:

A face is a kind of thing. A face is a part of every man. A face is a part of every woman. [A face is a part of yourself.]

“Animal” is a sub-class of a “person”, that’s why animals got the face as well. Note that the player is just a person, not a man or a woman, so they’ll have to be treated separately. This will solve the first problem as well in your example now that granny is the only person beside the player that has a face.

Ah, thanks Nitku. That makes sense. I ended up programming a bunch of people and their body parts separately, and this would have been a lot cleaner. Maybe I’ll have time to clean it up before it goes into a gift-wrapped box here in the next day or two.

By the way, isn’t the compiler ignoring [A face is a part of yourself] because its in comment brackets? How do I make sure the player’s face is dealt with?

Yes, I put it in as a comment. Remove the brackets.

All fixed and working. Thanks Nitku!

I had a lot of issues when referring to the player as well.

Does the player mean doing something to the player’s face

is better typed:

“Does the player mean doing something to yourself’s face”

The player’s name is yourself.

I had issues with this too when trying [list of things carried by the player] (which would return nothing), but [list of things carried by yourself] always worked.

Most sensible would be
“Does the player mean doing something to their face”