How to hide objects from player

Hello guys! I’m very new to Inform 7 and would like to ask a question.

Is there a way to hide objects, let’s just say, under a table? I tried googling the way and I found this, but it doesnt seem to work.

A banana is hidden in the kitchen.

Instead of looking under the table for the first time:
    reveal the banana;
    say "You find a banana!"

Apparently, Inform seems to have troubles with ‘A banana’ and ‘hidden in the kitchen’.

This is what it says. Problem. The sentence ‘A is hidden in the bed’ appears to say two things are the same - I am reading ‘key’ and ‘hidden in the bed’ as two different things

Is there anything I can do about it? Feedback is appreciated and sorry if the answer is simpler than it seems! :slight_smile:

The easiest way is not to have it in that location at all until it’s revealed.

There is a banana. [This places it "off-stage" until we move it somewhere else.]
Instead of looking under the table when the banana is off-stage:
    say "There seems to be a banana under the table.";
    move the banana to the kitchen.

There is no “hidden” relation in Inform by default. You’d have to define it. Possibly you found some sample code for an extension that has to be included?

You want Krister Fundin’s extension “Hidden Items”.

Ok, thx so much for yr help! I did as you said and it works nicely :smiley:

Apparently, I have that extension in my program, but it still doesnt work. Maybe it’s outdated?

Could be, but it’s never been very useful except for edge cases like doors. Moving revealed items in place from off-stage is what’s commonly used.

Ok, I managed to get it to be used in my program. Read a bit of the documentary and really didnt know what this meant: To hide (T - a thing): now T is hidden; if T is multi-location: now T is Inform library absent; now T is undescribed; surreptitiously remove T from play; otherwise: change the original location of T to the holder of T; remove T from play. Any help? Thanks!

It’s basically removing the object from play in a fancy way so that it can be brought back to the same place later. The “multi-location” part is for things like backdrops and doors which appear in multiple rooms. You don’t need the extension for something as simple as this.

The off-stage method mentioned earlier is probably best. However, you can remove object names from the room description by calling them scenery. Example:

The banana is a thing. It is scenery. The description is “it’s a banana. A little brown and oozing something from one end, but still a banana none the less.” :slight_smile:

This will not remove it from the “get all” player command.

I would recommend not using that method. If the player knows the banana is there they can “examine banana” (giving the proper description) but not “take banana” (“That’s hardly portable.”).

@ Draconis:
Thanks for pointing that out. I guess I should look at my own code more thoroughly before I give advice.:slight_smile:
I seem to handle most of these situations manually. I agree, the offstage method is still probably best.
To handle it manually:

Instead of taking the banana:
        Say "You pick up the banana.";
	Now the player carries the banana.