[SOLVED] Rule getting straight up ignored for no reason

Check this out:

[code]Test Chamber is a room. A man called Michael is in the Test Chamber.

A red button is here. Instead of pushing the red button, say “Now you know [family-name][summary of family-name].”

A blue button is here. Instead of pushing the blue button, say “Now you know [keys-found][summary of keys-found].”

A green button is here. Instead of pushing the green button, say “Now you know [book-title][summary of book-title].”

test me with “push red button / facts / push blue button / facts / push green button / facts”.

[The following is adapted from Threaded Conversations, though I’m not sure if that’s relevant.]

Section - facts

A fact is a kind of object. Some facts are defined by the Table of All Known Facts.

Table of All Known Facts
fact summary
family-name “Michael’s family name is Van Huber”
keys-found “the keys are under the couch”
book-title “the title of the library book is Where the Red Fern Grows”
j
Section - determining knowledge - not for release

Fact-checking is an action out of world. The specification of the fact-checking action is “A quick little utility for figuring out who knows what during runtime.”

Understand “facts” as fact-checking.

Carry out fact-checking:
say “You know [if at least one fact is known by the player][list of facts known by the player][otherwise]nothing[end if].[paragraph break]Michael knows [if at least one fact is known by Michael][list of facts known by Michael][otherwise]nothing[end if].”

Rule for printing the name of a fact (called knowledge) when the current action is fact-checking:
say “[summary of knowledge]”.

Section - learning facts

Fact-awareness relates various people to various facts. The verb to know implies the fact-awareness relation.

Before printing the name of a fact (called target) (this is the player learns facts rule):
now the player knows the target;
now Michael knows the target.

Rule for printing the name of a fact (this is the silence actual output of facts rule):
do nothing instead.

To say forget (target - a fact):
repeat with listener running through people who can see the person asked:
now the listener does not know the target.[/code]

Here’s the test transcript:

As soon as more than one fact is known by a person, the text sub [list of facts known by X] stops producing any output. Why is this happening?

I’m not sure what’s going on with [list of facts known by ], but I managed to get this to work:

To list facts for (P - person):
	if no facts are known by P:
		say "nothing.";
		stop the action;
	let num-facts be a number;
	repeat with the current fact running through facts known by P:
		now num-facts is num-facts + 1;
	let current-fact-num be a number;
	repeat with the current fact running through facts known by P:
		now current-fact-num is current-fact-num + 1;
		choose row with the fact of current fact in the Table of All Known Facts; 
		say "[summary entry][if current-fact-num < num-facts - 1], [otherwise if current-fact-num < num-facts] and [otherwise].[end if]".

Carry out fact-checking:
	say "You know ";
	list facts for the player;
	say "[line break]Michael knows ";
	list facts for Michael.

(I also added an initial “facts” to the “test me” sequence.)

My guess is that it’s invoking your “printing the name” rules in a strange way, so nothing gets printed. (Try running the last bit with RULES on?)

This change seemed to work (in 6L38):

[code]Carry out fact-checking:
say “You know [if at least one fact is known by the player][summary of facts known by the player][otherwise]nothing[end if].[paragraph break]Michael knows [if at least one fact is known by Michael][summary of facts known by Michael][otherwise]nothing[end if].”

To say summary of facts known by (subject - a person):
let fact-list be the list of facts known by the subject;
say fact-list.[/code]

What I suspect is going on in your original code is something like this: You’re trying to say the list of facts known by the player. But in the course of saying that list, you’re actually changing which facts are known by the player. This (and I’m really unsure of what’s going on the hood here, this is just a guess) has effects not unlike the effects of changing a list that you’re repeating through, which is to say weird and undesirable effects. So the patch is just to copy the list over into a temporary list at the beginning of the process and say that; the temporary list doesn’t care if we change what facts are known as we’re printing it.

Ah, yeah, you may be right about that. I ended up solving it with a workaround similar to what you suggested. Thanks for the advice.