The rat and the rice

After working through the Disappointment Bay 12 example I wanted to practice handling things more (the example showed that you can’t pick up ice without first holding a net).

In my example I wanted to expand on the requirements for certain things, and for different things to happen depending on what is held and where.

Scenario.
You’re in a pantry. There is a sack currently containing a rat. The sack also has a hole in it. There is a ‘plug’ and there is rice.

The rice cannot be held in your hand.
The rice cannot be scooped into the sack whilst the rat is in the there.
The rice cannot be scooped into the sack when the sack is empty (due to the hole in the sack).
The rice can be scooped into the sack when the plug is in the sack.
When the rice is in the sack, you should not be allowed to take the plug (otherwise the rice would fall out of the bag).
When the sack contains the rice and the plug you should not be able to take the rice (resulting in another scooping action).

I have a semi-working example, in that I can seem to get it so that you are required to remove the rat from the sack, and place the plug into the sack before you can scoop up the rice. Also, it appears the scoop is still tried (unsuccessfully) when the rat is in the sack.

However, you are then able to ‘take plug’ which leaves the rice in the sack and the plug in hand.
Also, ‘take rice’ results in you scooping, even though it’s already in the sack.

Any clues as to the fine tuning I can use to fix the last parts…again, sorry if this is covered later on in the book. I like making examples as I go through it and trying to figure out how to use things.

Is there a specific order the commands (below) should be written in?

[code]The Pantry is a room. Description is “a food pantry, but without any food.”

The sack is a container in the pantry. Description is “sturdy.” The sack contains a rat. The sack has a carrying capacity 2. The sack is not wearable.

A plug is in the pantry. The description is “small and plug like”

A quantity of rice is in the pantry. The rice is not edible. The player cannot carry the rice. The description is “It’s rice…what more do you want from me?” The printed name of the quantity is “some rice”.

Instead of taking the quantity of rice when the player is not carrying the sack and the plug is not in the sack: if the quantity of rice is handled, continue the action; say “You are having a hard time picking up the rice with your bare hands.”

Instead of taking the quantity of rice when the player is not carrying the sack and the plug is in the sack: if the quantity of rice is handled, continue the action; say “You are having a hard time picking up the rice with your bare hands.”

Instead of taking the quantity of rice when the player is carrying the sack containing the rat:
say “You attempt to use the sack to take the rice, but you can’t whilst a rat is inside.”

Instead of taking the quantity of rice when the player is carrying the sack and the plug is not in the sack:
say “you scoop up the rice in the sack but it immediately falls out of a hole in the bottom and back onto the ground.”

After taking the quantity of rice when the player is carrying the sack containing the plug:
move the rice to the sack;
say “You scoop up the rice in the sack, the plug firmly plugging a hole in the bottom.”

Instead of taking the plug when the player is carrying the sack containing the plug and the rice:
say “you can’t take the plug out of the sack whilst the rice is in there.”

Instead of taking the quantity of rice when the player is carrying the sack containing the rice and the plug:
say “You already have the rice in the sack.”[/code]

Cheers

Mxx

I find that if you put

it prevents you taking the plug out of the sack when the rice is in there.

And

stops it.

Hope this helps.

That does indeed help, and works wonderfully. I also replaced a bit about when the rat was in the sack, as taking the rice whilst the rat was in there still tried to scoop it up instead of saying ‘the rat’s in there’.

Thanks very much, pleased that this one is working okay now :smiley:

Mxx

Glad I could help.