I Need Help!

Could someone tell me what would make this work? I get a tone of error messages that make no sense to me. Here is my code:[code]The Den is a room. The Den is dark.

Instead of looking for the second time:
say “The Den is rustic, and you must be quick and find the batteries, as your flashlight is low on power.”.

The player carries a flashlight. The flashlight is lit. The flashlight has a number called power-remaining. The power-remaining of the flashlight is 3.
Every turn:
if the power-remaining of the flashlight is greater than 0;
decrease the power-remaining of the flashlight by 1;
if the power-remaining of the lamp is 0;
say “The flashlight flashes off.”;
now the power-remaining of the lamp is -1;
now the flashlight is not lit.
The Battery Pack are here. The Battery Pack can be full or empty. The Battery Pack is full.
Refilling is an action applying to one thing. Understand “fill [something]” and “refill [something]” as refilling.
Check refilling:
say “[The noun] can’t be refilled.” instead.

Instead of refilling the flashlight:
if the Battery Pack is enclosed by the location;
if the Battery Pack is full;
now the Battery Pack is empty;
increase the power-remaining of the lamp by 100;
say “You put the batteries into the flashlight[run paragraph on]”;
if the flashlight is not lit;
now the flashlight is lit;
say “, and it turns back to life, lighting up its surroundings[run paragraph on]”;
say “.”;
otherwise;
say “The Battery Pack appears to be empty.”;
otherwise;
say “You have nothing to fill the Flashlight with.”.
[/code]
Thanks!

The Den is a room. The Den is dark.

Instead of looking for the second time:
say “The Den is rustic, and you must be quick and find the batteries, as your flashlight is low on power.”.

The player carries a flashlight. The flashlight is lit. The flashlight has a number called power-remaining. The power-remaining of the Flashlight is 3.
Every turn:
if the power-remaining of the flashlight is greater than 0;
decrease the power-remaining of the flashlight by 1;
if the power-remaining of the lamp is 0;
say “The flashlight flashes off.”;
now the power-remaining of the lamp is -1;
now the flashlight is not lit.
The Battery Pack are here. The Battery Pack can be full or empty. The Battery Pack is full.
Refilling is an action applying to one thing. Understand “fill [something]” and “refill [something]” as refilling.
Check refilling:
say “[The noun] can’t be refilled.” instead.

Instead of refilling the flashlight:
if the Battery Pack is enclosed by the location;
if the Battery Pack is full;
now the Battery Pack is empty;
increase the power-remaining of the lamp by 100;
say “You put the batteries into the flashlight[run paragraph on]”;
if the flashlight is not lit;
now the flashlight is lit;
say “, and it turns back to life, lighting up its surroundings[run paragraph on]”;
say “.”;
otherwise;
say “The Battery Pack appears to be empty.”;
otherwise;
say “You have nothing to fill the Flashlight with.”.

What are the error messages?

It looks like your punctuation and spacing is off.

When you have an “if” condition on a line by itself, the line should end with a colon (:), not a semicolon (;), and the lines that come after (whichever lines you want to run when the “if” line applies) should be indented an additional step.

So for instance, instead of

if the Battery Pack is enclosed by the location; if the Battery Pack is full; now the Battery Pack is empty;

you want something like this:

if the Battery Pack is enclosed by the location: if the Battery Pack is full: now the Battery Pack is empty;

In the same way, “otherwise” should be followed by a colon, not a semicolon, and any following lines that should run when the “otherwise” applies should be indented an additional step beyond the “otherwise” line.

It looks like this code is similar to the code that you posted earlier with the food recycler and wheat bag.

Check out my reply in that thread for some help on punctuation and indentation issues.

Thank you guys for the Help! Still needs some work, this is what I have now :[code]The Den is a room. The Den is dark.

Instead of looking for the second time:
say “The Den is rustic, and you must be quick and find the batteries, as your flashlight is low on power.”.

The player carries a flashlight. The flashlight is lit. The flashlight has a number called power-remaining. The power-remaining of the flashlight is 3.
Every turn:
if the power-remaining of the flashlight is greater than 0;
decrease the power-remaining of the flashlight by 1;
if the power-remaining of the flashlight is 0;
say “The flashlight flashes off.”;
now the power-remaining of the flashlight is -1;
now the flashlight is not lit.
The Battery Pack are here. The Battery Pack can be full or empty. The Battery Pack is full.
Refilling is an action applying to one thing. Understand “fill [something]” and “refill [something]” as refilling.
Check refilling:
say “[The noun] can’t be refilled.” instead.

Instead of refilling the flashlight:
if the Battery Pack is enclosed by the location:
if the Battery Pack is full:
now the Battery Pack is empty;
now the power-remaining of the flashlight is 100;
say “You put the batteries into the flashlight[run paragraph on]”;
if the flashlight is not lit:
now the flashlight is lit;
say “, and it turns back to life, lighting up its surroundings[run paragraph on]”;
say “.”;
otherwise;
say “The Battery Pack appears to be empty.”;
otherwise;[/code]
I am getting this message :The rule or phrase definition ‘Instead of refilling the flashlight’ seems to use both ways of grouping phrases together into ‘if’, ‘repeat’ and ‘while’ blocks at once. Inform allows two alternative forms, but they cannot be mixed in the same definition.

One way is to end the ‘if’, ‘repeat’ or ‘while’ phrases with a ‘begin’, and then to match that with an ‘end if’ or similar. (‘Otherwise’ or ‘otherwise if’ clauses are phrases like any other, and end with semicolons in this case.) You use this begin/end form here, for instance - ‘otherwise’ .

The other way is to end with a colon ‘:’ and then indent the subsequent phrases underneath, using tabs. (Note that any ‘otherwise’ or ‘otherwise if’ clauses also have to end with colons in this case.) You use this indented form here - ‘if the Battery Pack is enclosed by the location’ ."

Wondering if anyone knows how to fix this, thanks for your continued help!

[code]“Flashlight” by Andrew

The Den is a room. The Den is dark.

The player carries a Flashlight. The Flashlight is lit. The Flashlight has a number called power-remaining. The power-remaining of the Flashlight is 3.

Every turn:
if the power-remaining of the Flashlight is greater than 0:
decrease the power-remaining of the Flashlight by 1;
if the power-remaining of the Flashlight is 0:
say “The flashlight flashes off.”;
now the power-remaining of the Flashlight is -1;
now the flashlight is not lit.

The Battery Pack are here. The Battery Pack can be full or empty. The Battery Pack is full.
Refilling is an action applying to one thing. Understand “fill [something]” and “refill [something]” as refilling.

Check refilling:
say “[The noun] can’t be refilled.” instead.

Instead of refilling the flashlight:
if the Battery Pack is full:
now the Battery Pack is empty;
increase the power-remaining of the Flashlight by 100;
say “You put the batteries into the flashlight[run paragraph on]”;
If the flashlight is not lit:
now the flashlight is lit;
say “, and it turns back to life, lighting up its surroundings[run paragraph on]”;
say “.”;
otherwise:
say “The Battery Pack appears to be empty.”;
otherwise:
say “You have nothing to fill the Flashlight with.”.
[/code]

Thank you, that works!