Lit and unlit a zippo lighter

Good evening,

It’s been a while since I wrote some IF, so I am a little rusty again, however I have not worked with light and dark in my previous work.

The example (as usual) is not that clear on how to define things.

Anyway, it’s the beginning of the game, and I gave the player a zippo lighter.

Here is the definition:

A zippo is a thing. A zippo is an unlit thing. The description of a zippo is “Your faithfully zippo lighter given by your best friend. As he usually say, a man who knows where his zippo is, is a person who should be reckoned with.”

When the player goes inside a cave, it is a dark room. So he cannot see anything.

When I try “lighting the zippo” or “light the zippo” it tells me: “This dangerous act would achieve little”

How can I define the lit unlit on the zippo?


“Now [noun] is [property]” is the general syntax you’re looking for; see WI 8.5.

To simply make “light” and “close” commands render the zippo lit and unlit, try something like this:

Instead of closing a zippo, try switching off the noun. Instead of burning a zippo, try switching on the noun. Instead of switching on an unlit zippo: say "[The noun] is now lit."; now the noun is lit. Instead of switching off a lit zippo: say "[The noun] shuts off with a click."; now the noun is unlit.

“Light” is synonymous with “burn”, and understood as the burning action; see the Actions Index. Similarly, because the specification of the switching off action includes “shut off”, this allows the player to use that command to turn off the lighter.

You can add error messages to prevent lighting a lit zippo or closing an unlit one. You can also Understand "extinguish [a zippo]" as switching off. if you want that command to work, for example. And if you’re going to have a lot of lighting and extinguishing of different objects in the game, it would be worth using a Check, Carry Out, and Report schema, rather than Instead; see WI Chapter 12.

By the way, the code “A zippo is a thing. A zippo is an unlit thing.” is redundant; you already defined the zippo as a thing in the first sentence, and things are assumed to be unlit by default. “A zippo is a thing.” is enough.

ChrisC beat me to it… but here’s what I was writing:

The I7 parser by defaults interprets “light something” as in “light fire” - that is, it thinks the player is trying to set something on fire.

A good way to find this out is just typing “actions” and then “light zippo”, and you’ll get this

There are many ways of doing this, but I think I would let the lighter be a device that becomes “lit” when it’s on. Thus:

the cave is a dark room. "A mostly harmless cave.". 

the zippo lighter is a device. The zippo can be lit. The player is carrying the zippo. 

The description of a zippo is "Your faithfully zippo lighter given by your best friend. As he usually say, a man who knows where his zippo is, is a person who should be reckoned with."

carry out switching on the zippo:
	now the zippo is lit.

report switching on the zippo:
	say "You flick the switch and the zippo lights up." instead.

carry out switching off the zippo:
	now the zippo is unlit.

instead of burning the zippo, try switching on the zippo.

There are some examples about lighting light sources in the manual, such as examples 139, 323, and 333.

Thanks for the info. I tested the code and it works.

Now a follow up question.

Can I make the zippo last only for (let say) 15 moves?

The idea behind it is that the player will have 15 moves to see the puzzle, solve it and get out of there before the zippo running out of fluid.


Yes, you want an Every Turn rule. The zippo has a number called the fluid level. The fluid level of the zippo is 15. Every turn when the zippo is lit: decrement the fluid level of the zippo. Every turn when the fluid level of the zippo is 0 and the zippo is lit: now the zippo is not lit; say "The flame flickers and goes out."for example, and you’d want to prevent the zippo from being lit when it was empty, and so on.

And on a broader design note, consider providing some way to refill the lighter outside the cave. Many players these days don’t like a game that they can easily render unwinnable.

Will try that once I get home.

On a side note, yes I believe it is frustrating when it get to the unwinnable state. I still remember running out of food on enchanter because i took too long to figure things out.

This is very early in the game, but I wanted to emphasize that the only way to pass through the cave is with the zippo, which should be rendered unusable after solving the puzzle, teleporting to another part of the cave, and reaching the exit.