Hiding an object in a bowl of soup

Hi all,

I’m just getting started, and I’ve run into a real stumper for me. Essentially, what I want to do I think is pretty simple, but I’ve been searching for how to use things like concealment, hiding, found/unfound, etc. and none of them seem to be what I’m looking for.

Essentially, I have a puzzle which involves finding a ring. The ring is hidden in a bowl, so I want to make it so that the player has to eat the bowl of clam chowder in order to discover there’s a ring there. But right now, the presence of the ring is revealed (it says there’s a bowl containing soup and a ring).

So, I’m wondering, what’s the best way to do this? I tried to come up with a sort of kludge, where the game wouldn’t let you just dig into the soup for the ring without eating it first (which requires the player finding a spoon through another puzzle).

I’ve been trying to go through lots of examples but can’t seem to find anything quite relevant to this. A bowl of soup with an object hidden in an opaque liquid that would only be revealed once the soup is eaten (or I could perhaps let the player pour the bowl of soup out, but that would be messy).

I have a similar puzzle with a plate of salad (another object is hidden underneath some salad, which the player has to eat after finding a fork), so I figure I’d be able to solve this the same way.

Thanks!

-Zadillo

Usually the best way to implement hidden objects is to use the “deciding the concealed possessions of somethinig” activity (Chapter 17.9).

[code]The bowl is an open, unopenable container.

Some soup is in the bowl. A ring is in the bowl.

Rule for deciding the concealed possessions of the bowl:
if the partucular possession is the ring and the soup is in the bowl, yes;
otherwise no.[/code]

The ring remains invisible and unreferable-to as long as the soup is in the bowl. You set up the parameters for how to get the soup out of the bowl however you like:

[code]Instead of taking the soup: say “You can’t scoop the soup out with your bare hands.”

Instead of eating the soup:
if the spoon is not carried by the player:
say “You need a spoon.”;
otherwise:
say “You slurp up the soup, and discover a ring at the bottom of the bowl!”
remove soup from play.[/code]

This is great, thank you! I will try it out!

-Zadillo

OK, I think I’ve got almost everything working (although I had to take out “Instead of taking the soup: say “You can’t scoop the soup out with your bare hands.”” - it seemed to always kick in even if I did have the spoon in my possession. And it seemed like even if I said “eat the soup” instead of “take the soup”, it kicked in with that message… i think because when I tried to eat the soup it said “first taking the soup”).

The only major problem I’m still having is that the description of the item is still showing the presence of the ring. It tells me I can’t see it if I try to take it, but it’s still here:

Any advice on this? I’d like to have it not mention that the ring is there until the player has eaten the soup. If it’s only a choice of describing all contents or no contents I’d probably be OK with just not describing the contents at all, but I’d definitely love to figure this last bit out.

The puzzle itself is working - once the player eats the soup, the ring is takeable. I just want to make it so that the presence of the ring isn’t given away.

For reference, here’s the code I’m using right now:

[code] A bowl is here. The bowl is an open, unopenable container. Some soup is in the bowl. A ring is in the bowl. The description of the bowl is “The bowl of soup is full of some unidentifiable, thick soup. Perhaps you should eat it.”

Rule for deciding the concealed possessions of the bowl:
if the particular possession is a ring and the soup is in the bowl, yes;
otherwise no.

Instead of eating the soup:
if a spoon is not held by the player:
say “You don’t have the ideal tool for the job.”;
otherwise:
say “You eat the delicious soup, and discover a ring at the bottom of the bowl!”;
remove the soup from play.
[/code]

Thanks!

Since you don’t want the player to see the ring nor interact with it before the soup is eaten, it might be easier if the ring wasn’t there at all beforehand (as far as the internal workings of the game go).

[code] A bowl is here. The bowl is an open, unopenable container. Some soup is in the bowl. The description of the bowl is “The bowl of soup is full of some unidentifiable, thick soup. Perhaps you should eat it.”

The ring is a thing. [i.e. the ring is off-stage at first]

