Sound and AgendaItem

I’ll start with saying that I’m very used to TADS 2, but I’ve moved on to TADS 3 for my latest works. That said:
I have three rooms connected with a SenseConnector, sound only. An NPC will, at a few points, talk or yell; I want the quiet talking to go unheard in other rooms, but the yelling to transmit. How would I go about doing this inside an AgendaItem?

The talking works fine; if the PC is in the same room, he hears the conversation I’ve scripted. If he’s not in the room… he hears nothing.

As a follow-up question, occasionally the PC will be in a nested room; I would like him to be able to hear footsteps going past:
(outside the box) Joe is here. Joe walks east, to the kitchen.
(inside the box) You hear someone nearby. Heavy footsteps trail away.

That part is less important, however, and can be scrapped if there’s not an easy way to do it…

I think the information you want is on p. 78 of “Learning T3.” What you’ll need to do is create your own Material, and then use it in the SenseConnector that connects the two rooms. What you need to do is modify the hearThru property of your new Material so that it tests whether the sound is loud and then returns opaque or transparent depending on the result of that test.

The material, I have. However, I’m not sure how to tell the game if a sound is loud or quiet. Well, I guess I can tell it the sound is quiet:

if(actorname.isQuiet) { "Actorname quietly putters about. " //this message only shows if the PC is in the same room } else { //what goes here? "Actorname yells, <q>Hey! Cut that out!</q> //this message should show when the PC is in the adjacent room }
If the actor is speaking, how do I tell the parser to transmit that noise through the senseconnector? A quoted string will show up as normal as long as the PC is in the same room as the NPC; is there a way to show a message when the actor shouts ‘through’ a sound-only sense connector?

Your custom material needs a way to check the value. Something like this (untested):

cardboard: Material seeThru = opaque hearThru = (david.isShouting ? transparent : opaque) smellThru = opaque touchThru = opaque ;

If the SenseConnector has this material, then any sound will be transmitted when david.isShouting is true, so you need to be sure to reset this variable to nil on the following turn.

That makes sense; however, how do I make something a sound? Most interaction with the PC is shown through straight quoted strings; how do I tell the parser that a string is a sound, as opposed to, say, a description of an event, or a smell, or whatever?

Ah, I see the problem now. What you want is a Noise object. That makes sounds. So the actor’s AgendaItem would (untested, and may need to be fiddled with) need to move a Noise object into the room for one turn.

Alternatively, you could look at page 244 of “Learning T3,” which mentions the obscure but important function callWithSenseContext. This function, if passed nil as its first two arguments, will print something the player can see, entirely irrespective of the sense context. At this point, you don’t even need a SenseConnector. The AgendaItem itself can decide if yelling is happening and if the PC and NPC are in the right locations, and then:

callWithSenseContext(nil, nil, {: "Bob shouts something obscene. From the sound, he's quite nearby. " });