I want something to become rotten after X turns

So…I’m going to have a few things floating about that can become “rotten”. Things are usually not rotten. But I’m having a problem:

[code]A thing can be rotten. A thing is usually not rotten.

At the time when a thing is rotten:
now a giant fly is in the thing’s location.

In five turns from now;
now the corpse is rotten.[/code]

Inform get hung up on the last bit (turns from now) no matter how I phrase it. I’m obviously doing something wrong and silly, but any hints as to what? The corpse is a fixed in place thing that exists and can be interacted with, so there’s no problem with Inform not knowing about the corpse, but no matter what I try to tell it it refuses to accept something “becoming” rotten. Clues?

the rotting timer clucks in five turns from now;

(...)

At the time when the rotting timer clucks:
    now the corpse is rotten; [unnecessary unless you need the rotten flag later on]
    now a giant fly is in the thing's location.

Thank you very much. I’ll give it a crack!

Waahhh, it keeps giving me grief.

The bloated corpse rots in five turns from now; At the time when the bloated corpse rots: now the bloated corpse is a rotten thing; now a giant fly is in the location.

It reports: “Problem. You wrote ‘The bloated corpse rots in five turns from now’ : but I can’t find a verb here that I know how to deal with, so I am ignoring this sentence altogether.”

Ah, there are a few problems here. The most salient is probably that you’re trying to stick a rule inside a phrase, which doesn’t work. “The bloated corpse rots in five turns from now” is a phrase indicating a specific moment, and code outside rules does not have a defined sequence. This is a problem with indentation.

[code]When play begins: the bloated corpse rots in five turns from now.

At the time when the bloated corpse rots:
now the bloated corpse is rotten;
now a giant fly is in the location.[/code]

Both of these are now rules.

That worked great, thank you.

[code]When play begins: the bloated corpse rots in five turns from now.

At the time when the bloated corpse rots:
now the bloated corpse is rotten;
move giant fly to Bloated Bo’s’n Beach;
if bloated corpse is visible, say “A giant fly buzzes down and lands on the bosun.”[/code]

I’m having a little trouble getting Inform to be happy with more than one giant fly (in an inaccessible room called Swarm) but I’ll keep chipping away at that. Thanks very much again!

Not a problem. :slight_smile:

In regards to several flies, what you want is a kind called “giant fly.” However, every instance of said fly has to be declared ahead of time, and references to “the giant fly” won’t work because Inform won’t know which specific giant fly you mean.

One solution is to declare a number of generic giant flies (see the Duplicates entry in the Inform manual), and then refer to “a random giant fly” with the appropriate qualifier. Demonstration follows:

[code]The swarm is a container.

A giant fly is a kind of animal. The plural of a giant fly is giant flies. Ten giant flies are in the swarm.
A thing can be rotten. A thing is usually not rotten.

When play begins: the bloated corpse rots in five turns from now.

At the time when the bloated corpse rots:
now the bloated corpse is rotten;
now a random off-stage giant fly is in the location.

The Jungle is a room.
The bloated corpse is a thing. It is in the jungle.[/code]

Note here that because we define the swarm as a container and assign it no location, it’s automatically created off-stage.

A container, of course! Thank you sir!

Edit: container spat out a run-time error during a playthrough so I just said “there are ten giant flies” and that seems to have done the trick for now, thanks for putting me on the right path though!