A character won't take the item I'm trying to give him. Help

The code is legal, but when I try to give the spider food, it says that the spider isn’t interested.

[code]before of giving spider food to spoopy spider:
say “The spider eats the food happily, and poops out some string.”;
continue the action;
now the string is on the table.

Carry out giving (this is the gratitude for gifts rule): improve the mood of the second noun.

Mood is a kind of value. The moods are hostile, angry, indifferent, friendly, and adoring. the spoopy spider has a mood. the spoopy spider is indifferent.

To improve the mood of (character - animal):
if the mood of character is less than friendly, now the mood of the character is the mood after the mood of the character.

Check giving (this is the polite refusal of unwanted objects rule):
unless the noun interests the second noun:
say “[The second noun] stares at [the noun] with a confused expression on its face.” instead.

To decide whether (item - a thing) interests (animal - a spoopy spider):
if the item is the spider food, yes.

After giving something to someone:
say “You give [the noun] to [the second noun], who now seems [mood of the second noun].”

the string is a thing.

the spoopy spider is an animal[/code]

Please use code tags. Hit the “code” button above the place where you type your comment, then paste your code in between; or, as Draconis said in the other thread, you can just type:


paste your code here [/code]

Anyway, I’m pretty sure that you can see what’s happening here if you run your game, type “RULES,” and then try to give the spider the food. That will give a list of all the rules that are running, and the last rule that runs is the “block giving rule,” which prevents anyone from giving anyone anything and runs a refusal message. You can get rid of the rule like this:

The block giving rule is not listed in any rulebook.


The block giving rule does nothing.

(I think, though I’m not sure, that the first method runs a bit faster, but probably it doesn’t make any practical difference.)

You already have written a Check rule to cover cases other than the giving the spoopy spider the spider food, so that should take care of everything. (One common pitfall when unlisting rules is taking away a rule that always applies to an action and replacing it with a rule that only applies to a specific case–when that happens the other cases of the action will just return a blank line. But as I said, in this case you’ve already taken care of that.) Really you’ve got everything in place here except for the one rule from the Standard Rules that is messing things up; the “RULES” command is really helpful in finding things like that. (Another one to learn is the “ACTIONS” command which gives a list of the actions that the game is trying. This and a couple others are discussed in §24.3 of Writing with Inform, the documentation included with the program.)

It works! Thank you. (Sorry I’m still fairly new at Inform 7.)

No problem, everyone started out new! Just wanted to point you to those generally helpful commands. And thanks for editing in the code tags!