According to this post, the item described can normally be used in reaching outside or reaching inside to reference the object being reached for. However, it’s not working for me, and looking at the definition in the Standard rules (The item described variable translates into Inter as "self".), I strongly suspect that it works only by coincidence, not by design. (That definition makes me think it’s only meant to be used when evaluating text that’s assigned as a property of an object.)
Is there any way to determine what the item being reached for actually is? I think the item being reached for will always be either the noun or the second noun, but I don’t know any way to determine which of the two it is, and checking both would require extra logic to handle cases where one of them is reachable and the other isn’t.
The runtime must know what the object being reached for is, otherwise it couldn’t have decided to call my reaching rule. Ideally, I’d like to directly grab the object the runtime knows about, somehow.
As a side note, there’s also an I6 global touch_persona which is the person doing the reaching, or “nothing” (0) if the person reaching is the actor. This only matters when you try to check “if Bob can touch the crystal chandelier” outside normal action processing.
This is not the same as the I7 global “person reaching”, which is always the same as the actor. I don’t know why they did it this way. But you can expose touch_persona too if it becomes relevant.
That should work fine, yeah. Probably wrap it in parentheses for extra safety. The only place the person reaching is currently used is in error responses, which are never printed if for “if Bob can touch the crystal chandelier” checks, but it’s the sort of thing you might want to incorporate into your own rules.
That somehow manages to cause runtime errors even in rules that don’t use the phrase:
...
[Rule "First reaching outside something ( called the barrier )" applies.] (00:00.000188)
[** Programming error: tried to find the "." of (something) **]
[** Programming error: tried to read (something) **]
[Rule "can't reach outside closed containers rule" applies.] (00:00.000148)
[** Programming error: tried to find the "parent" of <illegal object number 1> **]
[** Programming error: tried to find the "parent" of <illegal object number 1> **
...
I get the same thing if I just expose touch_persona:
The reacher is a thing that varies.
The reacher variable translates into Inter as "touch_persona".
…okay, the output is slightly different:
...
[Rule "First reaching outside something ( called the barrier )" applies.] (00:00.000198)
[** Programming error: tried to find the "." of (something) **]
[** Programming error: tried to read (something) **]
[Rule "can't reach outside closed containers rule" applies.] (00:00.000619)
[** Programming error: tried to find the "parent" of nothing **]
[** Programming error: tried to find the "parent" of nothing **
...
For reference, the first rule mentioned in both of those is a rule that just prints reacher and makes no decision.
Ahh. It looks like there is code in the accessibility rules that changes the actor to the touch_persona, if they’re different. But then what’s the purpose of touch_persona? I’m confused.
So that makes me wonder… is stuff going break if I want to ask if Bob can touch the crystal chandelier in an action rule? Does that overwrite the actor to Bob and break further action processing rules? Or does it set the actor back after the reach check is done?
Nope, it sets it back afterward. Inform’s built-in kits are very good about preserving the values of globals like that, and some core decisions in Glulx’s memory model were actually chosen to help with it.