Holding watch instead of wearing it - TADS3.1

I coded a watch which should always be worn by the actor. The start of the game shows that the actor is holding the watch instead of wearing it? I’ve included all the code that should be causing this problem.


/* A class for clothing worn by the player character, and which we can't take  *
 * off. We use this for the PC's constant compliment of articles. *************/
class AlwaysWorn: Wearable
  WornBy = me
  dobjFor(Doff)
 {
    check()
   {
     cannotDoffMsg;
     exit;
   } 
 }
 cannotDoffMsg = "You must keep this with you."

 /* Exclude these from DROP ALL and DOFF ALL */
 hideFromAll(action)
 {
   return action.ofKind(DropAction)
      || action.ofKind(DoffAction)
      || action.ofKind(PutInAction)
      || inherited(action);
 }

; 

/* Show actor. ****************************************************************/
me: BagOfHolding, Actor
    location = Beach     
    VocabWords = 'Tom Thomas Tom/Thomas/Leavens'
    desc
 {
  "You're Thomas Leavens. You are known as Dr. Tom to your friends and
  associates. Your ex-wife calls you names that can't be repeated! Other than
  your underwear and socks, you're wearing your usual working attire. ";
 } 

affinityFor(obj)
{
  return (obj != self && obj.ofKind(Wearable) ? 50 : 0);
} 
 
inventoryLister: actorInventoryLister
    {
        showInventoryEmpty(parent)
        {
            /* empty inventory */
            "<<buildSynthParam('The/he', parent)>> {is} holding absolutely
            nothing. ";
        }
        showInventoryWearingOnly(parent, wearing)
        {
            /* we're carrying nothing but wearing some items */
            "<<buildSynthParam('The/he', parent)>> {is}n\'t holding anything,
            but {is} sporting <<wearing>>. ";
        }
        showInventoryCarryingOnly(parent, carrying)
        {
            /* we have only carried items to report */
            "<<buildSynthParam('The/he', parent)>> {is} holding <<carrying>>. ";
        }
        showInventoryShortLists(parent, carrying, wearing)
        {
            local nm = gSynthMessageParam(parent);
            
            /* short lists - combine carried and worn in a single sentence */
            "<<buildParam('The/he', nm)>> {is} holding <<carrying>>,
            and <<buildParam('it\'s', nm)>>{subj} sporting <<wearing>>. ";
        }
        showInventoryLongLists(parent, carrying, wearing)
        {
            local nm = gSynthMessageParam(parent);
            
            /* long lists - show carried and worn in separate sentences */
            "<<buildParam('The/he', nm)>> {is} holding <<carrying>>.
            <<buildParam('It\'s', nm)>> sporting <<wearing>>. ";
        }
        /*
         *   For 'tall' listings, we'll use the standard listing style, so we
         *   need to provide the framing messages for the tall-mode 
         *   listing.  
         */
        showListPrefixTall(itemCount, pov, parent)
            { "<<buildSynthParam('The/he', parent)>> {is} holding:"; }
        showListContentsPrefixTall(itemCount, pov, parent)
            { "<<buildSynthParam('A/he', parent)>>, who {is} holding:"; }           
    }    
/* Use person-sized Bulk. */
   bulk = 10
;

+watch: AlwaysWorn 'wrist wristwatch/watch' 'wristwatch'
    "It's just a cheap watch."
cannotDoffMsg = "You must wear this."

;   

/* Room0001: The Actor Starts Game Here. **************************************/

  Beach : OutdoorRoom 'At The Beach' 'At The Beach'
  roomFirstDesc()
  { "This is first description.";
  }
  shortDesc = "You are at the sandy beach.";
; 

/* Room0002: The path from/to the beach. **************************************/

I certainly could use some help on this one.

RonG

Only class names start with a capital letter. Functions, properties and objects start with lower case.

WornBy -> wornBy
VocabWords -> vocabWords


class AlwaysWorn: Wearable
  wornBy = me
  dobjFor(Doff)
  {
     check()
     {
        cannotDoffMsg;
        exit;
     }
  }
;

The code above works fine.
I guess the fault is that “wornBy = me” should not begin with a capital letter. The same with “vocabWords” …
Greetings,
– MI

BTW: I’m not quite sure what you’re shooting for by inherting the player char from “bag of holding” …

Many thanks for your help. I doubt that I would ever have found the problem without it.

Making the player have affinity lets all objects he picks up be automatically sorted and put in the proper bags of holding. My player will have pockets in his pants, pockets in his shirt and will be wearing a backpack. All of those, along with the player, will be bags of holding and will only vary in their assigned affinity. This technique, and the code are shown and explained in the source for ‘Return To Ditch Day’.

RonG