Combine items

I want the player to beable to combine a stick with an rag to make a torch. i can’t figure this out.

1 Like

How about this?

Lab is a room. 

The rag is here.
The stick is here.

There is a torch.

Instead of putting the rag on the stick:
	say "You've made a torch!";
	now the stick is nowhere;
	now the rag is nowhere;
	now the player carries the torch.

Of course, there are a lot of ways the player might try to attach the two things, so you’d have to account for those, maybe by making them all “attaching behaviors” or something like that and then making the torch for all attaching behaviors.

4 Likes

thank you. I am not good at this but i have fun trying )

3 Likes

Me too! Currently there are several people who are good at this looking at my solution and sighing deeply.

4 Likes

Works perfect! = )

1 Like

There’s also a built in “tying it to” action that people might try: TIE RAG TO STICK so you might want to also account for that.

1 Like

thank you.

I do this often enough that I have an extension that takes care of the heavy lifting and all you need to do is fill in a small table.

"Test"

Include Combining by Brent Worthington.

Use no deprecated features.

Table of Items (continued)
component list	finished item
{ stick, rag }	torch

There is a torch.

The Testing Room is A Room. The player carries a stick and a rag.

Test me with "i / tie stick to rag / i / untie torch / i".

And here’s the extension needed to make this work.

Combining.i7x (6.4 KB)

The benefit of this is that commands like “tie stick and rag” will also work and untying works natively.

Hope this helps.

3 Likes

thank you

1 Like