Using SHOW IT TO with uncarried objects

Hi, I have a quick question about actions in Inform 7.

I’m writing a game in which characters need to be able to SHOW things that aren’t being carried. Here is my current attempt:

The Overlook is a room.  "This is a scenic overlook with a fabulous view of the Grand Canyon."

John is a man in the Overlook. 

The Grand Canyon is a backdrop in the Overlook.  The description is "You gaze out over the canyon in awe."

Before an actor showing something to someone:
 try the second noun examining the noun instead.

Persuasion rule for asking people to try doing something: persuasion succeeds. 

This works fine for the player:

SHOW JOHN THE GRAND CANYON
John looks closely at the Grand Canyon.

However, it does not work for non-player characters:

JOHN, SHOW ME THE GRAND CANYON
(John first taking the Grand Canyon)
John is unable to do that.

In other words, John tries implicitly taking the Grand Canyon before the “before” rule is invoked. Can anyone explain what I’m doing wrong? Is action processing for NPCs different than for the player? How can I avoid John trying to take the canyon?

This is a recurring issue that has to do with how the showing it to action is defined. As per the standard rules, the definition is this:

Showing it to is an action applying to one carried thing and one visible thing.

and Understand "show [someone] [something preferably held]" as showing it to (with nouns reversed). Understand "show [something preferably held] to [someone]" as showing it to. Understand the commands "present" and "display" as "show".

This isn’t the first thread about the showing it to action, and overriding it tends to get a bit messy. It may be simpler to sidestep the issue and create a new action (perhaps called “demonstrate”) that does not apply to a carried thing and that does not have “something preferably held” as an Understand token.

You could use this as a starting point:

[code]Understand nothing as showing it to.
Demonstrating it to is an action applying to two visible things.
Understand “show [someone] [something]” as demonstrating it to (with nouns reversed).
Understand “show [something] to [someone]” as demonstrating it to.
Instead of demonstrating a not fixed in place thing to someone, try showing the noun to the second noun.

To point is a verb.
Report demonstrating something to someone (called audience):
say “[We] [point] out [the noun] to [the audience]. [The audience] [regarding the audience][are] unimpressed.”[/code]

For proper customization, I recommend you add some sort of property to distinguish things-preferably-handed-over from things-preferably-pointed-toward.

You can actually make your additional approach work by adding this line:

Before asking someone to try showing something to someone: try the second noun examining the noun instead.

(If you type the “actions” debugging command before typing “John, show me the grand canyon,” it’ll show that the action that generates the implicit take is “asking John to try showing the Grand Canyon to yourself,” so that’s what we need to write the rule to cover.)

It’s also easier to override the carrying requirements on an action in 6L02 and subsequent versions of Inform than it was before, at least without using the now-eliminated-and-never-loved procedural rules. (Easier in the sense in which math professors say “I’ve thought about it for two days, and it’s trivial”; it took me a while to get the syntax and everything right here.)

As per example 377, “Lollipop Guild,” the “carrying requirements rule” is the one that blocks implicit takes, so we want to say “The carrying requirements rule does nothing when…” Unfortunately if we just write “…when showing something to someone” that doesn’t seem to cover third-party actions. The only way I was able to get it working was just by extracting the action name part of the current action, which is the same no matter who’s acting:

The carrying requirements rule does nothing when the action name part of the current action is the showing it to action.

And then I had to delist two separate check rules that were interfering with the showing action, because the Standard Rules really don’t want to let a rogue showing action through:

The can't show what you haven't got rule is not listed in any rulebook. The block showing rule is not listed in any rulebook.

And then we have to write more rules for showing it to. In this case we can just redirect the action to examining, but if we wanted something a bit more complicated we could do that too. So what we get is:

[code]The Overlook is a room. “This is a scenic overlook with a fabulous view of the Grand Canyon.”

John is a man in the Overlook.

The Grand Canyon is a backdrop in the Overlook. The description is “You gaze out over the canyon in awe.”

The carrying requirements rule does nothing when the action name part of the current action is the showing it to action.

The can’t show what you haven’t got rule is not listed in any rulebook.
The block showing rule is not listed in any rulebook.

Carry out an actor showing something to someone: try the second noun examining the noun.

Persuasion rule for asking people to try doing something: persuasion succeeds. [/code]

Eleas and Matt,

Thanks for the responses! Your suggestions are very helpful and do pretty much exactly what I was trying to accomplish.

Just out of curiosity, I still don’t understand the implicit taking happened before the “before” rule was invoked. According to the action processing rules flowchart, the “before” rule should have been applied before the carrying requirements rule. Is that not the case when an NPC is acting? Does the act of asking an NPC to do something trigger the carrying requirement on its own?

Anyway, thanks again for the help!

[code]Fooing is an action applying to one carried thing. Understand “foo [something]” as fooing.

There is a room. A bar is here.[/code]

As you can see, simply defining an action as “applying to one carried thing” makes the difference. It causes the action to invoke the Carrying Requirements rule, which handles implicit taking of the noun.