i7 : kinds of values in lists in tables

Am having a very odd one. It’s probably a syntax problem but I’m damned if I can work out what:

Here’s the code:

[code]A colour is a kind of value. The colours are Blue, Green, Red, Yellow.

L is a list of colours that varies.

Table of ColorfulThings
creature Hues(a list of colours)
Cat {}
Dog {}

After examining the cat:
Add Blue to Hues corresponding to the creature of Cat in the Table of ColorfulThings;
Add Green to Hues corresponding to the creature of Cat in the Table of ColorfulThings;
Add Blue to L;
Add Green to L;
say “[L].[Hues corresponding to the creature of Cat in the Table of ColorfulThings].”;
showme the contents of the Table of ColorfulThings.

The Kitchen is a room. “Many accoutrements that are irritating to develop as scenery objects.”.

A dog is an animal in the Kitchen. “The big dog wags its tail at you.”. The description of it is “A big fluffy dog”.

A cat is an animal in the Kitchen. “The cat ignores you.” The description of it is “The cat hisses and spits. It doesn’t like you.”.[/code]

Here’s the output. I would expect L and Hues to hold the same. But no!

[code]Testgame
An Interactive Fiction by Ade McT
Release 1 / Serial number 160128 / Inform 7 build 6L38 (I6/v6.33 lib 6/12N) SD

Kitchen
Many accoutrements that are irritating to develop as scenery objects.

The big dog wags its tail at you.

The cat ignores you.

x cat
The cat hisses and spits. It doesn’t like you.

Blue and Green.
1 and 2.
Table of ColorfulThings
(row 1) | cat | 1 and 2 |
(row 2) | dog | |

[/code]

It’s translating the list in the table to a number rather than the value. I’ve tried many combinations of ‘{}’ or ‘–’ or ‘{""}’ in the table itself, but no joy. What am I doing wrong?

Thank you!!

McT

So, this is wierd. If I start the list out with a Colours value, as so:

Table of ColorfulThings creature Hues(a list of colours) Cat {Blue} Dog {Green}

Then it seems to be able to use the actual values. But then of course, the output of my code is :

[code]>x cat
The cat hisses and spits. It doesn’t like you.

Blue and Green.
Blue, Blue and Green.
Table of ColorfulThings
(row 1) | cat | Blue, Blue and Green |
(row 2) | dog | Green |

[/code]

Which is of not much use to me. Is there a way to start with an empty list in a table in this way? This feels like a bugette?

McT

So, this works:

[code]When play begins:
initiate_lists;

To initiate_lists:
repeat through the table of ColorfulThings:
truncate hues entry to 0 entries.[/code]

So the list is casted, and then emptied at start of play. Gives the correct behavior:

[code]>x cat
The cat hisses and spits. It doesn’t like you.

Blue and Green.
Blue and Green.
Table of ColorfulThings
(row 1) | cat | Blue and Green |
(row 2) | dog | |

[/code]

But that seems like a workaround rather than a solution. Is this a known bug? Or is this expected behavior?

McT

Your original example code works fine - the list in the table does contain Blue and Green, rather than the numbers 1 and 2 (try testing whether the list contains Blue, or copying the list into a temporary variable and then saying it). The problem is that the “showme the contents of” phrase is failing to work out that the list contains colors, so it is printing their runtime representation instead (Blue = 1, Green = 2, Red = 3, Yellow = 4).

Since WI 16.4 says this phrase yields a “crude” output suitable only for testing, I’m not sure if this would be considered a bug. But it’s definitely confusing, so you could submit a report.

It is a real bug – the contents of the table are defined inconsistently. It turns out not to matter for most cases because of the way Inform handles lists, but it’s still worth reporting.