Question: Combining items to create a new item

Hello, everyone! I’m a newcomer here, but I’m hoping someone can help me out. I want to create a command to allow the player to combine two items to create a new item. I got the following combine command to work:

Understand “combine [something] with [something]” as combining it with.
Combining it with is an action applying to two things.

After combining the two things, I want it to turn them into a new item that the player can take. For (a really stupid) example:

In the cell is an altar. There is a gold peach and a silver peach on the altar.

After combining the gold peach with the silver peach:
say “You have created some sort of magical item.”;
*[here the game should make a new item].

The last line marked by * is where I’m having the problem. How can I pull this off? I would really appreciate any and all help.

The usual way to do this is with a little sleight of hand. Write your definition of the third item, but don’t move it to the location or the player’s posession until the two items are combined. At the same time, remove the two components from play. For example,

The Cell is a room. 

The magic peach is a thing.

Combining it with is an action applying to two things.
Understand "combine [something] with [something]" as combining it with.

In the Cell is an altar. There is a gold peach and a silver peach on the altar.

After combining the gold peach with the silver peach:
	say "You have created some sort of magical item.";
	remove the noun from play;
	remove the second noun from play;
	now the magic peach is on the altar.

test me with "combine gold with silver / look"

There also is an extension to create items dynamically – inform7.com/extensions/Jesse%20M … index.html – though I believe the game needs to be glulx to include that.

Aha, thank you so so so much!! This had been driving me crazy! Now I understand. :smiley:

I assume this same trick could also be used to move a NPC to the player’s location??

You can just move the NPC directly:

After touching the magic peach: move Bob to the location.