parser clarification internal rule response (F)

I am having difficulty writing a “Does the player mean …” rule for a parser clarification issue I am having. An example of the minimal code to reproduce the issue is as follows:

Kitchen is a room. 

A quadrilateral is a kind of thing.  A quadrilateral is scenery.  Understand "square" as a quadrilateral.  Understand "squares" as the plural of quadrilateral. 

The red square and the blue square are quadrilaterals in the Kitchen.

The red and blue squares are scenery and obviously I do not the player to be able to take them, however I want the player to be able to type “take squares” and receive a reasonable response. Here is the story output:

Obviously I am printing the response text as well. With rules on too the last command gives:

It’s not clear to me why the parser is asking “What do you want to take those things from?” or how to get rid of it. Adding “The exclude scenery from take all rule does nothing when taking a quadrilateral.” to the code has no effect. I have made several attempts at a "Does the player mean … " rule with no success. If I eliminate “A quadrilateral is scenery.” from the code, everything works fine, except of course the squares may now be taken:

A partially acceptable workaround is the following:

[code]
Kitchen is a room.

A quadrilateral is a kind of thing. Understand “square” as a quadrilateral. Understand “squares” as the plural of quadrilateral.

The red square is a quadrilateral in the Kitchen.
The blue square is a quadrilateral in the Kitchen.

Instead of taking a quadrilateral, say “That’s hardly portable.”[/code]

However this feels unsatisfying and would list the squares among the items in the room when printing the room description (which I would prefer not happen). Any suggestions welcome.

You can use the debugging verb “trace” to see more about what the parser is trying to do. In this case, it looks like, after deciding that the command can’t possibly mean the verb “take,” it’s assuming that the player was only half-done asking to "take squares from ", which would be valid for the “removing it from” action. (I’m pretty sure that even though the same rule excluding scenery from all would ultimately apply to a “removing it from” action, the decision to create this kind of prompt is made before such rules can fire.)

If you don’t care about preserving the ability to enter commands like “>TAKE SANDWICH FROM BASKET” then you might just want to redefine the meanings for the command “take” with something like:

Understand "take" as something new.

Of course, you would have to redefine all the grammars that you wanted to keep, e.g. “>TAKE INVENTORY” and other uses, in this case.

Someone else will probably be along shortly to offer a more comprehensive answer.

That sounds a lot like this won’t-fixed bug, where excluding something from all led the parser to reject the correct grammar line and then ask for a clarification based on another grammar line.

There, the exclusion caused the parser to reject “drop [things preferably held]” when parsing DROP ALL, and then partially matched it to “drop [other things] in/into/down [something]”. Here, I’m guessing that the “exclude scenery from take all” rule has caused the parser to reject “take [things]” and partially match “take [things inside] from [something]”.

Unfortunately, if that’s what’s going on, there’s some deep parser stuff that’s hard to change, and we need a workaround. I think we might be able to keep the squares as scenery (with all the attendant desired features) as long as we force the squares to be included in all; we don’t even need to write a rule to print “That’s hardly portable,” because as scenery they’re fixed in place:

[code]Kitchen is a room.

A quadrilateral is a kind of thing. A quadrilateral is scenery. Understand “square” as a quadrilateral. Understand “squares” as the plural of quadrilateral.

The red square is a quadrilateral in the Kitchen.
The blue square is a quadrilateral in the Kitchen.

First rule for deciding whether all includes a quadrilateral while taking or taking off or removing (this is the quadrilateral hack rule): it does. [/code]

Unfortunately they’ll also be included in “take all.” I’m not sure that there’s any non-ugly way to allow a sensible response to “take squares” while excluding them from “take all.”

(By the way I suspect that the reason “The exclude scenery from take all rule does nothing when taking a quadrilateral” did not work is that this rule applies in the parsing process, before the action has actually been resolved to the action of taking one of the squares.)

You could just replace the rule.

The exclude scenery from take all rule does nothing.
Rule for deciding whether all includes scenery while taking or taking off or
	removing (this is the new exclude scenery from take all rule): 
	if the item described is a quadrilateral:
		it does;
	it does not.

Of course, this will mean that quadrilaterals are understood to be included in “take all”, which you may not want.

The “deciding whether all includes” rules, despite the name, are not tied to the word “all”. They live in the multiple action processing rulebook, which can be triggered by any plural noun in the player’s command. (Section 17.20 of Writing with Inform.)

Edit: matt w got in first.

Thanks to otistdog, matt w and jrb for your replies. I tried the “rule for deciding” approach and it is a good compromise. Being listed in “take all” is mildy annoying, but it is just one room - I can live with it.

Thanks!