T3: Signs of Affection

Here’s a minor but amusing little conundrum. My PC and an NPC are romantically involved, so I’ve implemented a response to the kiss action. ‘kiss barbara’ works fine, as does ‘barbara, kiss me’.

But English provides an alternative grammar for this action: ‘give barbara a kiss’ or ‘barbara, give me a kiss’. I tried creating an invisible kissObj for the GiveTopic or the CommandTopic @GiveAction to use, but this approach seems to have messy side effects, because the kissObj has to be in scope for it to work.

For example, if I add the kissObj to scope using getExtraScopeItems, I get a transcript like this:

This happens even though the kissObj has:

dobjFor(Default) { action () { "You can<./s>t see any such thing. "; } }

Do I just need to refine the kissObj to handle these side effects somehow, or is there a better approach to ‘give barbara a kiss’ that doesn’t involve a stealthy object?

Hrmph. I solved exactly half of the problem, like this:

modify VerbRule(Kiss) (('kiss' | 'hug') singleDobj) | ('give' singleDobj ('a' | ) ('kiss' | 'hug')) : ;
This causes ‘give barbara a kiss’ to work properly. But for some reason, ‘barbara, give me a kiss’ doesn’t convert to ‘barbara, kiss me’. The code for the latter (I’m using the TCommand extension) is:

+ TCommandTopic @KissAction matchDobj = me topicResponse { nestedActorAction(me, Kiss, barbara); } ;
Most likely TADS is preferring the grammar for GiveTo when it encounters that command, but I’ve found this hard to test, because for some reason the NPC’s code isn’t working for any input of the form ‘barbara, give me the wand’ (even when Barbara is carrying the wand and I’ve written a TCommandTopic that should match it).

Suggestions welcome…

You are running into my favorite source of inexplicable NPC behavior: giveMeToAskFor.

The command “Barbara, give me a kiss” is being re-written as “ask Barbara for a kiss” behind the scenes. This happens before verb rules are processed.

Oh, dear. That’s what I was afraid of. In that situation, it appears that there will actually have to be a kissObj in scope for Barbara to try giving. I’ll work on it some more.

I hope you keep posting to this thread, as you continue to work at this. (For the record, it wouldn’t occur to me to trap “Ask Barbara for a kiss,” either.)

Is there no standard way for working with abstract nouns like this?


I would call Jim’s approach of using an actual game object for an abstract noun the “standard” way. At least, it’s essentially the same technique Aaron Reed uses in Sand-dancer, and it’s relatively well supported by the library.

The kissing question has come up before and the linked thread explores some related issues. (It was pre-3.1 and the library error mentioned has since been fixed, so better solutions may be viable now.)

Then how does one usually deal with an “X KISS” command?

–I suppose Jim wants a response identical with “X OBAMA” when there is no “Obama” object implemented in the game.

To my way of thinking, I’m not even certain what kind of response to give to such a command… The command itself doesn’t make sense.


It’s working for me now. I can’t quite remember what I did. Here’s some code, though – decipher it if you can. jTCommandTopic is an inheritance class for Julia based on the TCommand extension.

[code]+ jTCommandTopic @KissAction
matchDobj = me
topicResponse {
nestedActorAction(me, Kiss, julia);

+jAskForTopic @tKiss
topicResponse {
nestedActorAction(me, Kiss, julia);
There is, obviously, a Topic object, tKiss. Julia herself has this:

dobjFor(Kiss) { verify() {} check() { failCheck (noKissMsg); } }
And finally, we have:

modify VerbRule(Kiss) (('kiss' | 'hug') singleDobj) | ('give' singleDobj ('a' | ) ('kiss' | 'hug')) : ;

Thanks, Jim!