removing synonyms

is there a way to remove synonyms? For example, the command “feed” is the command “give”. However, if a player were to feed someone else, you wouldn’t want them to feed something that isn’t food, right? I don’t have any source code, but here’s an example of what the transcript might look like under normal conditions:

You give the cereal to Kevin.

You give the napkin to Kevin.

Well, the intention is to feed Kevin, but I’m pretty sure he’s not going to want to eat the napkin. Sure, you could make an instead rule for the napkin, but then you’d have to do it for all the other nouns that also aren’t food, I think, or an instead rule for all things that ARE food. I don’t know, but every solution I think of seems like it’s more complicated than it should be.

Just say

Understand the command "feed" as something new.

That will remove the existing grammar lines for “feed”–that is, the verb “feed” won’t be a synonym for anything anymore–and then you can redefine it as a “feeding” action which you can program to have different sensible responses for food and non-food items.

great, thanks matt w!

As an aside: in my opinion it’s not worth being too fussy about this sort of thing, unless feeding is an important mechanic in your game. Making sure that appropriate verbs do work is important; blocking mildly inappropriate ones isn’t.

In standard Inform, break, smash, hit, thump, fight, kill and murder are all synonyms for attack. Not all of these are likely to be appropriate in any given situation, but a player weird enough to type MURDER WINDOW (e.g. me) isn’t going to mind (or be surprised) if MURDER is understood as SMASH. Likewise, most of the time, FEED NAPKIN TO KEVIN can be implicitly converted to GIVE NAPKIN TO KEVIN, and nobody will care.

well, the thing is that there are different foods, but I only want the player to be able to feed certain foods to kevin. kevin is a baby, and there’s granola, milk, and coffee. i want the player to be able to feed the granola and the milk to kevin, but not the coffee. would i still need to make the exception?

Well, it’s really an issue of whether you need to distinguish FEED from GIVE. If you want to be able to GIVE the coffee to Kevin, but not FEED it, then you need to separate them. But in that case you’ll need to write sets of rules for both actions. Almost certainly, you’re better off not distinguishing: just let FEED be a synonym for GIVE, and write one set of rules covering giving things to Kevin.

A reasonable way of doing this is to have a blanket instead rule preventing giving things to Kevin, and then a bunch of more specific instead rules covering the things you do want to allow. A rule headed “Instead of giving the milk to Kevin” will by default take precedence over one headed “Instead of giving something to Kevin”.

The Kitchen is a room. Kevin is a man in the kitchen.
The napkin is a wearable thing in the kitchen. The granola is an edible thing in the kitchen. The rattle is a thing. The cactus is a thing in the kitchen.

Instead of giving something to Kevin:
     say "That doesn't seem suitable for babies."

Instead of giving the granola to Kevin:
     say "You feed the granola to Kevin. He burps indignantly.";
     remove the granola from play.

Instead of giving the napkin to Kevin:
     say "You tuck Kevin into his bib.";
     now Kevin wears the napkin. 

Instead of giving the rattle to Kevin:
     say "Kevin sucks the rattle happily.";
     now Kevin holds the rattle.

Test me with "give napkin to kevin / give granola to kevin / give rattle to Kevin / give cactus to Kevin".

Basically this bypasses the standard rules for giving, letting us divert it into whatever action is appropriate for the particular noun.

wonderful. great advice, thanks! i think i may have been making it harder than i thought. i initially removed the “block giving to other persons” rule from the rulebook, thinking i had to do that in order to create new rules where i could give him specific items.