Inform doesn’t have a built-in action for touching one thing with another thing, so you’ll have to define one. The stuff about how to do it starts in §12.7 of the definition. This is a start:
Touching it with is an action applying to two things.
Understand "touch [something] with [something]" as touching it with.
The first line tells Inform that there is an action, touching it with, that takes two objects. The “it” tells Inform where the first noun goes in the internal sentence description–so you can refer to the action internally as “touching something with something” or something like that. The second “Understand” line tells Inform how to understand commands the player types–so it knows that the command “TOUCH GLASS WITH NEEDLE” is to be understood as the action of touching the glass with the needle.
Now the action is defined–but it doesn’t do anything, because we haven’t written any rules for it. So we can first cover the case you want:
Carry out touching an unlit torch with a lit torch:
now the noun is lit.
“The noun” here means the first thing in the action description–that is, the particular unlit torch the player referred to.
We also want to print something in response to this action, which we can do with a report rule:
Report touching an unlit torch with a lit torch:
say "You light [the noun] with [the second noun]."
“The second noun” is the second thing in the action–in this case, the specific lit torch the player used.
We should also prevent the player from using a lit torch they don’t have to light something, which we can do with a Check rule:
Check touching it with:
if the player does not hold the second noun:
say "You're not holding [the second noun]." instead.
Check rules run before carry out and report rules (see §12.9). The “instead” tells Inform to stop processing the action and not to go to the Carry Out and Report rules.
(Actually, that is not the most player-friendly rule. The polite thing to do is to automatically have the player try to take the second noun, like this:
Check lighting it with when the player does not hold the second noun:
say "(first trying to take [the second noun])[command clarification break]";
try silently taking the second noun: ["try silently" means have the player try to take the second noun, don't say anything if it worked, if it fails it will print the message saying why it failed, for instance "That's hardly portable" if the second noun was fixed in place]
if the player does not hold the second noun: [the taking action failed]
stop the action. [like "instead," this cuts off action processing without going to Carry Out or Report rules]
But I figure you might want to work on the more straightforward way before you embark on this.)
However! There will be all sorts of other things that the player might try touching with things, and we haven’t written any rules to cover those. So if they type “TOUCH ME WITH TORCH” they’ll just get a blank line. We can cover that with a blanket Check rule that takes care of every other case:
Check touching it with when the noun is not an unlit torch or the second noun is not a lit torch:
say "There's no point in touching [the noun] with [the second noun]." instead.
although this is a bit crude–in practice you’d want some more helpful messages for more special cases.
…and also, you should probably do something to allow for commands like “light the unlit torch with the lit torch.” And take care of what happens when a player types “light the unlit torch” (as things go, this gets understood as the action of burning that torch, which by default gets the response “This dangerous act would achieve little”–which is not what you want!) But that’s something to think about after you’ve got this working.
[I moved the post to the Inform 7 development forum.]