"Too Many Activities"

Is my code eating its tail somehow? (Edit to add 6L38)

[code]Definition: A thing is other if it is not the player and it is not held by the player.

The player carries a container called a satchel. An apple is in satchel.

The player wears some clothes.

Foyer is a room. North of Foyer is Antechamber. Antechamber is dark.

A window is scenery in antechamber.

A table is a supporter in antechamber. A phone is on table.

Instead of jumping when the location is dark:
Let glimpsed be a random other thing enclosed by the location;
Say “You see [a glimpsed].”;
place glimpsed in scope.

A flashlight is a device in antechamber.

Carry out switching on flashlight:
now flashlight is lit.

Carry out switching off flashlight:
now flashlight is not lit.

After deciding the scope of the player while in darkness:
if the player can touch flashlight:
place flashlight in scope.[/code]

Yeah, I’m pretty sure “can touch” depends on what’s in scope, so your after deciding the scope rule is sending itself into an infinite loop. I think this only comes up when you enter a command with a noun. (“x me” will also get you the problem.)

I’m also pretty sure that your jumping rule won’t accomplish anything. Per Writing with Inform 18.29, “place foo in scope” should only be used in rules for deciding the scope; by the time the next rule rolls around, Inform is going to be calculating the scope again, and it’s going to throw out whatever you told it to place in scope last turn.

So you should replace “if the player can touch flashlight” with some check that doesn’t call scope like “if the location encloses the flashlight” (you might want to check if the flashlight is in a closed container, if you want to be fancy), and you should have the jumping rule set some kind of flag or property, like make glimpsed a property and say “now a random other thing enclosed by the location is glimpsed,” and then have an after deciding the scope rule to put glimpsed things in scope. Note that “x flashlight” is going to get you a refusal to act in darkness anyway, since examining requires light. Also you might want to change “held by” to “enclosed by” in the definition of other in case the player has parts (I can’t remember whether worn things count as held, so they might be a problem too).

I ran into the same problem (infinite recursion in a scope rule) in one of my stories. This is how I dealt with it.

The flashlight mutex is initially false.
After deciding the scope of the player when the flashlight mutex is false:
    now the flashlight mutex is true;
    [code;]
    now the flashlight mutex is false.

Oh, don’t do that.

Surely there’s a better way to get what you want than to create an infinite loop and cut it off after one cycle.