How to be sure of whether an action has taken place, and thus time should tick?

This is true. Text tokens can be expanded for reasons other than printing, typically to compare the text they appear in to some other text- and if text expansion runs code, this can lead to unexpected consequences because the code is run more frequently than intended, or in situations the author did not expect.

Fortunately, Inform provides an undocumented means to neatly side-step this problem:

if expanding text for comparison purposes....

tests whether the text is being expanded to print or for other purposes and if this condition is checked at the start of code invoked by a text expansion, this allows for skipping the rest of the code unless the text is actually being printed.

This allows you to, for example, increment a counter only if the the text is actually being printed.

3 Likes