How do I check whether a person is in the presence of another object?

Mostly, except that being in scope is not quite the same as being visible- as described in this post sometimes things can be in scope even when not visible, or out of scope despite being visible.

As expected, your example translates to I6 code that tests visibility - TestVisibility(x,I128_scalpel) rather than simply scope (TestScope(I128_scalpel, x).

Although TestScope() is called in TestVisibility() as long as the object in question is illuminated (its parent offers light), the presence of conditions that must be fulfilled before TestScope is called illustrates how visibility subtly differs from ‘in scope’:

[ TestVisibility A B;
	if (~~OffersLight(parent(CoreOf(A)))) rfalse;
	if (suppress_scope_loops) rtrue;
	return TestScope(B, A);

Thus, in practical terms, the visibility relation is defined as something close to ‘being both illuminated and in scope’- but note that in certain conditions (when suppress_scope_loops is true) scope isn’t necessarily tested for in determining the visibility of even illuminated items and also despite its name TestScope() does not in itself fully define scope: for example directions test negative in TestScope() but are in scope nevertheless…

Conceptually, scope is defined by those objects that an actor is allowed to refer to in the course of the parser creating an action from a parsed command, which explains why philosophically its true context is properly only actions and also why it is subtly different from both visibility and touchability- both in concept and in its implementation in I7.

EDIT- my mistake- ‘if (~~OffersLight(parent(CoreOf(A))))’ tests whether the observer, not the observed object is illuminated. So it technically filters out situations where the observer is in the dark. That said, since visibility depends on a transparent path between the observer and the observed object, the result is the same, since if the observer is illuminated an object visible to the observer must by definition also be illuminated.