Adding default content to all room descriptions

I have the following bit of code:

roomObj : Room
    "<< funcCall () >>
    Some room description. "
    vocabWords = 'room/location'

The funcCall () in the room description is something that I’d like to do in every room of the game without having to remember to add it. I know I can use modify Room to alter the base Room class behavior but I cannot figure out if the above is possible and if it is, how to do it.

Where would I need to make changes to allow for adding default content to all rooms? (I’m using TADS 3 and adv3.)

I haven’t searched in this forum but you might find this old thread useful, . Basically you want to modify Room's roomDesc, putting your func first and then calling inherited so the original roomDesc can do its thing.

modify Room
    myfunc ()
        "Printed with every room description. ";
    roomDesc ()
roomA: Room 'Room A'
    "This is the first room. "
    east = roomB

roomB: Room 'Room B'
    "This is the second room. "
    east = roomC

+ me: Actor

roomC: Room 'Room C'
    "This is the third room. "
    east = roomA

In that thread note the fine point with BasicLocation. AFAICT the Room class overrides the roomDesc of BasicLocation (see so keep that in mind for whatever you modify.

George, thank you very much, that did exactly what I was trying to do. My mistake was that I was trying to do the same with desc, not roomDesc and that didn’t work.

Come to think of it, I don’t really get why one works and the other doesn’t - I double-checked and I used the same syntax but when I try to override desc this way, my function doesn’t get called. I looked at the source code of both desc() and roomDesc() in Thing.t but I don’t grasp the difference in their implementations.

I think the use of the room template might make it less obvious. When you use the room template you are really defining desc = ... . Because desc is a method on the Room class, you are overriding that method in the object, so the object won’t inherit any modification of the Room's desc.

Thank you - I think about half an hour after posting my message I realized that setting the room description to a display string (“something”) would not call the base class function. Your solution worked; thank you again for taking the time to help.