The player carries a look-counter. The description of the look-counter is "[incremented looking]".
Looks is a number that varies. Looks is one.
To say incremented looking:
if looks is less than ten:
say "You've looked at the counter [looks in words] time[s]!";
else:
say "Aren't you bored of this?";
increment looks.
gives me this output (counting up by two instead of one):
If I use “increase looks by one” instead of “increment looks,” it still happens; if I instead “increase looks by zero” the expected lack of incrementing occurs. Does the “to say” phrase get called twice, or something?
I’m guessing the description is being printed to an internal buffer in the course of the examining action, then printed again to the screen. (The same thing happens with printed names, because Inform needs to see whether the first letter will be a vowel to print the indefinite article.)
EDIT: Aha. Inform prints it to a buffer to see whether it will turn out blank, in which case “You see nothing unexpected.” will be shown instead.
…oh. So I should basically never change any global variables in a “to say” phrase? I thought that was the whole point of “to say” phrases!
More seriously, good to have that figured out. I’m running a little workshop tonight and thought that would be some innocuous code. I’ll use this instead:
[code]A Heisenberg Pixie is an animal here. The description of the Heisenberg Pixie is “[pixie displacement]”.
To say pixie displacement:
if the number of rooms is greater than two:
let R be a random room;
while R is the location:
let R be a random room;
now the Heisenberg Pixie is in R;
say “It’s gone in a blink – you have a suspicion that it’s now in [R].”;
else:
say “You get the distinct feeling it would rather be somewhere else.”
[/code]
Yeah, that’s what I would do if I didn’t specifically want an example of a “to say” phrase. I might strike this example anyway (especially since it’s likely that participants will run into this same problem), but I like the idea of peeking a little at the diversity of ways to accomplish stuff in Inform.
I think the moral is not to change global variables in a description – changing them in a “to say” should be OK if you don’t call that phrase from a description.