code-debugging TAKE ALL

So I wanted to see about responses to taking scenery/people/etc. TAKE ALL doesn’t quite cover this.

So I defined an alternate rule:

room 1 is a room.

the junk is fixed in place. the junk is in room 1.

The exclude scenery from take all rule is not listed in the for deciding whether all includes rulebook.
The exclude fixed in place things from take all rule is not listed in the for deciding whether all includes rulebook.
The exclude people from take all rule is not listed in the for deciding whether all includes rulebook.

Rule for deciding whether all includes fixed in place things while taking:
	say "FIXED [noun].";
	if take-it is true, rule succeeds;
	the rule fails;

My goal with this code is to type GET ALL and see FIXED junk. But it says FIXED nothing.

How can I do this inside the rule? I can try

[code]chapter takedebug - not for release

The can’t take what’s fixed in place rule is not listed in the check taking rulebook.

check taking scenery:
say “You can’t take [noun]–it’s scenery. Note: need less generic message.”;

check taking a fixed in place thing:
say “You can’t take [noun]–it’s fixed in place. Note: need less generic message.”;[/code]

But I was wondering if there was something more direct in the rule itself.

Thanks!

“Noun” refers to the player’s command, and in this case there is no noun in the command so the variable is empty. I don’t know if there’s a way to access the item being tested for inside the “deciding whether all contains” rule.

A bit of self-promotion: the Object Response Tests extension lets you command >TRY TAKING and it’ll loop through every object in the room and prints their response to trying to take them.

Ooh, nice! I didn’t use your extension for that, though I’m not sure why, now. I suppose I got blinded by saying “well, taking only works for non-scenery, so that’s that.”

Still, it was a good programming exercise to do things my own way. Just, too bad I missed what could’ve been obvious.

For reference, you can use (called foo):

Rule for deciding whether all includes a fixed in place thing (called fixer) while taking: say "FIXED [fixer]."; if take-it is true, rule succeeds; the rule fails;

though for some reason this prints “FIXED junk” twice.

Oh, man! Now that you point that out, it seems obvious. I’ve used the called syntax a lot but never thought to use it here.

I suppose I could make an egregious hack to print things every other time. That’s a cool alternate solution.

I guess the less egregious hack would be to set a flag on things to see if they had had the message for them printed already that turn, or maybe use a list of things that had had the message printed which seems like it might be more efficient (since you don’t have to reset the flag on every object every turn).

Not sure why it runs twice, though; I’m curious.