asking nobody about something

While trying to guess what a player might type, I realized that I can’t get I7 to handle the following.
If, for example, there is only the box and John in the room, it would be rational of the player to type “Ask about the box” rather than “Ask John about the box”.
The response to “Ask about the box” is a confusing “You can see no such thing”.
I can’t see a way of trapping and dealing with this. Amongst other things, I tried making a rule for ‘asking about something’ (as opposed to ‘asking someone about something’) but I7 insists that it can already handle ‘asking about something’.
What have I missed?

You could use another action to help: (untested, but should give the idea)

[code]Targetless asking about is an action applying to one topic.
Understand “ask about [text]” as targetless asking about.

Definition: a person is NPC if it is not the player.

Check targetless asking about when the number of NPC persons in the location is 0:
say “There’s nobody here to ask.” instead.

Check targetless asking about when the number of NPC persons in the location is greater than 1:
say “You have to be more specific about who you want to talk to.” instead.

Carry out targetless asking about:
let target be a random NPC person in the location;
try asking the target about the topic understood;
stop the action.[/code]

Here’s a little scenario to demonstrate one way to do this:

[code]The Lab is a room.

The Station is north of the Lab.

The Wasteland is north of the Station.

Bob is a man in the Lab. Cindy is a woman in the Station. Lindy is a woman in the Station.

Definition: A person is virtual if he is not the player.

There is a box in the Lab. There is a pencil in the Lab.

Asking about is an action applying to one visible thing. Understand “ask about [any thing]” as asking about.

Check asking about something when the player cannot see a virtual person:
say “There is no one here to ask about the box.”;
stop the action;

Check asking about something when the player can see more than one virtual person:
say “Please indicate who you would like to talk to about [the noun] by typing ‘ask about [the noun]’.”;
stop the action.

Carry out asking about something (called the item):
if there is a virtual person in the location:
let interlocutor be a random virtual person in the location;
try quizzing the interlocutor about the item;

Quizzing it about is an action applying to two visible things. Understand “ask [something] about [any thing]” as quizzing it about.

Report an actor quizzing something about (this is the generic quizzing rule):
say “[The noun] doesn’t have much to say about that.”

Report an actor quizzing Bob about the box:
say “Bob says, ‘That, sir, is my favorite cardboard box. I’ll thank you to leave it alone.’”;
rule succeeds.[/code]

I created the quizzing action because you seemed to want to ask about things, and Inform’s “asking about” action refers to topics.

–Erik

…And I see that Nitku beat me to it with exactly the same solution. Ah well…

Thankyou both for your replies, which answer my question.
I had been trying something similar, but had been using ‘something’ rather than ‘one visible thing’.
What is the difference between ‘one thing’, ‘any thing’ and ‘something’?

Also, I didn’t have-
Understand “ask about [any thing]” as asking about.
and I don’t understand what this does.

Understand "ask about [any thing]" as asking about.

This provides the grammar for the new action–it describes what the player can type to cause the action to be triggered.

The “[any thing]” token means that any object in the game will be matched, which is why it’s good for conversations. This way, you can talk about an object that’s in another room. (If you don’t want the player to be able to talk about objects he hasn’t seen, you can check out the Epistemology extension, which tracks actors’ knowledge, allowing you to refer to “any known thing”.)

If we had just used the “a thing” or “something” token (these are synonyms), then only objects that the player can actually see will be matched: if the player tries to ask about a pencil that’s in another room, the game will respond with “You can’t see any such thing.”

If you want use the “[any thing]” token in your grammar, it is also important that you define the action itself using “one visible thing”:

The “visible” tells Inform that the player doesn’t need to be holding the object to interact with it, that it needs to be merely visible for the action to succeed. If you don’t specify visible–for example, if you just use “Asking about is an action applying to one thing”–Inform will assume that you the player needs to be holding the object for the action to succeed. And thus, if it’s off in another room, the player won’t be able to do that and the action will fail with a message something like "You cannot reach into the ".

Yes, this does seem a bit odd–an object off in another room is not visible, so why should we use the term “visible” in referring to it? The answer is that “visible” doesn’t really mean “able to be seen”–it means “in scope,” and what that means is that the object can be interacted with, regardless of whether the player can see it. When we used “any thing” in our grammar, Inform opened up the scope to include all things in the game, and thus, for the duration of this action, everything is “visible” in this sense. (Arguably, it was a bad idea to use the term “visible” for the concept of scope. But once it’s clear that the word has a special meaning, it isn’t too hard to understand.)

Jim Aikin’s Handbook talks about scope, if you want to read more (it’s a pretty fundamental concept):

http://www.musicwords.net/if/InformHandbook.pdf

–Erik

Thankyou Erik.
Although I have been tinkering with programming in various languages over the last 30 years or so, I am finding I7 very difficult to get to grips with. Thank goodness for forums!

An important thing that hasn’t been said (unless I missed it) is that the compiler is reading “about” as a noun. It’s used to seeing “Ask Bob about stuff” where Bob is a noun that can be looked for.

“Ask about…” looks like you’re asking some person or thing called “about”. Thus, “You can’t see any such thing.”

That’s why a new syntax had to be developed to make the compiler recognize that construction.