I’m trying to create a new rule for feeding. I’ve already replaced the Grammar section of the Standard Rules because “feed” is a synonym for “give” and that blocks any new “feed” rule
So here are the parameters:
actor can feed another person or an animal
only something edible can be fed or eaten
if the actor is carrying an edible item, this is the implied item being fed
if the actor is carrying more than one edible item, we have to ask which edible item is appropriate
So given the player is carrying a piece of steak, these actions should work.
> feed piranha
You feed the piranha the piece of steak.
> feed steak to piranha
You feed the piranha the piece of steak.
If the player is not carrying something edible…this should be possible.
[custom]
> feed piranha
The piranha leaps up and attempts to bite off one of your fingers. Luckily you're too fast and pull your hand away in time.
[default]
> feed piranha
You don't have anything to feed the piranha.
It might be nice if the player has something edible in a container…
> I
You are carrying:
a satchel
a piece of steak
> feed piranha
(first taking the piece of steak out of the satchel)
You feed the piece of steak to the piranha.
So…if any I7 gurus could help out with this, I’d appreciate it.
Understand the command "feed" as something new.
Feeding it with is an action applying to two things.
Understand "feed [someone] with [something preferably held]" as feeding it with.
Understand "feed [something preferably held] to [someone]" as feeding it with (with nouns reversed).
Understand "feed [someone]" as feeding it with.
This splits off the “feed” synonym as per Zarf above, and creates the new action and its grammar. It’s easier to have the animal as the noun rather than the second noun (because we’re allowing “FEED PIRANHA”), so I’ve set up the action as “feed it with” rather than “feed it to”. (We define grammar for both forms.)
Rule for supplying a missing second noun when feeding something with:
if the number of edible things held by the player is one:
now the second noun is a random edible thing held by the player;
otherwise if the number of edible things enclosed by the player is one:
now the second noun is a random edible thing enclosed by the player;
otherwise if the player encloses no edible thing:
say "You have nothing to feed [the noun].";
otherwise:
say "You will have to specify what you want to feed to [the noun]."
What to do with “FEED PIRANHA”; I think these rules approximate what you asked for.
Check feeding it with when the player does not hold the second noun:
say "(first taking [the second noun])[line break]";
silently try taking the second noun.
This covers cases where the player can see, but is not holding, the specified food. It also allows “FEED PIRANHA” to work with the steak in the satchel (when that has been selected by the “providing a missing second noun” rule).
Check feeding it with when the second noun is not edible:
say "[The noun] can't eat that!" instead.
Check feeding it with when the noun is not an animal:
say "[The noun] refuses to eat [the second noun]." instead.
Sanity checks. Maybe I missed some, I usually do. (The “not an animal” rule applies to humans.)
Carry out feeding it with:
remove the second noun from play;
Report feeding it with:
say "You feed [the second noun] to [the noun]."
Basic action mechanics. Custom mechanics will be provided by the game author, perhaps by means of Instead rules.
I want to be explicit about what happens sometimes, but not all the time. I tried an Instead of feeding it to the piranha and I7 doesn’t like that.
This won’t work because the noun is the piranha, not the food. (That’s just how I set it up.) So it would need to be
Instead of feeding the piranha with something:
say "You whip your hand away just in time; it appears that it prefers your fingers to [the second noun]."
(In this case the food item will not be eaten. Also, none of the check rules will take effect.)
Or if it’s just the reporting you want to customize (and you don’t want to bypass the check and carry out stages)
Report feeding the piranha with something:
say "You hold [the second noun] out gingerly, as [the piranha] snaps it out of your hand. It disappears frighteningly quickly."
Ack. What if I have a piece of chicken and a piece of steak ?
Yes, I deliberately wrote the rule to make no decision in that case. (Given that the item selected is going to be removed from the game, it seemed safest.) But if you want to pick one at random, you could set the second noun to “a random edible thing enclosed by the player”, or something like that.
Rule for supplying a missing second noun when feeding something with:
if the number of edible things held by the player is greater than zero:
now the second noun is a random edible thing held by the player;
otherwise if the player encloses no edible thing:
say "'I don't have anything to feed [the noun].'";
otherwise:
now the second noun is a random edible thing enclosed by the player.