DTPM disambiguations don't run on scenery [Does The Player Mean]

I think I’ve figured out why this is happening. The parser.i6t code contains this:

  if (context==MULTI_TOKEN && ultimate==ScopeCeiling(actor)
            && n~=actor && n hasnt concealed && n hasnt scenery) 
        {   good_ones++; last=n; }

which has the effect of adding one to the variable good_ones when there’s a multiple token like “[things]” for the taking action.

Then there’s this:

if (good_ones == 1) {
		if (indef_mode == 1 && indef_type & PLURAL_BIT ~= 0 &&
			context == MULTI_TOKEN or MULTIHELD_TOKEN or
				MULTIEXCEPT_TOKEN or MULTIINSIDE_TOKEN) {
	        BeginActivity(DECIDING_WHETHER_ALL_INC_ACT, last);
            if ((ForActivity(DECIDING_WHETHER_ALL_INC_ACT, last)) &&
            	(RulebookFailed())) good_ones = 0;
	        EndActivity(DECIDING_WHETHER_ALL_INC_ACT, last);
			if (good_ones == 1) return last;
		} else {
			return last;
		}
    }

which–if good_ones has been set to 1–runs the “deciding whether all includes” activity. As AJ pointed out, this excludes the scenery map.

Now, I can’t work out the logic of what goes on in that second call, but I would guess that when all but one thing gets excluded from “all” the parser automatically chooses the only remaining thing, even if the noun entered was singular.

To confirm this, if you add The player carries a dummy map. then “take map” goes to the paper map, presumably because two things survive the “deciding whether all includes” activity, which means that Inform has to run the DTPM rules anyway, and then the paper map wins the DTPM rules.

tl;dr: When you have an action that takes a plural token, the parser runs the Deciding Whether All Includes rules no matter whether you typed a plural, and if only one thing is left it picks that regardless of DTPM. If more than one thing is left and you didn’t run a plural, it runs DTPM on everything that might qualify.

zarf–it doesn’t seem to me as though the DTPM rules are only worth up to 4. It’s a bit hard to track it through the parser, but it seemed like the DTPM rules wind up returning a value from 0 to 4 through ChooseObjects, and then ScoreMatchL has this line

its_score = its_score + SCORE__CHOOSEOBJ * ChooseObjects(obj, 2);

which multiplies the result of ChooseObjects by SCORE__CHOOSEOBJ which is 1000. So this would swamp SCORE__NOTSCENERY which is 10, if it applies. Looking at various traces, the DTPM rules do seem to be moving things by increments of 1000.