I’m repeatedly running up against a syntax problem within my code, which I’m sure is just a failure to understand how Inform wants me to word the phrase, but is proving very frustrating.
I’m trying to iterate through a list of objects that satisfy certain conditions, namely where a property of a kind satisfies particular conditions. I know that I can create a “list of open doors”, for example, but when I try and create a more nuanced iterator I keep running into problems where Inform doesn’t understand what I’m trying to say.
As an example of what I mean, I’ve written the below. I’m looking for a way to gather all the paintings of a certain colour together as a list that can be iterated over, or used in other rules. I’ve tried multiple ways of saying “list of paintings that have impression equal to red”, but I simply cannot get it to work.
Colour is a kind of value. The colours are red, yellow, green and purple. A painting is a kind of thing. Every painting has a colour called the impression. The description of a painting is usually "This painting just seems to be a big splodge of [the impression] paint on the canvas." The gallery is a room. "The clean white walls of the gallery seem the perfect foil for contemplating the art with surgical critical precision." The still life is a painting. The impression of the still life is yellow. The still life is in the gallery. The landscape is a painting. The impression of the landscape is green. The landscape is in the gallery. The portrait is a painting. The impression of the portrait is red. The portrait is in the gallery. The battle scene is a painting. The impression of the battle scene is red. The battle scene is in the gallery. Every turn: Repeat with p running through the list of paintings that have impression equal to red: say "[P] is a red painting."
Any ideas on how to solve this would be much appreciated - as I said, I keep trying to use a formulation like this throughout my code and it’s creating a whole heap of ugly work arounds!