I was looking at the source code for “Slouching Towards Bedlam” and I saw this:
[if we have not looked under the blotter]
The “we” made no sense at all to me after digging through the source so I just tried this:
[if the player has not looked under the blotter]
That doesn’t work since the phrase is not understood.
So I guess my question is what does the “we” refer to? It would seem to be the player. So that leads to: why doesn’t “the player” work? The latter seems like a more intuitive way to word things but I only say that because I don’t understand the rationale.
“We have” in this context is a special phrase used to determine whether an action has been carried out. The “we” in it doesn’t have a meaning outside this “we have” phrase. (In traditional programming terms it’s more like WeHave(action) than Have(we, action) I think.)
It can actually be carried out by any actor, not just the player. This is documented in §9.12 of Writing with Inform (for some reason this wasn’t showing up on my search the first time); basically it’s just the past tense of “if looking under the floormat”:
Oh, and I guess this is the context where the action success and failure business we were talking about really matters. If you look at this code:
[code]Kitchen is a room.
The napkin is in Kitchen.
There is a poisonous spider.
Before taking the napkin when the spider is nowhere:
say “As you pick up the napkin, you find a poisonous spider in its folds and drop them both.”;
now the napkin is in the location;
now the spider is in the location;
stop the action. [leave this out if you’re doing an Instead or After rule]
Test me with “take napkin/take napkin”.
Every turn when we have taken the napkin: say “Napkin taken.”[/code]
and successively change the “Before” to “Instead,” “check,” and “after” (for “instead” and “after” you should comment out the last line, because those rulebooks by default end action processing anyway), you will see that the first attempt does not make “if we have taken the napkin” true if you use a “before,” “Instead,” or “check” rule, but do if you use an “after” rule.
(As long as you don’t put in “stop the action”–that makes the “after” rule end in failure rather than success, which seems to mess this up. This can be very tricky stuff and if it gives you trouble my advice would be to work around it; you could set a flag to check whatever condition you’re working with, and then it might be easier to check whether the flag wasn’t set.)
Checking “has been” requires an adjective. So “open” works, but “examined” doesn’t (Inform only knows examining as a verb).
If you introduce an “examined” adjective, which I think Epistemology does, this gets even more confusing: but this time the ambiguity is English’s fault, not Inform’s. “Has been examined” looks like a verb in the perfect passive, but Inform is reading it as the perfect active of “be” plus an adjective: rather than asking if anyone has examined the blotter, you’re asking if the blotter has ever had the “examined” property.
This is confusing and unintuitive, so I just avoid these sorts of constructions entirely and make my own properties to track past actions. (“After examining something: now the noun is examined.”)
Interesting. Yeah, I guess I see this can be a bit unintuitive. So going back to Slouching’s original formulation, it had:
if we have not looked under the blotter
It seems like there’s no way to formulate that without the “we” construct because “looked under” is ultimately a verb, not an adjective. (Unless, as you suggested, I made some property to track that specific action.) So the “we” is doing something specific here, which is ultimately the distinction I was trying to figure out. And it’s clearly doing something beyond just saying “the player” because it’s based on actions taken against an object, which could have been done by an NPC. So “we” seems to be referring to the game itself, sort of.
Yeah. Inform tracks past history in certain limited ways. In this example, it can track which action has applied to which object, but not which action has been applied to which object by which actor. (That is, it does not distinguish the player acting from an NPC acting.) Thus the broad idiom of “if we have…”.
If you need tracking more precise than Inform can manage, you just have to do it yourself. This is not difficult, as Draconis notes.