# Invisible items

I have run into this problem several times over the course of my two games

Sometimes I want to move something into view only after the player has done a certain examination. To give a really a straightforward example, Iâ€™m making a simple easter egg hunt game. The last thing I want happening is for the player to be able to walk into an area and say â€śtake eggâ€ť and get an egg from a non-obvious open container in the location that he has no knowledge of yet, just because he was gutsy enough to type the command.

So I have solved this problem by putting items into limbo and then moving them in after examination. This poses the problem of making sure they donâ€™t pop back in to the container after each examination.

[code]A thing can be found or unfound.

The blue egg is unfound.
Every turn:
If the player is carrying something (called the find), now the find is found.

A crook is a part of the dogwood tree. The crook is a container.

Instead of examining the crook when the blue egg is unfound:
say â€śYou stand on your tiptoes and look into the crook where the branches meet. A blue egg is nestled there.â€ť;
now the blue egg is in the crook.[/code]

This seems a little inelegant somehow. The â€śEvery Turnâ€ť thing works because it marks a found thing found (over and over, but oh well) and nothing in the code marks it back to unfound after itâ€™s found.

This isnâ€™t working:

``After looking in the crook: try examining the crook instead.``

Nor is this:

```After looking in the crook when the blue egg is unfound: say "You stand on your tiptoes and look into the crook where the branches meet. A blue egg is nestled there."; now the blue egg is in the crook. ```

Both just tell me that the crook is empty even though the egg is unfound.

Soâ€¦ 1) Can/should I get â€ślooking inâ€ť working the way that â€śexaminingâ€ť works, or 2) Is there a better way to mark something â€śinvisibleâ€ť?

Thanks!

I assume that by â€ślooking inâ€ť you mean the command LOOK IN and not the command LOOK while being inside the crook yourself? Because the code you posted means the latter. The â€ślooking insideâ€ť action maps to â€śsearchingâ€ť. You can confirm this if you run the game, command ACTIONS and then LOOK IN CROOK, or if you look up â€ślook inâ€ť in the actions tab of the index page.

I havenâ€™t tested this, but unless Iâ€™m not seeing something obvious it seems to me that you could get rid of the every turn rule by just changing the flag right when the item is found.

```Instead of examining the crook when the blue egg is unfound: say "You stand on your tiptoes and look into the crook where the branches meet. A blue egg is nestled there."; now the blue egg is in the crook; now the blue egg is found.```
Or just use a â€śfor the first timeâ€ť rule and get rid of the flag altogether:

[code]Instead of examining the crook for the first time:
say â€śYou stand on your tiptoes and look into the crook where the branches meet. A blue egg is nestled there.â€ť;
now the blue egg is in the crook.

Instead of searching the crook:
try examining the crook.[/code]

Oh, ok. The â€śSearchingâ€ť is what Iâ€™m looking for. Thanks for that!

[code]I havenâ€™t tested this, but unless Iâ€™m not seeing something obvious it seems to me that you could get rid of the every turn rule by just changing the flag right when the item is found.

```Instead of examining the crook when the blue egg is unfound: say "You stand on your tiptoes and look into the crook where the branches meet. A blue egg is nestled there."; now the blue egg is in the crook; now the blue egg is found.```[/code]

I had it this way at first, and I could swear it gave me some kind of trouble, but now Iâ€™m not sure. The only problem I see now is if the player looks in the crook, sees the egg, and doesnâ€™t take it, then when he comes back and looks again it doesnâ€™t tell him itâ€™s there again. I guess thatâ€™s ok actually â€“ I guess itâ€™s still there, and I could write an â€śifâ€ť into the description that is called when the egg is found.

The â€śfirst timeâ€ť code looks even better. Iâ€™ll give that a try.

Thanks!

[code]Instead of examining the crook for the first time:
say â€śYou stand on your tiptoes and look into the crook where the branches meet. A blue egg is nestled there.â€ť;
now the blue egg is in the crook.

Instead of searching the crook:
try examining the crook.[/code]

Seems to be about those two rules, as I donâ€™t get the runtime error when I take one of them out, and Iâ€™m pretty sure Iâ€™ve eliminated all other related material.

EDIT: Actually I get the runtime error when I eliminate â€śInstead of examining the crook for the first timeâ€ť but not when I eliminate â€śInstead of searching the crookâ€ť.

I made a â€śtesterâ€ť program so that I could pare down to only the parts of this problem that matter.

[code]The North Lawn is a room.

The blue egg is a thing.

The dogwood tree is a thing in the North Lawn. The dogwood tree is fixed in place. Understand â€śdogwoodâ€ť and â€śtreeâ€ť as the dogwood tree.

A crook is a part of the dogwood tree. The crook is a container. The branches are a part of the dogwood tree. A flower is part of the dogwood tree. Understand â€śflowersâ€ť as the flower.

Instead of examining the crook for the first time:
say â€śYou stand on your tiptoes and look into the crook where the branches meet. A blue egg is nestled there.â€ť;
now the blue egg is in the crook.

Instead of searching the crook:
try examining the crook.[/code]

Thatâ€™s the whole code, and I still get the runtime error.

I should learn a little patience.

Swapping the two seemed to solve the problem:

[code]Instead of searching the crook for the first time:
say â€śYou stand on your tiptoes and look into the crook where the branches meet. A blue egg is nestled there.â€ť;
now the blue egg is in the crook.

Instead of examining the crook:
try searching the crook.[/code]

Donâ€™t know why, though.

```Instead of searching the crook: try examining the crook. ```The â€śexamine undescribed containers ruleâ€ť in the carry out examining rules redirects examining containers without descriptions to the searching action. Therefore, your â€śinsteadâ€ť rule is putting the game into a loop. Change the code to this and both searching and examining are covered:```Instead of searching the crook for the first time: say "You stand on your tiptoes and look into the crook where the branches meet. A blue egg is nestled there."; now the blue egg is in the crook.```â€¦ of course if you actually give a description to the crook, then youâ€™ll need to go back to your original code.

EDIT: Just to be clear, if you use the above code, you donâ€™t need this at all (it happens automatically):```Instead of examining the crook: try searching the crook.```

Neat. Thatâ€™s exactly the kind of thing Iâ€™d learn here and not in the documentation.

For a minute Mike, you had me worried about giving that crook a description and what to do next. But you know what, that damn crook doesnâ€™t need a description.

Iâ€™ve moved this from the IFComp 2009 discussion to the Inform discussion.

I really hadnâ€™t meant the IFComp 2009 forum to even be visible until October. Just havenâ€™t figured out how to hide it yet.

Ooops, Merk, Iâ€™m sorry.

I only meant to post my â€śWhenâ€™s the compâ€ť post over there. I must have posted another topic without paying attention to where I was.