Im trying to make an IF about how to make a fire, but i cant get rules to work so it wont light unless things are done in a certain order

The Cabinet is a thing.
The Cabinet is scenery.
The description of The Cabinet is “An old grey cabinet used to house your tools.”
The Cabinet is a supporter.
The Cabinet is in the Home.

The house key is a thing.
The house key is in the box.
The house key unlocks the Storm Door.
The description of the box is “An old tool box”

Flint is a thing.
Flint is in the box.

Instead of taking the flint :
say “This can be used to start a fire!”;

The box is a thing.
the box is on the cabinet.
the box is closed.
the box is openable.

Instead of taking the cabinet:
say “The cabinet is far to big to carry, maybe just take whats within?”;
stop the action.

Tinder is a thing.
Tinder is in the forest.

Log is a thing.
Log is in the forest.

kindling is a thing.
kindling is in the forest.

Fire Pit is in the forest.
Fire Pit is a container.

The description of the fire pit is “I can start a fire in here, i just need the proper materials and a way to start it.”

Instead of taking the fire pit:
say “The fire pit is stuck down in the ground, with large bricks surrounding it. It is far to heavy to move”;
stop the action.

Instead of light the fire:
say “Maybe is should add the fuel first.”
stop the action.

What im trying to do now is make it so that when the player attempts to start a fire in the pit, the player first has to put the tinder in, then the kindling, then the log, and then use the flint that they find inside to start the fire.

if you can help me then id like to talk using discord or some other voice application just to make it faster, or by phone.

Inform provides a burn action, so you could use that.

Instead of burning the fire pit:
	unless the fire pit contains the tinder:
		say "You need some tinder first." instead;
	unless the fire pit contains the kindling:
		say "You need some kindling first." instead;
	unless the fire pit contains the log:
		say "You need some fuel to burn." instead;
	unless the player carries the flint:
		say "You need something to make a spark." instead;
	say "You start a fire."

If you are trying to enforce a sequence, you can prevent the player from adding the kindling before the tinder, etc.

Instead of inserting the kindling into the fire pit when the tinder is not in the fire pit:
	say "You should put some tinder down before the kindling."

To make things less tedious–

if you say ‘A cabinet is here.’, Inform7 will automatically assume that the cabinet is a thing, and that it is in the room most recently mentioned as the subject of a sentence. In fact, you can just say something like–

Home is a room.  "This is where your heart is.  You are not sure of the rest of your body, but your heart is here."

A cabinet is here.  It is a supporter and scenery.  The description is "An old grey cabinet used to house your tools."
Instead of taking the cabinet:
    say "The cabinet is far too big to carry.  How about just taking what you need from it?"

‘Stop the action’ is not needed–Instead rules do this automatically. You would use ‘stop the action’ only when you need to actually do that with other kinds of rules and there is no other way.

You can also say–

A box is on the cabinet.  It is closed and openable.  The description is "An old tool box."

A house key is in the box.  It unlocks the storm door.

A flint is in the box.  The description is "This can be used to start a fire!"

The player will probably want to be able to take the flint–an Instead rule will disable this. If the player types ‘TAKE FLINT’, it will only say the quote, without letting the player take the flint. So you might want to make that quote part of the description, or say something like–

After taking the flint when the flint was not handled:
    say "You take the flint, realizing it can be used to start a fire!"

The ‘was not handled’ makes it so that you get the quote only after the first time the flint is taken, all other times it will just say ‘Taken.’

Again, there is no need to say something ‘is a thing’–you merely either have to say something ‘is here.’, if you are describing it after a room description, or something ‘is in Forest.’ if elsewhere in your code. ‘here.’ will always place the thing into the most recent room mentioned as the subject of a sentence.

With Instead rules–you will probably want to avoid using Instead as much as possible when making rules for a complicated situation. You will usually want to have an Instead rule either only ‘say’ something, or ‘try’ some other action (or both)–

Instead of taking the rope:
   say "But it's way out of your reach!"
...

Instead of closing the car:
    try closing the driver's door.
…
Instead of eating the milk:
    say "Seeing that the milk is a liquid, you choose to drink it instead.";
    try drinking the milk.

However, ‘burning’ is one of those actions that you can define with an Instead rule (because it is disallowed by default; Inform will always respond with ‘This dangerous act [would achieve] little.’–it is built-in so that you can fully define it with an Instead rule). Make sure that everything that might prevent the player from doing the action (like being up in a tree nearby) is accounted for in your rule.

I hope this wasn’t too confusing. Welcome to Inform7!

2 Likes

You can also write the block burning rule is not listed in any rulebook and then use the burn action normally with before/check/carry out/after/report. You will have to define all the messages as no others are by default.

1 Like