I6: Is there a way to directly reference the "textual name" from an object definition header?

DM4 p. 51 describes the structure of the first line of an object definition as follows:

Object <arrows> <identifier> “textual name” <parent>

To which property is the “textual name” provided by an object definition header assigned? Is there a way to access this property by a specific name?

It seems like the string (?) contents of this property are what’s returned by

print (name) x;

in the absence of a short_name property, assuming that a “textual name” was provided in the source. (And if it’s not provided, it seems to be set to the object identifier surrounded by parentheses.) I haven’t found anything discussing how to get at this property directly – is that functionality intentionally left out? If so, does anyone know why?

It’s not a property, it’s literal text at the start of the property table (in Z-code). See Z-spec 12.4.

You can print it using the @print_obj opcode.

There isn’t a way to get a normal string value that refers to this text. There can’t be, because it’s not guaranteed to have an aligned string address.

1 Like

Honestly, it’s mostly a relic of early Z-machine versions that’s no longer used. Nowadays the standard library uses a separate short_name property instead (implemented in the same way as any other property, so you can access it and change it however you want).

If you want to read it as a string, you can do that with @output_stream 3. But for most purposes, it’s completely separate from the normal property system. (As Zarf says, it’s just a few bytes of literal text at the start of an object’s property table; a normal property like Inform’s short_name is a pointer to a string or a routine in ROM.)

P.S. Fun fact, this is actually the source of a number of bugs in Zork 1! There’s no easy way to change it, so any object that changed its name in play (like the inflated vs deflated raft) had to be implemented with multiple objects. Quite a few bugs boil down to “properties of one object aren’t properly reflected to the other when switching back and forth”.

1 Like

It’s not that it’s never used. In I6, it’s the default. As you noted, the default behavior of print (name) obj is to print this textual name.

But if you need the printed name to vary, you can put in a short_name property, and then print (name) obj will use that instead. All library code (and all sensible user code) will use this path, so short_name is always checked.

(In I7, the textual name is obsolete. I7-generated code always sets it to “” and creates a short_name property.)

2 Likes