The following code doesn’t seem to print properly in 6L02 (but it does in previous versions of Inform):
Desert is a room. Clint is a person in Desert.
The description of Clint is “[item described].”.
A person is either good, bad, or ugly. A person is good.
Rule for printing the name of a person (called target) while examining:
if target is good begin;
say “He’s good”;
now target is bad;
say “He’s either bad or ugly”;
This is the output:
He’s either bad or ugly.
Is there a way I can fix this?
This works for me.
instead of examining a person (called target):
if target is good:
say "He's good.";
now target is bad;
say "He's either bad or ugly."
Your problem (in the original code) is that strings get “preflighted” a lot in Inform. (This just came up in another thread.) When you compare two texts, for example – Inform has to execute the substitutions in both, to see if they come out equal. There are probably other cases.
Your description string contains a name, and that means it invokes the printing-the-name activity. I don’t know exactly where in the library the description property gets executed. Obviously it happens somewhere in there, during the examining action. I think you have to assume this is always possible.
Now that I look, the standard examining rule has the line
if the noun provides the property description and the description of the noun is not “”:
…so maybe that ought to be “…is non-empty”.
However, your life will be simpler if you use an examining rule (like MTW describes) instead of trying to rig the object’s name in this hair-trigger way.
Unfortunately my example was over simplified, and MTW’s solution won’t be practical for what I had in mind (not from my game; just an example):
Desert contains the grave and tombstone.
The description of grave is "[Clint] stares down at the hole. [Cleef] stands behind him, gun raised. [Clint] squints … ".
The description of tombstone is “[Barbara] cries before the tombstone. [Cleef] pays her no regard …”.
The change that Zarf suggested, though, does work. I was also thinking of adding a say phrase that would switch the property after the name was printed.