"Listen" - Ask player what they want to listen to

First of all, I just want to say how awesome and welcoming this IF community is, and I’m really enjoying learning TADS 3.

Basically, how would I make it so typing in “listen” asks the player what they want to listen to? I figured this would be done either by remapping “listen” as “listen to”, as this would automatically ask the player this.

Or to modify “listen” somehow to react like typing in “take”, as typing in this will ask the player what they want to take. Despite searching through the documentation, I can’t find the syntax to what I want. Could anyone help with this?

Many thanks.

Wingin’ it here, but possibly I can help. If the player types LISTEN, what happens is the ListenImplicitAction. You can find this under Actions in the Library Reference Manual. The execAction for this is in DefineIAction(SenseImplicit), which is a few lines earlier in actions.t. You may be able to override execAction on ListenImplicitAction with a message like ‘You’ll have to say what you want to listen to.’ Since the player might or might not be in a room where anything is audible, you’d probably want execAction to check for the location. If the location is not one where you need special handling, just call inherited().

Of course, if you’re using SimpleNoise objects, they won’t be mentioned in the room description unless you mention them yourself. But if you’ve done that, a command like LISTEN TO CAR HORN will produce the description of the carHorn: SimpleNoise.

Thanks! I was able to successfully implement this with the following code:

modify ListenImplicitAction { execAction() { if (me.isIn(roomName)) { "You'll have to say what you want to listen to. "; } else { inherited(); } } }