Hiding objects to random locations?

Heya.

I want to put a kind of a treasure hunt in my game. Nothing too annoying, just a simple task really. But the idea sorta gets ruined if the player knows the location of each object he must find in every playthrough after the first.

So, what I want is that there would be three identical items hidden around a house and its yard, in three random locations: they could be inside a closet, or under the said closet, or on a bed, or in a leaf pile in the yard, etc. They’d be hidden when a scene begins.

How would I go about doing this in the simplest manner?

One of the best things about Inform is that there are usually three, or four, or ten different ways of accomplishing something. If you’re just starting out, you might try looking at some of the extensions available at the Inform 7 website; I think there are already rules/extensions for hiding things under things, etc, that might save you some work if they fit your game concept.

Very broadly speaking, you might try something along these lines:

The Yard is a room.

A bush is a supporter in the yard.

The Driveway is east of the yard.

A barrel is a container in the driveway.

A thing can be an objective-spot.  A thing is usually not an objective-spot.  The bush and the barrel are objective-spots.

A prize is a kind of thing.

A prize called a piece of candy is in the driveway.
A prize called a yellow ribbon is in the drivawy.

I’m reluctant to post the most important part of this example, where you randomly distribute each prize to an objective-spot using a “When play begins” rule, because I don’t have Inform 7 with me right now to check the correct syntax. Nonetheless, perhaps this advice will help you, or others will give some better ideas.

You might check out “Hatless” in the documentation for an example of how to randomly distribute items at the beginning of play. Basically, you want to define some containers (that is, places the treasures could be) and some treasures, then go through the treasures and put each one in a random container that does not already have a treasure in it.