I’ve tried several times to do a variation of the same thing, but have been unsuccessful. The idea is to (for instance) have a number of objects of kind K, all of which have the same value-kind V. However, K has subkinds, and the specific V of an instance of K depends on what subkind it is. My problem is how to express that in a generic manner.

[code]Color is a kind of value. The colors are red, blue, green, purple, yellow, and black.

To decide which number is a random percentage: decide on a random number between 0 and 100.

To decide what color is chosen in the (T - table name):
let N be the row in T by a random percentage;
choose row N in T;
decide on the color entry.

To decide which number is row in (T - table name) by (num - a number):
repeat with N running from 1 to the number of rows in T:
choose row N in T;
if num is less than the limit entry:
decide on N.

Table of Interesting Colors
color (value) limit (number)
red 20
blue 50
purple 100

Instead of jumping:
say chosen in the Table of Interesting Colors.

Home is a room.[/code]

This works, but the “To decide what color is chosen in the (T - table name):” phrase is hardly generic. I’ve been attempting to make the “to decide” phrase act on a generic “kind K”, but the table lookup refuses to comply. Does this have something to do with I7 being unable to guarantee that the “limit” column exists in the table?

I’m not seeing what your initial problem description has to do with the example code.

If you want a bunch of subkinds, each with a property whose value depends on the subkind, you’d normally say:

Armor is a kind of thing. An armor has a color.
A helmet is a kind of armor. The color of a helmet is usually red.
A greave is a kind of armor. The color of a greave is usually blue.

If this is insufficient, what are you trying to generalize? And what are you trying to generalize in the sample code? Are you trying to write a phrase that maps a kind K to a color?

Yeah, I’d worried that my explanation wouldn’t make sense. What I’m trying to generalize is the type of behavior where you can (basically) define a (kind of) thing’s likelihood of having x traits out of a given set of traits, as a percentage. For now, I can do that, but not as general as I’d like.

My intent was to create a template for randomizing typical objects, so that you could create a typical thing with slight variations around a common median. But it turns out that a fuller example creates a run-time error anyway as expected, because I7 can’t deduce what columns the table would hold.

Perhaps I’m not quite understanding, but do you mean something like this?[code]To decide what K is the entry in the/-- column (C - a value of kind K valued table column): (- TableLookUpEntry(ct_0, {C}, ct_1) -).

Color is a kind of value. The colors are red, blue, green, purple, yellow, and black.

To decide which number is a random percentage: decide on a random number between 0 and 100.

To decide what K is chosen from (C - a value of kind K valued table column) in the (T - table name):
let N be the row in T by a random percentage;
choose row N in T;
decide on the entry in column C.

To decide which number is row in (T - table name) by (num - a number):
repeat with N running from 1 to the number of rows in T:
choose row N in T;
if num is less than the limit entry:
decide on N.

Table of Interesting Colors
color (value) limit (number)
red 20
blue 50
purple 100

Table of Interesting Stored Actions
action (value) limit (number)
going west 20
singing 50
attacking home 100

Instead of jumping:
say “[chosen from color in the Table of Interesting Colors].”;
say “[chosen from action in the Table of Interesting Stored Actions].”