Pick up a torch with gloves

I have a dark room that I want the player to need a torch to get through, because there is a door that you cannot see in the dark. (I should be able to figure that out by myself.)

I also have a torch, and I’ve coded in that the torch is too hot to touch. I want to have it so that when the gloves are in the player’s inventory, you can hold the torch, and then light up the room to continue. Can someone help me with that please? Thanks!

[code]Check taking the torch:
if the player does not hold asbestos gloves: [“hold” means “carried or worn” - you may wish to specify “worn”]
say “The torch is too hot to pick up without some kind of protection for your hands.” instead.

Check taking off asbestos gloves:
if the player carries the torch:
try dropping the torch;
if the player carries the torch:
say “The torch will burn your hands if you take off the gloves.” instead;
say “(First dropping the torch.)”;

Check inserting the torch into something (called X):
say “The torch might damage [the X] if it’s inside for too long.” instead.[/code]

It works! I had to fix all of your indentions but otherwise it was great! Thanks.

Glad it worked! If you only want the player to be holding the gloves, you may also want to repeat the second paragraph with changes to prevent them from dropping the gloves while holding the torch as well. Or you could implicitly have the player wear the gloves if they are holding but not wearing them when they attempt to take the torch.

First check taking the torch:
if the player carries asbestos gloves:
try silently wearing asbestos gloves;
if the player wears asbestos gloves:
say “Wow, that’s hot. Good thing you have these fireproof gloves to put on first.”;

[and of course]
some asbestos gloves are a thing. asbestos gloves are wearable. Understand “fireproof/fire-proof” and “fire proof” as asbestos gloves.[/code]

As a note, I’m checking that the player is wearing the gloves after I’ve instructed the player to try wearing the gloves. This is not completely necessary but safeguards if there is some reason elsewhere in the code where the player might be prevented from wearing the gloves…a garden gnome mischievously fills them with cement…for example.