I6: Receive: for Rooms

Hi all,

I’d like to catch when an object is put in a room. For a container I’d do that with Receive:. Now I don’t have a container as the target object, but a room. What I’m gonna do now is an each_turn routine that checks for the presence of the object in question. But isn’t there something like a Receive: for rooms?

How about react_after for the room? That may just be an after routine … not sure.

There is no single point to catch this, unfortunately.

Do you want to trigger when the player walks in carrying the object, or when the player drops the object?

In the former case, watch Go actions. In the latter, you’ll need to watch Drop, plus Receive for any containers and supporters in the room.

Watching Drop works fine for my purposes, but in order to learn something I wanted to know how to catch e.g. a container in the room being destroyed (with the object inside, then moved into the room), an NPC losing the object, the object being created by a machine etc.

If you just need to test whether the item is on the floor of the room, maybe something like this will work in the room’s code:

each_turn [; if (item in self) { … } ],

^^^^ That will work, but it is computationally expensive if you are watching multiple rooms. For just one room, though, it’s fine.

Another way to do it is to set up a daemon and check to see if anything has been dropped in any particular room. You could have characteristics of each object that would indicate if they were dropped or non-dropped. This would allow you to check multiple objects over multiple rooms. That’s more work, but it’s not as computationally expensive (one daemon vs. multiple each_turns).

Many ways to skin a cat and all that, you know.