Conditional inserting X into Y Issue

Firstly, thank you in advance for reading this. I tried, and searched, for a long time but came up short.

The wheelbarrow is a container and the barrel goes into it. I can do it as two separate actions but I want it to happen automatically.

It’s important that the game check the wheelbarrow is in the front garden.

After taking the old barrel if the rusty wheelbarrow is in the front garden:
	say "You lift the barrel and put it in the wheelbarrow.";
			now the old barrel is inserted into the rusty wheelbarrow.

You probably want something like:

After taking the old barrel when the rusty wheelbarrow is in the front garden:
	say "You lift the barrel and put it in the wheelbarrow.";
	now the old barrel is in the rusty wheelbarrow.

Instead of writing “now the old barrel is in the rusty wheelbarrow” you could have triggered the actual insert action with “silently try inserting the old barrel into the wheelbarrow,” but then if the interpreter finds that the old barrel object cannot in fact be inserted into the wheelbarrow, perhaps because the wheelbarrow is not a container, then the barrel will not end up there, contrary to the message printed, but will still be carried by the player.

Also note that you will need another rule to catch the player trying to take the old barrel when it is already in the wheelbarrow, something like:

Instead of taking the old barrel when the old barrel is in the wheelbarrow:
	say "The old barrel already is where it belongs."

Thank you for taking the time to reply.

That configuration has been successful for triggering the say portion of the command but not the transfer of the old barrel to the wheelbarrow and I can’t figure out why. It must be something obvious but I’ve been over and over the manual and I must be missing a fundamental.

>take barrel
You lift the barrel and put it in the wheelbarrow.

>examine wheelbarrow
The rusty wheelbarrow is empty.

>i
You are carrying nothing.

>examine barrel
This is an old and water-logged barrel barely held together with rusted bands. It looks heavy and none too sturdy.

This is my code:

The Front Garden is a room.

The old barrel is in the front garden.

The rusty wheelbarrow is a container in the front garden.

After taking the old barrel when the rusty wheelbarrow is in the front garden:
	say "You lift the barrel and put it in the wheelbarrow.";
	now the old barrel is in the rusty wheelbarrow.

Instead of taking the old barrel when the old barrel is in the wheelbarrow:
	say "The barrel already is where it belongs."

Transcript:

Front Garden
You can see an old barrel and a rusty wheelbarrow (empty) here.

>take barrel
You lift the barrel and put it in the wheelbarrow.

>l
Front Garden
You can see a rusty wheelbarrow (in which is an old barrel) here.

>examine wheelbarrow
In the rusty wheelbarrow is an old barrel.
1 Like

Thanks for testing that out.

I’ve tried that but I must have something going on elsewhere that’s causing a problem.

1 Like