[I6] Creature token excludes talkable for ##AskTo action?

I was surprised to discover that, in Inform 6.31’s Standard Library 6/11, an object defined as talkable will not parse for an ##AskTo action.

[ CreatureTest obj;
    if (obj has animate) rtrue;
    if (obj hasnt talkable) rfalse;
    if (action_to_be == ##Ask or ##Answer or ##Tell or ##AskFor) rtrue;
    rfalse;
];

Note that the same appears to be the case in Standard Library 6.12.4.

Every other speech-like verb seems to be enabled. Is there some good reason why this one is excluded?

Is it for consistency with the BOB, GO NORTH form of ordering? I don’t remember if that applies to talkables.

Apparently not in Inform 6.31:

Object visiscreen "visiscreen" Start
...
    has     talkable;

yields interaction:

>SCREEN, GO SOUTH
The visiscreen has better things to do.

>ASK SCREEN TO GO SOUTH
You can only do that to something animate.

Isn’t there something in the DM4 that has the PC giving orders into a microphone?

First paragraph of DM4 p. 134 ends with: “Talkable objects can also receive orders: see the next section.” (referring to Section 18 “Making conversation”)

##AskTo isn’t mentioned in DM4 at all, so it’s a newly added action (if you can call 2004 “new”). Perhaps it’s just an oversight.

@otistdog, could you post a test game containing exactly what you’re trying to do? I’ll go over it and the Library to see where the problem lies.

Sure. Here’s a minimum demonstration of what I’m looking at:

Constant Story "Talkable v AskTo";
Constant Headline "^(a quick demo)^";

Include "Parser";
Include "VerbLib";
Include "Grammar";

Object Start "Starting Point"
    with    description
                "An uninteresting room."
    has     light;

Object visiscreen "visiscreen" Start
    with    name 'screen' 'visiscreen',
            orders
                [;
                    "<visiscreen received order>";
                ]
    has     talkable;

[ Initialise ;

    location = Start;

];

This produces interaction:

Talkable v AskTo
(a quick demo)
Release 1 / Serial number 201028 / Inform v6.31 Library 6/11 SX

Starting Point
An uninteresting room.

You can see a visiscreen here.

>screen, jump
<visiscreen received order>

>ask screen to jump
You can only do that to something animate.

As mentioned above, the issue seems to be in the definition of the CreatureTest() routine, which does not include the ##AskTo action in its filter for talkable objects.

1 Like

To make this work, you need to extend the ask verb. Put this sometime after you include grammar.h. It doesn’t seem to matter at this point if you use first or last.

Extend 'ask' last
        * talkable 'to' topic           -> AskTo;

Any time you have a verb that doesn’t react like you want it to, look at grammar.h and you’ll see how Inform is reacting. Here, the stock matches all are with a creature, not a talkable. So, the above addition is an extra rule that matches asking a talkable to do something. In your case, invoking AskToSub() is the best choice. Depending on how you want things to work, you could have the new rule invoke a different function, either from the Library or something you write yourself.

@DavidG, Thank you for looking at this. I understand how to extend verbs in the way that you are suggesting, but the underying question is why there is an issue for an ##AskTo action (included in the Standard Library) in the first place.

I’m pretty sure that the “You can only do that to something animate.” error occurs because the creature token in the grammar line for AskTo won’t accept an object without the animate property, with exceptions that apply to speech-like actions for objects with the talkable property.

Since the action in question (##AskTo) is a speech-like action, and since the Standard Library’s relevant grammar line uses the creature token, shouldn’t ##AskTo be included in the exceptions carved out for speech-like actions applying to objects with the talkable property in the parser’s CreatureTest() routine? If not, why not?

1 Like

Here’s the whole of what’s going on with the ASK verb:

Verb 'ask'
    * creature 'about' topic                    -> Ask
    * creature 'for' noun                       -> AskFor
    * creature 'to' topic                       -> AskTo
    * 'that' creature topic                     -> AskTo;

Given this, you can do ASK ALICE ABOUT CARDS, ASK MECHANIC FOR THE SMALL WRENCH, ASK FLOYD TO PUSH THE BUTTON, or ASK THAT JAMES TAKE THE DISHES. That creature clause means that something animate must be the target of the interaction. Before applying the fix I suggested, you tried ASK VISISCREEN TO MAGNIFY THE ENEMY VESSEL, for instance. The parser runs through the rules for ASK and looks for a match. All four of those require interaction with something animate. It finds that the visiscreen is not animate and so complains that it’s unable to comply. Your second paragraph is correct up to the point you say “with exceptions”. That exception is added by the Extend statement I suggested.

There are a lot of things that would be a good idea, like making ASK accept a talkable target. But not all of these good ideas can go into the Library. That’s why Inform6 gives you, the author, the ability to add your own grammar to the standard grammar. That’s much easier than hacking on the Library itself.

If you have another look at the first post, though, what otistdog is saying is that it’s not consistent.

The creature grammar token does accept ask visiscreen about cards, or ask visiscreen for the small wrench – but not ask visiscreen to push the button. (Which almost makes sense, as a talkable is less likely to be able to follow orders – except that as demonstrated visiscreen, go south does produce a “refusal to follow that order” response rather than a “that can’t follow orders” response.)

It really does just look like an oversight in the implementation of the creature token not matching for that action. (It matches any animate regardless of action; plus also talkable but only for a limited set of talking actions. This is documented in DM4, but again note that ##AskTo was added after DM4 so isn’t mentioned at all.)

And yes, this can be worked around by adding an extra rule in the story, but it does seem like a bug since this is an action and grammar defined by the library in the first place.

(FWIW, I7 doesn’t implement ##AskTo (or ask x to y) at all, presumably as this was added to the library after the point at which it was forked.)

1 Like

@mirality – Yes, precisely. Thank you.

@DavidG – I get that the Standard Library is designed for extensibility, not completeness. But shouldn’t what’s there be consistent? The creature token accepts every other speech-like action in the Standard Library as OK if the object is talkable. Why should ##AskTo be different?

1 Like

I’m generally reluctant to add stuff to the Library that’s basically customization. Looking again at grammar.h, I see no usage of talkable at all. Then I pawed through earlier releases of the Library and came across this in 6/1’s Changes file:

147. Conversation generally reformed (but without any incompatible changes).
    Ask, Tell, Answer now prepare consult-style topics and accept multiple
    word topics.  talkable objects can now be Asked, Told, AskedFor, etc.

It seems that Graham intended speech verbs to work on talkable objects by default, exactly as you’re trying to do. Sometime between then and now, something broke. It looks like your suggested changes are therefore justified. I’ll work on it tonight and check for unintended consequences.

That’s because the parser takes care of it inside the creature token. (Essentially that token means “animate or (talkable and talking_action)”. Whether that’s sensible is a different question, but that’s how it’s currently designed, rather than extending the grammar – just that it overlooks one of the talking actions.)

@DavidG, I totally get it, and that’s absolutely the appropriate attitude to have as the maintainer! To make sure that we are on the same page, the suggested change would be to modify the definition of CreatureTest() from:

[ CreatureTest obj;
    if (actor ~= player) rtrue;
    if (obj has animate) rtrue;
    if (obj hasnt talkable) rfalse;
    if (action_to_be == ##Ask or ##Answer or ##Tell or ##AskFor) rtrue; ! THIS LINE CHANGING
    rfalse;
];

to

[ CreatureTest obj;
    if (actor ~= player) rtrue;
    if (obj has animate) rtrue;
    if (obj hasnt talkable) rfalse;
    if (action_to_be == ##Ask or ##Answer or ##Tell or ##AskFor or ##AskTo) rtrue;
    rfalse;
];

I appreciate your willingness to consider this change and to take the time to look into its potential consequences. And thank you again for all of the work that you do as maintainer of I6.

1 Like

That’s not quite sufficient, there’s another line here that would need similar modification:

I’ve gone over things and pushed a fix for both places indicated.