Reveal a thing when examining another thing

This is the kind of code i wrote. The idea is to enter room Balcony, see the bike but not the tyre repair kit untill we examine the bike itself.

[code]The Balcony is a room. “From an alarmed door you can access a small balcony where some dead plants and an air vent live in harmony. There is enough space here to keep a few bikes…”

The bicycle is in the Balcony. “A bicycle is parked here, on the side, out of the way, in a discreet kind of fashion.”

[The tyre repair kit is on the bicycle.]
The description of the tyre repair kit is “A useful little pouch with everything one needs to repair a tyre, maybe even two!”.
After examining the bicycle: Now the tyre repair kit is on the bicycle; say “You see a tyre repair kit!”
[/code]

This does not work for me. When I examine the bike i get the message “You see a tyre repair kit!” but i can not take it and it doesnt appear on the list of items I can see in the room…
If you remove the [commented out] code you’ll see how it should appear.

Any ideas? I kinda thought that would be straight forward…

Just a quick thought: is the bicycle a supporter? If not, putting things “on” it probably won’t have the effect you want.

That and the fact the kit is not declared. “the bike kit is a thing”.

Sorry for the fast writing but i’m on the phone atm.

If the player is going to ride around on the bike, you should probably include the built-in extension Rideable Vehicles by Graham Nelson, and create the bike as a rideable vehicle (those already are a kind of supporters).

I would have thought so, too. But the posted code actually compiles. (Apparently the line about the description of the kit creates a kit to go with the description.)

And, what is more, it even makes the bicycle parent/holder of the kit! But exactly what relation holds between the bike and the kit, here? Is it the ordinary support relation? So that a game can put things on non-supporters even though players can’t?

Thanks VictorGijsbers, explicit declaration of a supporter allows the Now phrase to work.

Thank you Felix, I will concider that as i do not wish to enter the bike as if its a car.
Now i slowly realise the complexity of the matter… interesting!

Still my problem has evolved.
How do i describe a situation where the player can only take the kit if he examines the bike…

[code]The bicycle is a supporter. [good call]

After examining the Bicycle:
Now the tyre repair kit is on the bicycle;
say “Attached on the bike you see a tyre repair kit!”[/code]

the problem with the above is that it works fine to reveal the repair kit but also every time i examine the bike the kit moves on the bike even if i take it and drop it… grrr!

That’s wacky. I was sure the compiler would catch that.

A little debugging:

Every turn:
	if the kit is in the bicycle, say "in.";
	if the kit is on the bicycle, say "on.";
	if the kit is part of the bicycle, say "part of.";
	if the kit is enclosed by the bicycle, say "enclosed by.";
	if the kit is supported by the bicycle, say "supported by.";

If you declare that the bicycle is a supporter, then we (correctly) get “on”, “supported by”, and “enclosed by”. (“On” is the same relation as “supported by”.)

If you declare at the top level that the kit is on the bicycle, then the compiler infers that the bicycle is a supporter, and you get the same result.

Putting the kit on the bicycle at runtime doesn’t cause the same inference. You get this situation, which is a bug as far as I can tell. “Enclosed by” is true but none of the other relations.

Problem Solved, declaring the bike as a supporter was the best advice because at the moment i want to explore the simplest declarations not to write code to overcompensate things…

But thank you all for the help guys, your answers are an insight of things to come for sure as this semantics area can get nasty!

Just to conclude with my issue, this is the end code, this only worked well if you declare the bike as a supporter AND dont initiate the tyre repair kit as “on the bike”:

[code]After examining the Bicycle for the first time:
Now the tyre repair kit is on the bicycle;
Say “Attached on the bike you see a tyre repair kit!”.

Before taking the tyre repair kit for the first time: say “… with a bit of effort you pull the [noun] …”[/code]

Although the above works a treat I now see that there must be a more generic way to trap a Take action with something attached but not troublesome to remove object.

So i would like to see this:

Before taking something Attached for the first time: say "... with a bit of effort you pull the [noun] ..."

I’ll continue on this post till my repair kit is gracefully detached from the bike! :smiley:

On the other hand, having declared the bicycle to be a supporter, and then during play telling Inform that the kit is now in, worn by, carried by, or held by the bicycle all means that the kit will end up on the bicycle.