How to listen, smell, touch the room (rather than a thing)?

Something about how rooms work in Inform is that they are not, by default, placed in scope during play. In other words, the player cannot interact with them. The game never recognises their typed names, so the player can’t point actions at them. If you type EXAMINE PLAZA in your game, it’s going to say “I can’t see any such thing.”

Now, you’re dealing with various sense actions, which are programmed in different ways in the Standard Rules.

LISTEN requires a noun after it, and if it doesn’t get one, behind the scenes it takes the room the player’s in as its noun. I know I just said the room’s not in scope, but that’s for actions entered by the player. Code can get at it.

You can verify this by typing ACTIONS (a test command showing you what actions are running each turn), then LISTEN. You’ll see it says “(listening to plaza)”.

SMELL works the same as LISTEN, grabbing the location for a noun if it can’t get one.

Touching and tasting are too hands on for that. The default programming assumes people want to touch something specific, so these commands require a noun, and will just grab at whatever thing in the location is handy if they aren’t given one. Whatever’s handy will never include the room itself, because by default it is out of scope. In your game, I assume the letter is all that’s handy.

So your listening and smelling are working how you’d want for your purposes. Touching and tasting aren’t.

You’re right to consider whether ‘Instead of’ is the best way to do things. Newcomers to the language tend to overuse it, which can cause trouble later, but here it’s appropriate for the smelling and listening. It suppresses the default output of ‘You smell nothing unexpected’ that you need to suppress.

If you want TOUCH to default to targeting the room when nothing is supplied, in general in your game, you’ve got a bit of tweaking to do. Which I need to think about for a moment.

-Wade

3 Likes