I am trying to work out how to group a certain category of objects together according to a property. Hopefully the simplest way to explain what I want is using an example:
"Blobs"
Laboratory is a room.
Blob-colour is a kind of value. The blob-colours are red, green and blue.
A blob is a kind of thing. A blob has a blob-colour called the colour. Understand the colour property as describing a blob.
Before listing contents:
Group red blobs together as "red blobs".
A blob called a big red blob is here. The colour is red.
A blob called the small red blob is here. The colour is red.
A screw is here.
A blob called the big green blob is here. The colour is green.
A blob called the huge blue blob is here. The colour is blue.
A widget is here.
A blob called the tiny green blob is here. The colour is green.
If I replace the listing contents rule with Group blobs together as "blobs" it will happily collect all five blobs together in the room contents listing. But I canât figure out how to qualify the description of which things I want to group to restrict it to a single colour because Inform doesnât seem to understand that the word âredâ in âgroup red blobs togetherâ refers to the blob-colour property (despite the âunderstand the blob-colour property as describing a blobâ line).
How do I turn the blob-colour property into something that Inform understands as a description?
"Blobs"
Laboratory is a room.
Blob-colour is a kind of value. The blob-colours are red, green and blue.
A blob is a kind of thing. A blob has a blob-colour called the colour. Understand the colour property as describing a blob.
Definition: A blob is red-colored if the colour of it is red.
Before listing contents:
Group red-colored blobs together as "red blobs".
A blob called a big red blob is here. The colour is red.
A blob called the small red blob is here. The colour is red.
A screw is here.
A blob called the big green blob is here. The colour is green.
A blob called the huge blue blob is here. The colour is blue.
A widget is here.
A blob called the tiny green blob is here. The colour is green.
A further question: is it possible to say something like âDefinition: a blob is C-coloured if the colour of it is Câ, or do I have to just write a definition for each colour by hand?
This looks like it should make everything a million times easier, but either Iâve missed a crucial detail or it doesnât work. I changed the code to this:
"Blobs"
Laboratory is a room.
Blob-colour is a kind of value. The blob-colours are red, green and blue.
A blob is a kind of thing. A blob has a blob-colour. Understand the blob-colour property as describing a blob.
Before listing contents:
Group red blobs together as "red blobs".
A red blob called a big red blob is here.
A red blob called a small red blob is here.
A screw is here.
A green blob called a big green blob is here.
A blue blob called a huge blue blob is here.
A widget is here.
A green blob called a tiny green blob is here.
But the compiler protests:
Problem. You wrote âA red blob called a small red blob is hereâ (line 13): but I can only make âa something called whateverâ when the something is a kind I know, possibly qualified with adjectives. For instance, âan open door called the Marble Doorâ is fine because âdoorâ is the name of a kind and âopenâ is an adjective which means something for doors. But âa grand archway called the Great Gatesâ would not normally mean anything to me, because âarchwayâ is not one of the standard kinds in Inform. (Try consulting the Kinds index.)
I think in this case youâd need to activate a use option:
Use unabbreviated object names.
With that on, in 6M62, I can do:
There is a red blob called a big red blob. It is here.
In the Laboratory is a red blob called a small red blob.
A screw is here.
Here is a green blob called a big green blob.
A blue blob called a huge blue blob is in Laboratory.
A widget is here.
A green blob called a tiny green blob is here.
With a little more systematic code and with fewer induced shortcuts, it works:
Lab is a room.
A blob is a kind of thing.
Colour is a kind of value.
The colours are blue, red and green.
Size is a kind of value.
The sizes are tiny, small, medium, big and huge.
A blob has a colour.
The colour of a blob is usually red.
A blob has a size.
The size of a blob is usually small.
Rule for printing the name of a blob (called the LocalBlob):
say "[colour of LocalBlob] [size of LocalBlob] blob";
Blob01, blob02, blob03, blob04 and blob05 are blobs in Lab.
The colour of Blob01 is red.
The size of Blob01 is big.
The colour of Blob02 is blue.
The size of Blob02 is big.
The colour of Blob03 is green.
The size of Blob03 is tiny.
The colour of Blob04 is red.
The size of Blob04 is medium.
The colour of Blob05 is red.
The size of Blob05 is huge.
Before listing contents:
Group red blobs together as "red blobs".
Lab
You can see blue big blob, green tiny blob and three red blobs (red big blob, red medium blob and red huge blob) here.
>
Oh, I hadnât spotted that it was only the second definition onwards that was causing the problem! Presumably because âa red blobâ in the second line is taken as meaning the big red blob that was already defined, rather than a new one?
Now I have to decide whether I can stand to use unabbreviated object names throughout the whole project âŚ