The Four-Eyed Guide to TADS 3 by David Welbourn index


KISS singleDobj

Default minimal behavior

>kiss
Whom do you want to kiss?

>kiss me
You cannot kiss yourself.

>kiss floor
Kissing the floor has no obvious effect.

  • • •

>kiss moon
The moon is too far away.

>kiss troy
Troy probably wouldn't like that.

+ moon: Distant 'moon/luna' 'moon' ;

+ Troy: Person 'troy/man' 'Troy' ;

kiss matches VerbRule(Kiss) which invokes KissAction. However, KissAction requires a direct object, and if you don't specify one, the program will attempt to auto-select a suitable thing for you to kiss. If it can't find anything suitable, it will ask the player "Whom do you want to kiss?" (I believe this question is constructed from the verbPhrase 'kiss/kissing (whom)' in the VerbRule(Kiss) definition.)

kiss floor and kiss moon also match VerbRule(Kiss) and are handled by the definition of Thing.dobjFor(Kiss). Thing.dobjFor(Kiss)'s check step uses the pre-condition touchObj, which means that the actor must be able to touch the object in order to kiss it. Since the PC can touch the floor, the check passes, and execution can proceed to the action step, and thus gActor.getActionMessageObj.cannotKiss is printed. However, the actor cannot touch the distant moon, and in that case, the check fails, and gActor.getActionMessageObj.tooDistant(obj) is printed instead. (Note: Other default messages can be printed if the object can't be touched for some other reason.)

kiss me and kiss troy also match VerbRule(Kiss), but since the PC and Troy are actors, the definition of Actor.dobjFor(Kiss) overrides Thing.dobjFor(Kiss). The verify step declares that kissing oneself is illogical, therefore, in the "kiss me" case, gActor.getActionMessageObj.cannotKissSelf is printed. Troy has no trouble with the verify step, and execution passes to the action step and prints gActor.getActionMessageObj.cannotKissActor.

Simple Kissing

>kiss amy
"Mmm. You still got it, Larry."

+ Amy: Person 'amy/wife/woman' 'Amy'
  • • •
  dobjFor(Kiss) {
    action() { "\"Mmm. You still got it, Larry.\" "; }
  }
;

Help “Kiss” Choose Preferred Objects Of Our Affection

>look
Montgomery Train Station
This is where your wife Amy asked you to meet her.

Amy is here.

Troy is here.

>kiss
(Amy)
"Mmm. You still got it, Larry."

modify Person
  dobjFor(Kiss) {
    verify() {
      if (gActor == self)
        inherited();
      else if (gActor.isHim == isHer)
        logicalRank(140,'Hetero kiss preference');
      else
        logicalRank(130,'People prefer to kiss people');
    }
  }
;
  • • •
+ Amy: Person 'amy/wife/woman' 'Amy'
  isHer = true
  • • •
  dobjFor(Kiss) {
    verify() { 
      if (gActor == Larry)
        logicalRank(150,'Larry loves his wife');
      else inherited();
    }
    action() { "\"Mmm. You still got it, Larry.\" "; }
  }
;

[UNTESTED] This code should make Amy, at logical rank 150, the most preferred choice of Larry's kiss. All other ladies are the next likely choices at rank 140, and gentlemen are at rank 130. All other actors—e.g.: cats, dogs, and monkeys—stay at the default rank of 100, and inanimate objects retain their rank of 50.

Summary of library references to kissing

actions.t

Short description

DefineTAction(Kiss)

Defines class KissAction: TAction

Note: DefineTAction(name) is a macro defined in adv3.h.

Note: TAction is a class defined in action.t.

actor.t

Short description

Actor.dobjFor(Kiss) TODO

precond.t

Short description

touchObj: TouchObjCondition Pre-condition: actor must be able to touch the object.

thing.t

Short description

Thing.dobjFor(Kiss) TODO

en_us\en_us.t

Short description

VerbRule(Kiss)

Associates the grammar "kiss singleDobj" with KissAction.

Note: VerbRule(tag) is a macro defined in en_us.h.

Note: KissAction is defined in actions.t (see above).

en_us\msg_neu.t

Short description

playerActionMessages.cannotKiss 'Kissing {the dobj/him} has no obvious effect. '
playerActionMessages.cannotKissActor '{The dobj/he} probably wouldn\'t like that. '
playerActionMessages.cannotKissSelf '{You/he} cannot kiss {yourself}. '