I7: Scope and library actions

Over in the “Lost Items” thread, capmikee has been struggling (and seems to have succeeded) to get around a thorny issue with Inform’s implementation of scope. Basically, the problem is that when Inform calculates the scope of the player, anything not scoped is actually unmentionable. This means that an author has to do a good bit of work to identify whether the player has referred to something that can’t be seen, or whether she’s simply referred to nothing at all. Solutions are generally hacky and requiring text-matching (though I’m not sure whether they require including the indexed text template).

My question is, what would be the objection(s) to recasting the library actions so that all of them can process any (publically-mentioned) object in the game? For example:

[code]Examining is an action applying to one visible thing and requiring light. Understand “think about [any thing]” as examining.

Check examining something:
if the player cannot see the noun:
issue library message number 30.[/code]

I guess the first objection would be that this involves repeating very similar code for each action. That’s valid, but are there other reasons not to do this? Do the benefits outweigh the negatives?

–Erik

My impression is that the reason for the current situation is that I6 handles a lot of early stages of parsing. If we were to change every verb grammar to accept any visible thing, we’d end up doing away with a lot of the I6 infrastructure. Maybe that’s not a bad thing, but it’s a big decision, and I can imagine that it would make games run a lot slower.

Personally I’m in favor of lightening the parser’s load and putting more of the burden on I7-style rulebooks, but I’m not sure I totally understand the situation.

To implement what you’re talking about in a general way, I can imagine that actions would be given properties to define the requirements for the noun and second noun, and a some rulebook other than a check rulebook would check the command against the properties of the action understood. Currently that stuff happens before the Before rules, and I’m speculating that we would want them to happen after the Instead rules, or at least after the Before rules. But I’m not certain of the implications.

Or perhaps certain check rules would be generated automatically when the requirements for an action were declared.

It’s possible to set the I6 variable wn to point to the first unknown word of the player’s command, then call NextWord() to see if it returns zero (word not in dictionary) or non-zero (word in dictionary… somewhere.)

That may not be specific enough for the Lost Items problem, because it doesn’t distinguish between objects, topics, pronouns, etc.