"Now" statements seem to be acting retroactively through time

Hi all! First post here, I’m working on my first project and it seems to be going pretty well. One thing, though, is really eating at me.

I’m using Threaded Conversation (many thanks to all of those involved, if you’re reading), and I’m rewriting the facts section so that facts can be more consistently conveyed both in and out of dialogue - and so that, like in the “Casino Banale” example, several facts can be put together, giving the player another fact when they’ve collected them all. The problem I’m having, though, is to do with saying the phrase to be printed when the fact is first learned. The text will display if I’m just asking Inform to say it, but if I check whether the player knows the fact (in order to only say it the first time the fact is picked up) it always comes out as known.

So effectively, it seems like the line “Now the player knows the new fact” is acting retroactively and taking effect before it’s supposed to, and that’s happening however I try to make that check (i.e. through values, or properties, or checking the relationship as below). The only other explanation I can think of for it is that somehow, the whole thing is happening once behind the scenes before it’s shown to the player.

Another bit of information which I am sure is relevant but I can’t work out how is that the system works exactly as it should if the [teach name-of-fact] is included in one of Threaded Conversation’s quips - but if you include it in other text such as the description of a thing, it happens as described above.

I hope that makes sense, and someone can shed some light on this - I’ve been tearing my hair out!

Relevant bit of code:

 To say teach (new fact - a fact):
 	If the player does not know the new fact:
		Say " [discovery of the new fact]";
 		Now the player knows the new fact;
 	Repeat with kid running through facts which follow the new fact:
 		If the player knows every fact which is followed by kid:
 			Say " [teach kid]";
 			Repeat with forgetter running through facts which are followed by kid:
 				Say forget forgetter;

I forgot to say, the facts are defined as follows, in a modified version of the Table of All Known Facts:

 Table of All Known Facts
fact		summary		child		discovery
generic-truth	"Life is hard."	nothing	"I just realised that life is hard!"

The trick is, “say” texts are sometimes evaluated without being shown to the player. For example, when Inform prints out “an apple”, it has to evaluate the apple’s “printed name” property to decide whether to use “a” or “an”.

The easiest solution is to use phrases instead of text substitutions.

To teach (the new fact - a fact):

But you can also check “if expanding text for comparison purposes”, which will return true if it’s being expanded behind-the-scenes, and false if it’s actually being shown to the player.

1 Like

Thank you so much for replying so quickly! This looks promising. I’ve been through so many different ways of implementing this - actions, ‘say’ texts (this is how Threaded Conversation does it, but it doesn’t need to display text when it does so), setting up verbs, even working before and after printing the name of the fact, but it just seems like no matter how ‘far away’ from the check I put the instruction to create the relation, it always evaluates before the check (as I said, unless it’s part of a quip).

So, to double check, it’s putting the ‘the’ inside the parentheses there that makes the difference? I’m pretty sure I’ve already tried your suggestion without the ‘the’, with much the same result as I’m getting now, but I can see how that one little word might make the difference.

Thanks for your patience, although I’m a fast learner I’m still a novice at this and it’s great to have the support. Once I’ve got this working I’ll separate it out from the hacked up and gaffer-taped version of Threaded Conversation I’m using and submit it as an extension. I’ve already got a similar one ready for submission that tracks goals/quests/mission objectives.

Will report back once I’ve had a chance to try this out!

Ah, not quite. Here’s the difference:

To say teach...

To teach...

Ah, I clocked that, but it was something I had already tried - the ‘the’ part was new, so I figured it might be that. Thanks so much for the advice though, it’s all helping my understanding!

So ‘teach’ does work, but for the sake of versatility I’m trying to make it so that you can invoke the fact from any text, such as a line of dialogue, the description of an item or any other message the player might receive. The only way I know of doing that is to then add in

to say teach (fact - a fact):
teach the fact.

and then that just brings us back around to the same issue again. Is there another way of getting it into my text fields?

Never mind! Digging a bit deeper showed me exactly where this line fits into the proceedings. I’ve got it working now - it was indeed running through and evaluating the code once before showing it to the player, meaning that relation was already set.

Thanks so much for your help!