Generating NPCs with tables and listing them trouble

I’m having a problem with referring to a table in this game where I’m trying to define a number of NPCs using a table. I’ve gotten them to generate the npcs, but I can’t get a similar item (which uses the same table) to list the npcs in a comprehensive list.

This is the tip of the ice-burg with this table I feel… but here is the code I’m working on:

Gender is a kind of value. The genders are masculine, feminine, and unknown. Understand "male" or "man" or "M" as masculine. Understand "female" or "woman" or "F" as feminine.  A person has a gender.

A schoolhouse is a kind of value. A person usually has a schoolhouse. The schoolhouses are Gryffindor, Ravenclaw, Hufflepuff, Slytherin and Unsorted. A person is usually Unsorted.

A student is a kind of person.

The Great Hall is a room.

Some students in the great hall are defined by Table 1. 

A person has some text called their Forename. A person has some text called their Surname. 

[A quick search of the forum has given me this function:]

To say ordinalize (N - a number): 
	let the last digit be the remainder after dividing N by 10; 
	if the last digit is 1: 
		say "[N]st"; 
	else if the last digit is 2: 
		say "[N]nd"; 
	else if the last digit is 3: 
		say "[N]rd"; 
		say "[N]th";

[the table does have rows!]

Table 1 - Classmates
student	Forename	Surname	Gender	Year	schoolhouse
s1	"Ben"	"Robbins"	masculine	2	Gryffindor
s2	"Kristopher"	"Franklin"	masculine	1	Slytherin	
s3	"Kyle"	"Summers"	masculine	3	Gryffindor
s4	"Gerardo"	"Robinson"	masculine	7	Hufflepuff

 The description of a student is "[Forename] [Surname], a [ordinalize the year] year [schoolhouse]."
The initial appearance of a student is "[Surname], a [ordinalize the year] year [Schoolhouse] is nearby."

