Hi all,
I am new to Inform 7, so my apologies since I expect the solution to my issues is fairly simple.
I have an example code block to simulate lighting objects fire- the following code (I assume) is not causing any issues:
When play begins:
now the right hand status line is "[time of day]";
This Place is a room.
A flammable object is a kind of thing.
A flame-state is a kind of value. Flame-states are initial, alight, and ashes. A flammable object has a flame-state.
A flammable object has a time called the flame-life.
The flame-life of a flammable object is usually 1 minute.
A thing can be sparkable or inert. A thing is usually inert.
There is a flint in This Place. The flint is sparkable.
There is a knife in This Place. It is sparkable.
There is some dried grass in This Place. It is a flammable object. The flame-state of the dried grass is initial. The indefinite article of dried grass is "some".
The description of a thing is "[if sparkable]It looks like it could make a spark, if you struck it on something.[else if the noun is a flammable object and the flame-state of the noun is initial]It looks like it could tempt a spark.[else if the noun is a flammable object and the flame-state of the noun is alight]It's on fire.[else if the noun is a flammable object and the flame-state of the noun is ashes]It is now just ash.[end if]".
After printing the name of a flammable object (called object) (this is the flame state identification rule):
if the flame-state of the object is not initial,
say " ([flame-state of the object])".
The sparks are a thing. The indefinite article of sparks is "some". The sparks are initially nowhere.
Understand the command "spark" as something new.
Understand "spark [thing] with/on/against [thing]" as sparking it with.
Understand "hit [thing] with/on/against [thing]" as sparking it with.
Understand "strike [thing] with/on/against [thing]" as sparking it with.
Understand "scrape [thing] with/on/against [thing]" as sparking it with.
Sparking it with is an action applying to two things.
Check sparking it with:
if the noun is not sparkable,
say "The [the noun] is not sparkable." instead;
if the second noun is not sparkable,
say "The [the second noun] is not sparkable." instead;
if the noun is the second noun,
say "That doesn't seem possible." instead;
otherwise:
say "You strike [the noun] on [the second noun].".
Carry out sparking it with:
say "Sparks scatter around.";
now the player is carrying sparks;
fizzling out occurs in 1 turn from now.
Report sparking it with:
say "Better decide what to burn before you do.";
At the time when fizzling out occurs:
try dropping the sparks.
Instead of dropping the sparks:
say "The remaining sparks die out.";
now the sparks are nowhere.
The next code is the actual âburningâ action, which Iâve had various errors with and havenât been able to understand the cause really:
Understand the command "kindle" as something new.
Understand the commands "light" and "burn" as something new.
Understand "kindle [something]" as kindling it.
Understand "set fire to [something]" as kindling it.
Understand "set [something] on fire" as kindling it.
Kindling it is an action applying to one thing.
Understand the commands "light" and "burn" as "kindle".
Check kindling it:
if the noun is not a flammable object,
say "You don't want to burn [the noun]." instead;
if the player is not carrying sparks,
say "You need to make some sparks (if there were any, they've gone out by now)." instead;
if the noun is the second noun,
say "That doesn't seem possible." instead;
otherwise:
say "You blow some sparks toward [the noun].".
Carry out kindling it:
if the flame-state of the noun is alight,
say "[The noun] is already burning." instead;
if the flame-state of the noun is initial,
now the flame-state of the noun is alight;
becoming ash occurs in the flame-life of the noun from now.
Report kindling it:
if the flame-state of the noun is alight,
say "[The noun] burns.";
otherwise:
if the flame-state of the noun is ashes,
say "There's no use in burning ashes.".
At the time when becoming ash occurs:
if the noun is a flammable object,
now the flame-state of the noun is ashes.
test me with "actions / burn fire / set fire to grass / strike flint on knife / set grass on fire / light knife / i / l "
This code was throwing the runtime error (p10) about non-existent properties, of non-flammable things I assume, when trying to âlight the knifeâ, but also after simply âlookingâ after the grass object was alight. I got rid of this error by adding the line if the noun is a flammable object,
to the last timed event (becoming ash). I am not exactly sure why this disappeared however.
My second issue is with the timed event (becoming ash). No matter how long I wait in-game, no flammable object in the alight condition becomes ashes. This has confused me greatly- Iâve looked through and tried example code from the documentation and other manuals, but havenât been able to solve it despite having similarly formatted code. My only guess is that the issue might have to do with how Inform is measuring time; for example when I use âshowme [a flammable object]â the flame-life is always whatever specified time after 12:00 am, how is this a way to measure the time in-game, rather than counting back from the specified time?
Thanks in advance to anyone who may answer.