Replacing specific thing

Hi, I’m very new to coding and was wondering if there’s a way to do this. I want to make it so when the player places a specific item into a container, and activates the container, it becomes a different specific item. So far I’ve tried using an “if” statement. Something along the lines of ( instead of using containerName: if itemA is in containerName: now itemA is nowhere; now itemB is in containerName; otherwise...
That didn’t work any way I phrased it. I’ve also tried defining the container as being something specific when the specific item is stores, but couldn’t figure a way to do that. Anyone have an idea of how to pull this off? This seems like the sort of thing a million people have done before, there’s got to be a way to code it. Again, I’m new at this, so I wouldn’t be surprised if it’s something blatantly obvious.

The code you’ve posted looks like it should work, if containerName is the actual name of the container in question, as long as the name of the action is “using.” And as long as you are using tabs for your indentation, I guess.

So you want to check all those things–make sure all the names are really the names of things in your source code, make sure the name of your action is “using,” and make sure the indentation is proper.

Here’s a working example:

[code]Lab is a room.

The kiln is a container in Lab. The kiln is fixed in place.

Using is an action applying to one thing. Understand “use [something]” as using.

The player carries a lump of clay.

There is a pot.

Instead of using the kiln:
if the lump of clay is in the kiln:
now the lump of clay is nowhere;
now the pot is in the kiln;
say “You fire the clay into a pot.”;
otherwise:
say “The lump of clay isn’t in the kiln, so there’s no point in using it.”[/code]

(Also, I forgot to write a rule for using things that aren’t the kiln. That’s bad! I should write a rule “instead of using something:” to make sure that the game prints something in response to “USE CLAY” and the like.)

It’s still not working for me. First problem says

Says the same for the reappearing pot.
I probably should have mentioned that I’m trying to make a game with multiple of each item, so it’d be like every time you find a clay, you can go back and use the kiln. I think that the fact that I already have multiples of the first item is messing with the outcome.

In that case you could do it like this. (This is matt w’s example modified to allow for multiple lumps of clay and multiple pots.)

[code]Lab is a room.

The kiln is a container in Lab. The kiln is fixed in place.

Using is an action applying to one thing. Understand “use [something]” as using.

A lump of clay is a kind of thing.

The player carries a lump of clay.

A pot is a kind of thing.

There is a pot.

Instead of using the kiln:
if a lump of clay (called the current lump) is in the kiln:
now the current lump is nowhere;
let current pot be a random offstage pot;
now the current pot is in the kiln;
say “You fire the clay into a pot.”;
otherwise:
say “The lump of clay isn’t in the kiln, so there’s no point in using it.”[/code]

But you’ll want to make sure there are always enough offstage pots.

Yes, if “lump of clay” is a kind of thing, then it’s never useful to say “the lump of clay”; you always have to designate a specific lump of clay, often by using temporary variables as bg did.

Works perfectly now, thank you.