how and when does I7 guess which indirect article to use?

Well, I blundered through a whole bunch of things by trial and error, and I finally got something to apparently compile… but the story pane is blank and gray. That seems like it shouldn’t happen.

Here’s what I have right now, spoilered for ugliness:

[spoiler][code]The Lab is a room.

An animal can be honest or dishonest. Understand the honest property as describing an animal.

Before printing the name of an animal (called beast): say "[if beast is dishonest]dis[end if]honest ".

The unicorn is an animal. It is honest.
The yak is an animal. It is dishonest.

A block is a kind of thing. It has a number called weight. The description of a block is “It looks to be about [weight of the item described in words] pound[s].”
After examining a block (called B):
now the printed name of B is “[weight of B in words] - pound block of [B]”.

The yttrium is a block. The weight is one.

The uniform is wearable. The description is “It’s a United States Army uniform.”
After examining the uniform for the first time:
now the printed name of the uniform is “United States Army uniform”.

A unicorn, a uniform, an hourglass, a yak and yttrium are in the lab.

[Matt’s code - additions noted]

[create a global variable to be called later in i6:]
[Current vowel sound is a number that varies. Current vowel sound variable translates into i6 as “vowel_sound”.

Before printing the name of a thing (called x):
let T be a text;
now T is the printed name of x;
now Current vowel sound is T evaluated.
[say Current vowel sound.]

To decide what number is (s - a text) evaluated:
if s starts with a vowel sound:
decide on 1;
decide on 0. ]

To decide whether (string - a text) starts with a vowel sound (this is vowel sound checking):
let the first word be punctuated word number 1 in string;
if the first word is a word listed in the Table of Words That Start With Vowel Sounds, yes;
if the first word is a word listed in the Table of Words That Don’t Start With Vowel Sounds, no;
if character number 1 in the first word is a vowel, yes;
no.

To decide whether (letter - a text) is a vowel:
if letter exactly matches the regular expression “a|e|i|o|u|A|E|I|O|U”, yes;
no.

The initial sound rules are a rulebook. The initial sound rules have outcomes vowel and consonant.

An initial sound rule (this is the basic initial sound test rule):
if “[short name storage]” starts with a vowel sound:
vowel;
otherwise:
consonant.

To say the/-- short name storage:
(- PrintShortNameStorage(); -).

Include (-

[ PrintShortNameStorage len i;
len = StorageForShortName–>0;
for ( i = 0 : i < len : i++ )
{
glk_put_char_uni(StorageForShortName–>(i + 1));
}
];

-)
.

Table of Words That Start With Vowel Sounds
word
“hour”
“hourglass”
“honest”
“yttrium”

Table of Words That Don’t Start With Vowel Sounds
word
“uniform”
“unicorn”
“united”
“United”
“one”

[end]

Include (-
Global vowel_sound = 0;
-) after “Definitions.i6t”.

Include (-

Constant LanguageAnimateGender = male;
Constant LanguageInanimateGender = neuter;
Constant LanguageContractionForms = 2; ! English has two:
! 0 = starting with a consonant
! 1 = starting with a vowel
[ LanguageContraction text result rv;

!!! This is the old routine:
!if (text->0 == ’a’ or ’e’ or ’i’ or ’o’ or ’u’
!or ’A’ or ’E’ or ’I’ or ’O’ or ’U’) return 1;
!return 0;
!!! Out w/ old – in w/ new:
rv = FollowRulebook( (+ initial sound rules +) );
if ((rv) && RulebookSucceeded()) {
result = ResultOfRule();
if (result == (+ vowel outcome +)) return 1;
return 0;}
return 0;
];
Array LanguageArticles -->
! Contraction form 0: Contraction form 1:
! Cdef Def Indef Cdef Def Indef
"The " "the " "a " "The " "the " "an " ! Articles 0
"The " "the " "some " "The " "the " "some "; ! Articles 1
! a i
! s p s p
! m f n m f n m f n m f n
Array LanguageGNAsToArticles --> 0 0 0 1 1 1 0 0 0 1 1 1;
-) instead of “Articles” in “Language.i6t”.[/code][/spoiler]

What I did was to borrow the code that Text Capture uses to load the captured_text buffer into the “[captured text]” text substitution and used that to get something that will load StorageForShortName into the “[short name storage]” text substitution. Then I looked at the code the standard rules uses to call the Does the Player Mean rulebooks from inside I6 and did some similar stuff to call the initial sound rules, adding temporary variables to LanguageContraction until it compiled… which probably wasn’t safe. But I was just expecting some abject failures, not a gray pane.

Anyway, it’s pretty clear that I need to figure out how to get Inform 6 and 7 to talk to each other. I think one thing that may be going wrong here is that “text” is an input to LanguageContraction but my I7 code is just trying to look at StorageForShortName. What would be ideal would be to pass an I6 array to I7 as a text variable, but I suspect that’s not possible… I haven’t had much luck getting people to explain I6-I7 communication to me in this way, though.