Repeat N works with location but not map region

Playing around with “repeat with N running…” I got confused; when N runs through specific things in the location, the rule produces the expected results, but when it runs through same things in the map region of the location it doesn’t.

Example ensues.

(Excuse the length. I tried to give a simplified example and it turned out to be even more pretentious…)

“To Say Paranormal” by GiannisG

Paranormal activity is a kind of value. 10dB specifies a paranormal activity.

An entity is a kind of person.

An entity has a paranormal activity called energy field. The energy field of an entity is usually 50dB.

Total local field is a paranormal activity that varies. Total local field is 0dB.

The Abandoned Train Station is a room. “About 30 metres underground, the place promises a lot of action.[paragraph break]The [rail tracks] continue to the east.”

The Dark Tunnel is east of the Abandoned Train Station. “The rail tracks continue for about 40 meters before they disappear into darkness.”

Old Lines is a region. The Abandoned Train Station and the Dark Tunnel are in the Old Lines.

The platform is scenery in the Abandoned Train Station. The description of the platform is “The platform is worn out and rat-infested.” Understand “abandoned” and “Station” and “train station” as the platform.

The rats are a backdrop. They are in the old lines. “Nice little animals. They make you feel you have some company.” Understand “rat” as the rats.

The rail tracks are a backdrop. They are in the old lines. “The steel tracks have seen better days.” Understand “rails” as the rail tracks.

After listening to the tracks:
say “You can hear a very low rumble approaching.[paragraph break]This is very strange, considering that this part of the metropolitan railway has been closed down since the mid-20th century.”

A female entity called Lady Winterbottom is in the Dark Tunnel. The description of Lady Winterbottom is “She seems lost in thought.”

The Train Arrival is a scene. The Train Arrival begins when the time since the Entire Game began is 3 minutes.

When Train Arrival begins:
say “That’s strange. You can hear a low rumble getting louder and louder, as it approaches from the east. Suddently, a huge spectre materialises out of the dark tunnels. A ghost train.”;
now the ghost train is in the Abandoned Train Station;
get a reading;
say line break;
say “The Para-Meter goes nuts, showing [total local field].”

The ghost train is a neuter entity. The energy field of the train is 5000dB. The description of the train is “This must be the result of that horrible derailment accident, back in 1897.”

The Para-Meter is a device carried by the player. The description of the para-meter is “Handed over to you from late uncle Egon, back in the 80s, you never thought that it would be useful. It shows the intensity of the paranormal energy field[first time] And the batteries still work[only].” Understand “parameter” as the para-meter.

After switching on the para-meter, say “It buzzes and whirrs. Its screen shows static and then stabilises.”

Every turn when the para-meter is switched on:
get a reading;
say “The Para-Meter shows [total local field].”

To get a reading:
let PA be 0dB;
repeat with N running through entities enclosed by the map region of the location:
increase PA by the energy field of N;
now total local field is PA.

Test me with “turn on para-meter / e / z / w”

The resulting meter reading is always 0dB.

“Enclosed by” won’t work with regions. Usually you could just use “in”. But because you’re referring to the region indirectly rather than by name, I suspect you will need to use “regionally in”. (See Section 6:11 of Writing with Inform.)

You are 100% right. I checked the §6.11 and adjusted the code accordingly:

repeat with N running through entities regionally in the map region of the location:

which works perfectly.