Trying to light a torch

I have just started using inform 7 and I am trying to light a torch so i can see in the cave entrance. I have a bag that contains a torch and flint, but I do not know how to light the torch, the torch and flint have been taken. the code I wrote is below.

A path is a room.
East of the Entrance is a path.

Entrance is a dark room. “You peer through the open doorway into a broad, pillared hall. The columns of stone are carved as tree trunks and seem placed at random like trees in a forest. Stone root systems crawl out into the floor and marble branches expand across the ceiling. You even note a few carvings of small birds and squirrels. Beautiful as they are, the sculpting doesn’t appear elven, and it’s nothing dwarves would carve.”

The torch is unlit.

A backpack is in the path.
The backpack is closed container.
The backpack is openable.
The backpack contains a torch, and a flint.

The torch is lit in the entrance.

Any help with this matter would be greatly appreciated

Bob

You’re doing well. Here is an example of what you can do. Let me know if any of it doesn’t make sense.

The verb LIGHT [something] is pre-defined in Inform as a synonym for the action BURN [something], which is blocked with a rule so the player doesn’t try to burn everything in the game. The way to tell this is to type ACTIONS in the IDE and Inform will tell you exactly what action it’s taking.

[rant][code]“Torchlight”

Entrance is a dark room. “You peer through the open doorway into a broad, pillared hall. The columns of stone are carved as tree trunks and seem placed at random like trees in a forest. Stone root systems crawl out into the floor and marble branches expand across the ceiling. You even note a few carvings of small birds and squirrels. Beautiful as they are, the sculpting doesn’t appear elven, and it’s nothing dwarves would carve.”

A Path is east of Entrance. “The path leads west to a dark place.”

A backpack is an openable, closed, wearable container in Path.
The backpack contains a torch, and a flint.

a torch is in backpack. The description is “You could probably light this if you’re holding a flint.” Torch can be lit.

The block burning rule does nothing when the noun is the torch.

Check burning the torch:
if the torch is lit:
say “You’ve already done that. The torch is burning brightly.” instead.

Check burning the torch:
if the player does not carry the torch:
say “You need to hold it carefully if want to burn it.” instead.

Check burning the torch:
if the player does not carry the flint:
say “You’re pretty good at creating fire, but you need to be holding a flint to create sparks.” instead.

Carry out burning the torch:
now the torch is lit.

After burning the torch, say “Ah, that should provide plenty of light.”

The player is in Path.
[/code]

[/rant]

Similarly, you then probably want to go through and provide messages or prevent the player from putting the lit torch in the backpack, and possibly making the torch go out if dropped.

Carry out dropping the torch: if the torch is lit: now the torch is not lit; say "The torch sputters out on the damp ground.";