Invisible items

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

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. :slight_smile:

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.