Obtaining/saying the name of a kind

I have a bunch of objects created by several different assemblies. I would like to change the way their name is printed in some circumstances - specifically, when the owner of the object has been already printed. (Using Plurality)

For a single type of object, it’s simply:

Rule for printing the name of a nose (called the item) when the holder of the item is the prior named noun:
    say "[its-their] nose";

(This is so you don’t get output like “George wriggles George’s nose”).

But if you have a number of similar assemblies, you have to write a separate rule for every kind, or do an if-then-otherwise for every kind.

What I would like is:

Rule for printing the name of a body part (called the item) when the holder of the item is the prior named noun:
    say "[its-their] [kind of the item]";

Obviously “[kind of the item]” doesn’t work. And I can’t find a phrase in the Phrase book that does what I want.

Is there a way of getting this - maybe by dropping down into I6, even?

From memory there’s no straightforward way, even in I6. But there are other options.

You could add a text property to all things and when defining a kind set it to the name of the kind.

You could define an extra instance of every kind immediately after defining the kind, and then refer to the default value of the kind.

The default name of assembly parts is decided by Inform on some quite low level – beneath I6, as far as I can tell. I found that out while translating I7 to Swedish. There just was no elegant way to turn those names into another language. (Perhaps that counts as a bug, even?)

I’ve gone the route of defining a short-name for each kind, and now have:

Rule for printing the name of a body part (called the item) when the holder of the item is the prior named noun:
    say "[its-their] [short-name of the item]";

But it turns out that I also need to determine if the name should be capitalized.

I dug around the Standard Library and found nothing, but found “Global caps_mode = false;” in Printing.i6t. I tried accessing this with I7:

Capitalizing is a truth state that varies. The capitalizing variable translates into I6 as "caps_mode".

Rule for printing the name of a body part (called the item) when the holder of the item is the prior named noun:
    if capitalizing is true, say "[Its-their] [short-name of the item]";
    otherwise say "[its-their] [short-name of the item]".

This results in an Inform6 compilation error:

C:\Program Files\Inform 7\Compilers\inform-632 \
    -wSDv8 +include_path=..\Source,.\ auto.inf output.z8
Inform 6.32 for Win32 (18th November 2010)
auto.inf(25418): Error:  Variable must be defined before use: "caps_mode"
> Global caps_mode
Compiled with 1 error and 1681 suppressed warnings (no output)

Compiler finished with code 1

Obviously I need to write an “Include (- … -) after Printing.i6t” segment, but I’m not familiar enough with I6 to write it properly. Any clues?

Managed to figure out this, which seems to work.

Include (-
[ CAPITALIZING_MODE ; 
	return caps_mode;
];
-) after "Printing.i6t"

To decide whether capitalizing: (- (CAPITALIZING_MODE() ) -).

Wouldn’t this work just as well?

To decide whether capitalizing: (- (caps_mode) -).

Nope - it gets the exact same error about “Variable must be defined before use”.

Since all you want here is “caps_mode” to be accessible in Inform 7, couldn’t you just use this?

Caps mode is a truth state that varies. The caps mode variable translates into I6 as "caps_mode".

Creating an I6 function to achieve that seems a bit much.

Hope this helps.

See my post on August 4th - that was my first attempt, and it doesn’t work (I6 compilation error). It seems you can’t access caps_mode until it’s defined in Printing.i6t, and Printing.i6t is included after the I7 source text. The only way to force Inform to place code after Printing.i6t is to do a full “Include (- I6 code -) after …” method.

Ah yes, I see now you’ve already tried that. The real problem seems to be that caps_mode is defined much later than it otherwise should be. Shifting the definition to “Definitions.i6t” seems to fix this.

[spoiler][code]“Test”

Include (- Global caps_mode = false; -) after “Definitions.i6t”.

Include (-

[ STANDARD_NAME_PRINTING_R obj;
obj = parameter_object;
if (obj == 0) {
print (string) NOTHING__TX; return;
}
switch (metaclass(obj)) {
Routine: print "<routine ", obj, “>”; return;
String: print “<string ~”, (string) obj, “~>”; return;
nothing: print "<illegal object number ", obj, “>”; return;
}
if (obj == player) {
if (indef_mode == NULL && caps_mode) print (string) YOU__TX;
else print (string) YOURSELF__TX;
return;
}
#Ifdef LanguagePrintShortName;
if (LanguagePrintShortName(obj)) return;
#Endif; ! LanguagePrintShortName
if (indef_mode && obj.&short_name_indef ~= 0 &&
PrintOrRun(obj, short_name_indef, true) ~= 0) return;
if (caps_mode &&
obj.&cap_short_name ~= 0 && PrintOrRun(obj, cap_short_name, true) ~= 0) {
caps_mode = false;
return;
}
if (obj.&short_name ~= 0 && PrintOrRun(obj, short_name, true) ~= 0) return;
print (object) obj;
];

-) instead of “Standard Name Printing Rule” in “Printing.i6t”.

Caps mode is a truth state that varies. The caps mode variable translates into I6 as “caps_mode”.

Rule for printing the name of the player:
if caps mode is true begin;
say “You”;
otherwise;
say “you”;
end if.

The Testing Room is A Room.[/code][/spoiler]

Hope this helps.

I think I’ll stick with defining the small I6 function rather than redefining an entire section of the template code. (Especially since I’m including this in an extension).