Wearable, Worn AlwaysWorn. Etc. in TADS3

I am trying to start my game with some objects always being worn by my actor. Here is a test I am using. This does run without any compile errors:

+me: BagOfHolding, Actor
vocabWords = ‘doug douglas doug/douglas/mittling’
"You’re Doug Mittling, Engineering Manager, Industry Products
Group, Omegatron Corporation. It’s been about a decade since
college, and the passage of time has started to show; you’re
a little softer, a little wider around the middle, and a
bit pale from spending most of your time indoors. ";



++cap : Wearable ‘sailor’s cap’ ‘sailor’s cap’
"It’s a large round hat with a white top and a small blue peak. "

When I start the game it shows the cap being CARRIED rather than worn. I can’t find any examples (even in the manuals) of how to show objects as being always worn at the game start. I want these object to be a permanent part of the actor. One object I’d like to use is a watch.

I could, once again use some help with this. Any suggestions :question:

++cap : Wearable 'sailor\'s cap' 'sailor\'s cap' 
    "It's a large round hat with a white top and a small blue peak. " 
    wornBy = me

If you look up Wearable in the Library Reference, it shows you all of its properties.

Nine times out of ten, the only properties you’re interested in are the ones that are either unique to the class or overridden with some new behavior.

So you can skip past the two summaries and focus on the two sections at the bottom - Properties and Methods. There we find wornBy listed.

It’s generally worth glancing at the “setter” method (in this case makeWornBy) to make sure that nothing tricky is going on behind the scenes. If you click the line number link it will jump to that spot in the adv3 code.

Reading it shows that it’s very straightforward: the makeWornBy method only sets the wornBy property to a value. So it’s logical to assume that you can simply assign an initial value to that property when defining the object, and you’ll get the right behavior.

To answer the other part of your question (assuming I’m understanding you), if you want the cap not to be removable, add something like this (directly copied from my actual WIP) to the code for the cap:

dobjFor(Doff) { check() { failCheck ('You forgot to pack the sunblock. If you take off the hat, your nose will turn as red as a beet. '); } }

Thanks for the help from both of you. I’m finally starting to learn how to use the manuals, especially the Library Reference.

Not to say that I won’t be back here again.