Instead of eating the soup:
if a spoon is not held by the player:
say “You don’t have the ideal tool for the job.”;
otherwise:
say “You eat the delicious soup, and discover a ring at the bottom of the bowl!”;
remove the soup from play;
now the ring is in the bowl.
[/code]

Yeah, you have nothing there restricting the rule. This should work:

Instead of taking the soup when the player is not carrying the spoon: say "You can't scoop the soup out with your bare hands."

You can get rid of that with

Procedural rule while eating: ignore the carrying requirements rule.

Thanks, that did the trick!

One last tiny question. I’m noticing now that it says:

“You can see a bowl (in which are some soup)”

I’ve described the soup as “Some soup is in the bowl.” I guess it is saying are, but is there a better way to make it say “in which is some soup”? If I change it to just “The soup is in the bowl”, I get “You can see a bowl in which is a soup” which isn’t right either

Thanks!

-Zadillo

Try:

The soup is in the bowl.  The indefinite article of the soup is "some".

As in Chapter 3.18 of Writing with Inform.

Thank you very much, that did the trick!

Btw, I’m running into one other little problem. I’m using the transmutation machine (from the recipe book).

I won’t include everything here, but here’s the basics of what I’m using:

Transmutation relates things to each other in groups. The verb to become (it becomes, they become, it became) implies the transmutation relation.

Definition: a thing is transmutable if it becomes more than one thing. [* It always becomes itself.]

A thing can be pennylike. The penny is a pennylike thing. It becomes a copper fork.

A thing can be copperlike. The copper fork is a copperlike thing.

The machine is fixed in place in the workshop. Procedural rule when inserting something into the machine: ignore the can't insert into what's not a container rule.

Check inserting something which is not transmutable into the machine:
	instead say "You can't transmute that."

To decide which thing is new form of (obj - pennylike thing): decide on a random copperlike thing which becomes obj.

Carry out inserting something into the machine:
	remove the noun from play;
	now the player carries the new form of the noun.

Report inserting something pennylike into the machine:
	say "The machine clicks, whirrs, and with a roar, spits out [a new form of the noun].";
	rule succeeds.

Above I’m just including the object that is a problem. Essentially, you stick the penny in the machine, and it spits out the copper fork (which you’re awarded points for after placing it in a trophy case).

What I noticed while testing it though is that if you insert the copper fork into the machine, it would cause an error. I tried adding some different rules (i.e. I added something like:

To decide which thing is new form of (obj - copperlike thing): decide on a random copperlike thing which becomes obj.

Report inserting something copperlike into the machine:
	say "The machine clicks, whirrs, and with a roar, spits out [a new form of the noun].";
	rule succeeds.

The main common thread I found with whatever I tried is that the rule would succeed, but the copper fork would no longer be in inventory. So it would be like it removes the noun from play, but the player doesn’t carry the “new form” of the noun.

Initially I wanted it to simply not be transmutable at all (so the copper fork would just be rejected), but it looks like as I left it, it did let you transmute it anyway.

For the time being, I’m preventing the player from doing it by adding:

Check inserting a copper spork into the machine:
	instead say "You don't want to do that."

But I figure this is a bad solution, and there should be some way to ensure that the final outputted object is simply not regarded as transmutable so it will be rejected by the initial “Check inserting something which is not transmutable into the machine:” rule.

Thanks!

If you are only using the machine to turn the penny into a fork, it might be easier to just create an event for if the player inserts a penny into the machine, instead of any transmutable object. If you only have a few objects that do this, you might still be able to create individual events for each, but this would be hard to do with a large number of objects. I don’t have my copy of Inform open (and have not worked with it for a while), but the following code might work - add more “else if the noun is…” blocks for each object.

Instead of inserting something into the machine: if the noun is the penny: remove the penny from play; now the player carries the copper fork; say "The machine clicks, whirrs, and with a roar, spits out a copper fork."; else: say "You can't transmute that."

Thanks, that makes sense. I think the main thing at this point is more just curiosity for me, about what I might be doing wrong above that I’m apparently not properly defining what is and isn’t a transmutable object (so the broad example in the sample code doesn’t work).