Recognizing New Kinds

Frankly I have not a single idea as to why this wouldn’t work.

[code]Clothing is a kind of thing. Clothing is usually wearable.
A dress is clothing. A dress is in the Bedroom.

Check inserting things into closet:
if the thing is not clothing:
say “That really doesn’t belong in the closet.” instead.[/code]

If I try to put the dress into the closet, it will still say that “That really doesn’t belong in the closet” even though I defined it as clothing.

Thank you in advance.

The problem is that “the thing” doesn’t refer to the thing you’re trying to put in the closet. In English the connection is strongly implied so a human reader understands the intended meaning but Inform takes everything literally, in this case it understands that line as “if there is a thing that is not clothing” which is always true. Instead of “thing” you need to use “noun” which refers to the object that’s being handled.

Check inserting things into closet: if the noun is not clothing: say "That really doesn't belong in the closet." instead.

As I understand it, one way to think of this is that I7 almost always treats “the” and “a” interchangeably (I think the main exceptions are in the handling of definite/indefinite articles when saying object names, and in some set phrases like “end the story”). So “If the thing is not clothing” compiles to the same thing as “If a thing is not clothing,” which is almost always true.

Thank you. It works. I was wondering though; do you mean that Inform believes there is a thing called clothing and only that thing can be put in the closet? Or am I completely misunderstanding you? If it is the former, why? The word clothing is already specified as a kind, so wouldn’t Inform understand the line as “if there is a thing that is not a clothing-kind” similar to how it recognizes that certain actions can’t apply to inanimate objects? I’m sorry if that’s a dumb question.

No, it’s only the wording of the phrase you used. “Thing” means “any thing at all”, but “noun” means “the thing in question”.

“if the thing is not clothing” belongs to the same group as the following:

A wolf is a kind of animal. A wolf can be hungry.
If a wolf is hungry: ... [if any wolf in the game is hungry]

Clothing is a kind of thing.
If clothing is worn by the player: ... [if the player is wearing anything]

If a door is open: ... [if any door is open]

If a person is in a container: ... [if any person is in any container]

So following this logic, and remembering that Inform generally does not make a difference between “a” and “the”,

If [the] thing is not clothing: ... [if there is a thing that is not clothing.]

Thank you so much for that simple explanation. I think that concept has been tripping me up more than I know.

I’ve tried various ways of phrasing things like this in rule conditions, but I’ve never been able to do it:

Check inserting clothing into closet:

is valid, but I don’t think this is:

Check inserting something not clothing into closet:

You can always do this:

[code]
Definition: A thing is non-clothing if it is not clothing.

Check inserting non-clothing into closet:[/code]
…but that doesn’t always seem to deserve an extra paragraph.

I’ve probably used this on occasion, but I can’t even remember if this works:

Check inserting something into the closet when the noun is not clothing:

…but even that seems unfairly wordy to me. Is there a syntax to do all-except-one-kind in a single phrase?

Sometimes I think my real problem is with the way the check rulebook works.

Try “Check inserting something that is not clothing into closet”.

I could have sworn I tried that. Oh well, it works now.