Possible rule preamble specificity ordering bug

Lab is a room.

your left foot is a thing.
your left foot is part of the player.
Description of your left foot is
	"It's [printed name].".

your clothes are a plural-named thing.
your clothes are part of the player.
Description of your clothes is
	"It's [printed name].".

your shirt is a thing.
your shirt is part of your clothes.
Description of your shirt is
	"It's [printed name].".

your pants is a thing.
your pants is part of your clothes.
Description of your pants is
	"It's [printed name].".

Instead of taking something when the noun is your clothes or the noun is part of your clothes:
	say "You are already wearing [the noun].".
	
Instead of taking something when the noun is part of the player:
	say "You can't take [the noun] because [they] [are] part of your body.".
	
Test me with "take shirt/take pants/take left foot/take clothes".

I won’t presume to fully understand Inform 7 preamble specificity ordering. But I must admit this took me by surprise when take clothes returned the response for the second rule instead of the first.

Isn’t the preamble:

Instead of taking something when the noun is your clothes or the noun is part of your clothes

more specific than the preamble:

Instead of taking something when the noun is part of the player

I am very specifically calling out when the noun is your clothes, yet it is the second rule that is still taking priority over the first rule.

FYI, I have a workaround for this problem. I was just wondering if it was worth filing a bug or not.

Great question! I’m trying to find the part of the compiler source code that handles rule ordering—I know I’ve seen it before—but no success yet. It seems like the key is:

Law III.5.2 - Action/When/Circumstances. A more specific condition under “…when…” beats a less specific one. These conditions could potentially be complex: Inform judges how specific they are by counting the clauses found in them. The more clauses, the more specific the condition, it is assumed.

But I suspect “and” clauses make it more specific, while “or” clauses make it less specific.

1 Like