[Understand a noun's surname as the noun.]

To list the Slist:
	say "The student list runs as follows..";
	repeat through Table 1:		
		say "[Surname], [Forename] - [schoolhouse]-[Year]".
The roster is a thing in the great hall. 

Instead of examining the roster:
	list the Slist.

Listing the Slist is the thing I’m struggling with, where it just gives me .-Gryffindor-0 four times.

I’d also like to see if anyone has any feedback on how I can refer to these guys using their “forename” or “surname” properties, but thats later.

This code should work all by itself.

The syntax is “[column name entry]” (see 16.6 in the docs), so:

repeat through Table 1:		
		say "[Surname entry], [Forename entry] - [schoolhouse entry]-[Year entry]".

(That the output was Gryffindor and 0 was because those are the default values for their kinds, I think.)

1 Like

I think you’re right. I’ll give it a shot!

This is one of the more obnoxious order sensitivities I’ve seen. Your description and initial appearance definitions will work as expected if you put them before the table. (I7 programmer’s motto: the order in which you specify things doesn’t matter, except for when it does.)

There’s already an attribute on people for male/female, and it defaults to male (yeah, it’s kind of retrograde that way). There is an independent neuter/not neuter attribute, which defaults to not neuter. I don’t know what you plan to do with “unknown” but you might see if you can work with the existing things. Since they’re attributes, you can’t assign them by table, though.

So… the gender thing is from earlier in the story, where the player’s gender starts as “unknown” so that at the beginning of play they decide whether they are male or female, and give a name. I am probably going to update it and include a “neutral/nb” option as well, for inclusivity. The four names here are a proof of concept… since the list of students is actually much much longer

Core Inform has remarkably hard-coded gender stuff, which was unduly retrograde even for the 1990s when Inform 6 was released; I was patching around it when I was fooling around with Inform back in the 1990s. (I suspect this is because Inform’s primary author grew up before the big social changes on gender which happened in the 1970s in the US and slightly later in the UK; there’s a change in assumptions which tends to start among people born after about 1974, very roughly speaking.) You might want to check out my Gender Options extension, which does the minimum cleanup to loosen it up a bit.

With Gender Options, I think “they only” nb can be done by making a character not male, not female, neuter, and plural, or possibly ambiguously plural; I should test this and work up another example. If you can’t get it working, I’d be happy to make a new version of the extension to get it working.

There is one very tricky thing: it’s hard to code it to put “is” after a printed name and “are” after “they”, since which was previously printed isn’t currently tracked; that will not be easy to fix, though I’m already thinking about workarounds.

Most of the really hard work in the extension is for letting the player refer to another character by a pronoun in the typed-in command; it’s much easier to change the printing gender.

Worth noting: it’s actually very rare for the player character to be referred to in the third person, so the work mostly needs to be done for NPCs.

I believe @Zed is working on an extension for arbitrary pronouns like ze and e.

My extensions in the 10.1 branch of the Friends of I7 repo:

In the 9.3 / 6M62 branch:


C’mon, Nat…

Honestly, attribuiting retrograde characteristic to a binary attribuite on generational basis, is, to put it really mild, unfair.

My. and Graham’s, generation, borne in the late sixties/early seventies (and the earlier one, incidentally in my eyes the last of the three Great Generations of American, the two G.I. and the 'Nam ones, whose started the “computer/IT revolution”) was, and still is, accustomed to the concept that “every BIT count” (bit, not byte nor word…); thence, that the gender attribuite, in Inform 5, was actually a reuse of a single bit (leading, sometimes between 5/0 and 5/8, to a rather funny defensive comment…):

From Inform Library 5.0:

Attribute absent alias female;

is a natural product of a generation of coders formed on 8-bit machines; OTOH, albeit formed on really bigger machines, 16 or 18 bit minicomputer and above, the Original Imps, whose was writing a really advanced thing for their time (a 16 bit VM running on diverse 8 bit CPU), against the hardware limits of the late 70s/early 80s target machines’s…) leading to the infamous 31 attribuite limit of the Z3 machine, at the root of the binary nature of the implementation of the gender (whose, OTOH, can’t be an “absent” genre in the I5/I6 standard model world…)

Personally, I think that on genre (at metaphysical level) and genre identification, these are anolog values read very imprecisely and, IMVHO, unnaturally thru two distinct 1-bit A/D converter, and if any is to be considered arbitrary, on a social/political science, not computer science, basis is the twin dicotomy M/F, hetero/homo. But I’m digressing…

The core point, is that albeit the physical genre indeed can be a flag, the internal and external manifestation of genre need the largest word available. Every soul has both, and how many of both one decide to manifest are the actual sexual and genre identification variable, at least in my philosophy.

Best regards from Italy,
dott. Piergiorgio.

Pardon me for the digression if I make some reminiscences and discuss history.

I grew up programming on 16-bit machines with floppy drives in the early 1980s (as a young kid), when every bit still counted and much work was put into bitmasks. I have programmed in both assembly and machine language. IIRC, some early Infocom implementations went with the easy solution of having every animate creature respond to “him” and “her” interchangably – the zero-bits solution, clearly space-optimal ! This is not what Inform did.

My generational generalization is well-founded and comes from a lot of experience, and I have a belief as to why it is the case. Specifically, prior to 1972 in the US and somewhat later in the UK, there was a whole lot of legally-enforced gender segregation in workplaces and in children’s activities – this was mostly slowly eliminated during the 1970s in the US, following court rulings (starting in '72). This binary gender segregation – you got sent to the boys activity or the girls activity based on your recorded gender, no choice – went hand-in-glove with a sort of indoctrination of children into binary gender thinking.

This changed after the desegregation court cases. By the time I was going to school in the early 1980s (in the US) practically nothing was gender-segregated – everyone took both woodworking class and cooking class. Ten years earlier – when my older brother went to school! – many many things were gender-segregated, to a degree which still shocks me when I hear about it, including woodshop class being boys-only and cooking being girls-only. Those of us who grew up in unsegregated environments tended to have less binary assumptions than those of us brought up in gender-segregated environments. Obviously, anyone can overcome such assumptions – I know people aged 80+ who clearly have – but those of us who grew up in the unsegregated environments had fewer such assumptions taught to us early, so we had less to overcome. It’s not unfair to recognize that.

I know from the various people I know from the UK that these gender-desegregation changes mostly happened a little later in the UK than in the US. I have no idea when they happened in Italy!

The Inform 6 library has actually has had separate male and female attributes since version 6.2 in 1996, a progressive move which I would say was pretty in line with the spirit of the times. But it didn’t implement the remaining superstructure necessary to add flexibility.

The Inform 7 library, a more recent design, simply didn’t use the male attribute, although it was quite convenient for my implementation purposes that it already existed. By the 2000s when Inform 7 was introduced, the decision to implement a highly rigid gender model was a matter of assumptions about what was important to implement. The sort of assumptions where, if you aren’t thinking hard about it, you fall back on assumptions learned from childhood. I am sure there are assumptions like that that I am making in other areas without realizing it.


I tried to solve this at one point, though I don’t remember if I succeeded (it was back before my hiatus). The basic idea was to have the [they] say-phrase set the context to plural if appropriate, but not to have that object itself have plural attributes.

In my Fluid Pronouns extension under development, my approach is…

Most-recent-reference-value is a kind of value. The most-recent-reference-values are pronominal and nominal.

A person has a most-recent-reference-value called most recent reference.
The most recent reference of a person is usually nominal.

Before printing the name of a person (called item): now the most recent reference of the item is nominal.

… and the rulebook that actually comes up with pronouns set’s a person’s most recent reference to pronominal. And then PNToVP looks at most recent reference and if it’s pronominal, it returns the grammatical number associated with the pronoun instead of the noun, roughly speaking.

But one of the sticking points I have to address when I get back to it is coming up with the right behavior for ambiguously plural things.