"After" action not take first time?

Hello all,

I’m currently authoring my first Inform7 piece of interactive fiction, and I would like examining a specific object to include searching it. So I have tried:


After examining the cupboard:
   try examining the cupboard.

However, I also want to keep track of when things are found or have been looked at, so I also have a generic:

After examining something for the first time:
  now the noun is found;
  now the noun is examined.

I believe I may have tripped something so the specific rule for the cupboard is not triggering the first time due to this.

I would expect the object-specific “after” action to occur after the generic “first time” after-action. What am I missing?

This is a very unintuitive aspect of Inform! After rules stop the action by default, so only one will ever run. You need to override this by putting “continue the action” at the end of all your After rules.

For what it’s worth, I consider this a design mistake. Dialog runs all After rules by default.

Oh damn, I was pretty sure it was “all before actions ; the most specific action ; all the after actions” from 18.3. Rules applied to activities , but 7.5. After rules confirms that only one After is taken, I had forgotten about this detail. I should probably recommend an improvement to the documentation to 18.3.

Thanks!

That’s part of why it’s so unintuitive! For activities, all After rules run; for actions, they don’t. So I don’t blame you at all for being confused!

Unfortunately, it’s not something that can really be changed now without breaking tons of existing code. So it’s just something new users have to memorize.

2 Likes

Hey, um… do you even need for the first time here? This will do the exact same thing, after all:

After examining something:
  now the noun is found;
  now the noun is examined.

Won’t it? Setting already found and examined nouns to be found and examined isn’t going to cause any problems, surely?

Though, this doesn’t really have anything to do with your original question.

Oops, I missed that! Yes, there’s a definite bug lurking there.

When Inform sees “for the Nth time” or “for N turns” in a rule condition, it creates a tracker that looks at the other conditions on that rule, and records when they happen.

Which means it’s watching for the condition “examining something” to be true for the first time…which happens the first time anything at all in the game is examined, not the first time any particular object is examined.

You’ll want to remove the “for the first time” there, and let the “examined” flag track that. (You can also say “after examining an unexamined thing”, if you want, but it does no harm to set the flag multiple times.)

1 Like

Ah, I even missed that. I was just thinking the recurrence condition was pointless[1], not entirely wrong.


  1. Like you said, it needs to create that tracker, but why would you need a complicated recurrence tracker here when you already have a tracker in the form of the examined flag? ↩︎