Defining things with tables: how to add either/or properties

I’d like to define some persons with a table, as in Documentation §16.16, but I don’t know how to give them properties like male/female or neuter. (I guess I would have the same problem if I defined containers and wanted them to start as open or closed.) Are those properties explicitly named (like the “description” property, for example)? What do I put as their table entry heading?

A leader is a kind of person.
Some leaders are defined by the Table of Leading Figures.

Table of Leading Figures
leader		description					???
Bongo		"Bongo's description."		male
Jumbo		"Jumbo's description."		female
Arivista	"Arivista's description."	male
Drew		"Drew's description."		female

The best I came up with is to simply add an arbitrary string or number property and then check it with an if statement, while iterating through the table:

When play begins:
	repeat through Table of Leading Figures:
		if leader's gender entry is "female":
			now the leader entry is female;
		if leader's gender entry is "male":
			now the leader entry is male.

Is there another way? Thanks!

There is no nicer way to do this, I’m afraid. There is no type whose values are “male” and “female”. (Or “open” and “closed”, as you observe.) Either/or properties can’t be stored in variables or tables.

It would be different if the Standard Rules said “Gender is a kind of value…” but it doesn’t.

1 Like

It is possible to make some changes to the Standard Rules and template layer to set up gender as a kind of value.

Example
"Gender by Table"

Place is a room.

A leader is a kind of person.

Some leaders are defined by the Table of Leading Figures.

Table of Leading Figures
leader	description	gender
Bongo	"Bongo's description."	male
Jumbo	"Jumbo's description."	female
Arivista	"Arivista's description."	male
Drew	"Drew's description."	female
Robbie	"It's a robot."	neuter

[To test default values by derivative kinds...]
Alice is a woman.
Bob is a man.

Every person is in Place.

[A quick check command...]
After waving hands:
    showme the list of male people;
    showme the list of female people;
    showme the list of neuter people.

Test me with "wave / pronouns / x bongo / pronouns / x jumbo / pronouns".

Section Modified People (in place of "Section SR1/11 - People" in Standard Rules by Graham Nelson)

The specification of person is "Despite the name, not necessarily
a human being, but anything animate enough to envisage having a
conversation with, or bartering with."

Gender is a kind of value. The genders are neuter, male and female.
A person has a gender. A person is usually male.

A person has a number called carrying capacity.
The carrying capacity of a person is usually 100.

Include (-
    has transparent animate
    with before NULL,
-) when defining a person.

The yourself is an undescribed person. The yourself is proper-named.

The yourself is privately-named.
Understand "your former self" or "my former self" or "former self" or
    "former" as yourself when the player is not yourself.

The description of yourself is usually "As good-looking as ever."

The yourself object translates into I6 as "selfobj".
Include (-
    with saved_short_name (+ "yourself" +),
 -) when defining yourself.

Section Modified Inform 6 Equivalents (in place of "Section SR1/16 - Inform 6 equivalents" in Standard Rules by Graham Nelson)

The wearable property translates into I6 as "clothing".
The undescribed property translates into I6 as "concealed".
The edible property translates into I6 as "edible".
The enterable property translates into I6 as "enterable".
The mentioned property translates into I6 as "mentioned".
The lit property translates into I6 as "light".
The lighted property translates into I6 as "light".
The lockable property translates into I6 as "lockable".
The locked property translates into I6 as "locked".
The handled property translates into I6 as "moved".
The switched on property translates into I6 as "on".
The open property translates into I6 as "open".
The openable property translates into I6 as "openable".
The privately-named property translates into I6 as "privately_named".
The plural-named property translates into I6 as "pluralname".
The ambiguously plural property translates into I6 as "ambigpluralname".
The proper-named property translates into I6 as "proper".
The pushable between rooms property translates into I6 as "pushable".
The scenery property translates into I6 as "scenery".
The fixed in place property translates into I6 as "static".
The transparent property translates into I6 as "transparent".
The visited property translates into I6 as "visited".
The marked for listing property translates into I6 as "workflag".
The list grouping key property translates into I6 as "list_together".

The indefinite article property translates into I6 as "article".
The carrying capacity property translates into I6 as "capacity".
The description property translates into I6 as "description".
The initial appearance property translates into I6 as "initial".
The map region property translates into I6 as "map_region".
The printed plural name property translates into I6 as "plural".
The printed name property translates into I6 as "short_name".
The matching key property translates into I6 as "with_key".

Section - New Pronoun Notice

[Caveat: This section only lightly tested.]

Include (-

! Alternate version
[ GetGender person;
    if ((+ female +)(person)) rtrue;
    rfalse;
];

! Alternate version
[ GetGNAOfObject obj case gender;
    if (obj hasnt animate)
	    case = 6;
    if (obj provides (+ gender +)) {
	    if ((+ male +)(obj)) gender = male;
	    if ((+ female +)(obj)) gender = female;
	    if ((+ neuter +)(obj)) gender = neuter;
    }
    if (gender == 0) {
	    if (case == 0) gender = LanguageAnimateGender;
	    else gender = LanguageInanimateGender;
    }
    if (gender == female)   case = case + 1;
    if (gender == neuter)   case = case + 2;
    if (obj has pluralname) case = case + 3;
    return case;
];

-) instead of "Gender" in "Parser.i6t".

There may be some other deep details to attend to, but this seems to work for the basics.

1 Like

Thank you both!

I’ll go for the short solution, since I find the other one too much for such an issue—plus it includes lots of stuff I don’t know, like… er… manipulating the Standard Rules :innocent:.

You might well have simplified your example for the purposes of asking, but as given, it’d probably be easier to just create them all without a table.

A leader is a kind of person.
A leader-man is a kind of leader.
A leader-man is usually male.
A leader-woman is a kind of leader.
A leader-woman is usually female.

Bongo is a leader-man. Description is "Bongo's description." [...]

repeat with p running through leaders: [...]

The technique in Defining things with tables shines when the things you’re making have a lot of named properties to assign. But you could also use the above and make separate tables of leader-men and leader-women to define them.

2 Likes