Searching a room

I want to have a concealed object that appears when a room is searched. It seems easy enough to move an item to the room, but I am getting hung up on the actual search command.

I’ve tried several methods, but when I try typing “search” in my game it searches the objects in the room, not the room itself.

I suppose I could put some objects in the room that conceal my item, but I was wondering why this is occurring.

Help!

Here’s a naïve implementation.

[code]Room-searching is an action applying to nothing.
Understand “search” as room-searching when the location is searchable.

A room can be searchable. A room is usually not searchable.

Instead of room-searching when the location is the garden:
now the player carries the wedding ring;
now the location is not searchable;
say “Nothing, noth…- wait! Is that a glitter in the grass?[paragraph break]You pick it up.”

There is a thing called your wedding ring.
Home is a room. The Garden is west of Home. The Garden is searchable.[/code]

The searching action as defined requires a noun. If the player doesn’t provide a noun, Inform attempts to disambiguate or (if there’s only one noun) picks that one by default.

Rooms are not normally considered in-scope; only their contents are. So “search kitchen” won’t work.

You can play with the scope rules, but it’s simpler to add a scenery object called “kitchen” to the kitchen and catch search actions there.

However, you also want to think about it from the player’s point of view. Because “search” and “search room” are not normally accepted by IF parsers, most players won’t try them. At least, experienced players won’t. If you clue this by saying “Junk is piled everywhere,” people will try “examine junk” or “search junk”.