Omitting an item from inventory

Your new set of rules eating rules have been working great. Now however, after eating one of many things of food, I try ‘examine food’. It asks me which of the foods I want to examine, but it only proposes the *foods that already been eaten"! Example:

[7] x food
Which do you mean, apples, grapes, cheese, or slices of meat?
[8] x apples
Looks good enough to eat!
[9] x grapes
Looks good enough to eat!
[10] eat cheese
(first taking cheese)
You eat cheese. Not bad.
[11] eat meat
(first taking slices of meat)
You eat slices of meat. Not bad.
[12] x food
Which do you mean, cheese or slices of meat

I think I need to suppress an Examine rule, but not sure which one, or how. I don’t want to step on your “wishing for food rule”.

As far as I can tell, there really shouldn’t be any interaction between the code above and the examining action, so you shouldn’t have to worry about interference.

I’m not really sure what the problem might be. Perhaps you can try to strip things down to the minimum code that replicates the problem and post here?

1 Like

Besides the wishing for food rule you provided, I have added only this code.

Food is a kind of thing. Food can be eaten or not eaten. 
apples, grapes, cheese, and slices of meat are food.
apples, grapes, cheese, and slices of meat are edible.
apples, grapes, cheese, and slices of meat are in the dish.

[Without this line, parser doesn't see the object-noun "food"]
Understand "food" as some food.

Instead of examining food,
	say "Looks good enough to eat!";

I think that your memory trick brings the eaten back into scope so that ‘examine food’ sees it again. I don’t know why the uneaten food is not seen.

Could you please provide a whole code sample demonstrating this behavior?

This isn’t a fix for what you’re seeing, but instead of

I’d suggest:

The description of food is usually "Looks good enough to eat!".

It’s easy to overuse Instead rules. I wrote about when to use which action rulebooks elsewhere; here’s another post on the uses of action rulebooks by @HanonO. The perils of INSTEAD is a recurring topic here.

In my coding, Instead is the rulebook of last resort: if something can be straightforwardly accomplished with one of the other rulebooks, and there isn’t a particular reason why Instead is a better choice, I use the other rulebook. (This is a statement of personal preference and is more Instead-avoidant than the docs’ 12.21. Guidelines on how to write rules about actions themselves, which call for Check rules for general situations and Instead for specifics. So I’m not suggesting that my position is correct and anyone disagreeing with it is wrong; I’m just sharing my own thoughts.)

3 Likes

I used an equivalent description for food. The problem is that ‘x food’ provides a list of things 'eaten" instead of things not eaten. Here is the entire code.

[Special Eating rule so that player can examine jerky by mistake. --By otisdog from IF Forum
All carry out rules will be executed by default, so this just works alongside the Standard Rules which removes eaten food from play.]
Carry out eating something (called snack) (this is the mark eaten things as eaten rule):
    now the snack is eaten. 

[Here's the fun part: A new action that uses the "eat" verb word but will be considered only after the normal eating action fails.]
Wishing for food is an action applying to one visible thing. 
Understand "eat [something eaten]" as wishing for food. [Note that "one visible thing" doesn't mean what it looks like it means.]
Understand "examine [something eaten]" as wishing for food. 

[A check rule so that it is in an action-specific rulebook, with "instead" keyword so that the action registers as a failure. This could be an Instead rule if you like.]
Check wishing for food (this is the notify that wished for food is eaten rule): 
	say "You already ate the [noun]." instead. [Works for any eaten food, not just the jerky.]

After deciding the scope of the player when wishing for food (this is the add previously eaten things to scope when wishing for food rule):
	repeat with memory running through eaten things:
		place memory in scope. [This is what makes the eaten food "visible" for the purpose of the new action.]

Food is a kind of thing. Food can be eaten or not eaten. 
The description of food is usually "Looks good enough to eat!".
apples, grapes, cheese, and slices of meat are food that is edible.
apples, grapes, cheese, and slices of meat are not eaten.
apples, grapes, cheese, and slices of meat are in the dish.

[Without this line, parser doesn't see the object-noun "food"]
Understand "food" as some food.

Instead of

Understand "examine [something eaten]" as wishing for food.
Food can be eaten or not eaten.
Understand "food" as some food.

try

Food can be eaten or uneaten. 
Understand "food" as some uneaten food.

Parsing the player’s command works by the same principle as how Inform orders rules in rulebooks: more specific things are considered first. Because you said:

Understand "examine [something eaten]" as wishing for food. 

you’re telling Inform to preferentially interpret "examine " as the wishing for food action, and since “food” just meant any food, including eaten food, “examine food” implicitly became examining eaten food (if any eaten food exists).

2 Likes

Zed,
Thanks so much for explaining this. It was a big mystery to me. I will give that a try.

Zed,
I gave that a try and it worked! Thanks so much!
Is there a difference between ‘uneaten’ and ‘not eaten’?

Inform always understands “not foo” for binary properties, so you don’t have to name it.

Adding “uneaten” as a synonym just makes life easier.

1 Like

Andrew,
Thanks. I think I should have been clearer. If I say food is eaten or not eaten, but then say that an apple is uneaten, will the parser recognize the synonym?