Printing the original name of something

Purely as a debugging tool, I’d like to print out the original name (not the printed name property) of an object. I have a lot of things with similar printed names that I need to scan through to find unset properties, etc…

Is this even possible? I can’t understand enough of the I6T to figure it out if it is or not.

The words making up the internal name of something are saved in its I6 name property for use in parsing. It’s an array of dictionary words, which is much less convenient than a string, but for debugging purposes that may be enough.

I may or may not be doing something reasonable. Anyway, I can’t find name in Definitions.i6t, only short_name. Doing this gives me the printed name:

(- PrintOrRun((+ X +), short_name, true); -)

and parse_name causes a memory access error.

The words making up the internal name of something are saved in its I6 name property for use in parsing. It’s an array of dictionary words, which is much less convenient than a string, but for debugging purposes that may be enough.

This is the relevant code:

To decide what number is the number of understood words of/for (obj - object): (- ({obj}.#name)/WORDSIZE -)

To decide what list of texts is the list of texts understood to be (obj - an object):
    let L be a list of texts;
    repeat with i running from 1 to the number of understood words for obj begin;
      add the substituted form of "[understood word i for obj]" to L;
    end repeat;
    decide on L

To say understood word (n - a number) of/for (obj - object): (- if ({n} <= ({obj}.#name)/WORDSIZE) print (address) ({obj}.&name)-->({n}-1); -)

But there are a couple of troubles here… these are the words it can be understood as. By the default, that will be each word in the object name plus the plural of their kind name. But if you’ve added synonyms with understand, those are there, too. And if it’s privately-named then only whatever you’ve explicitly added with understand is there.

Really, if you want to be able to do this reliably, you’ll have to add your own property.

1 Like

Well, it’s ugly, but it’s better than nothing. Thanks for the help.

Only 181 objects to set properties on. Should be a snap.

Defining things with tables might help. (Once again, “thing” there means object.)

In 10.1.2 this works, but not in 9.3/6M62.

To say the/-- internal name of (o - object): (- print (object) {o}; -).

It prints in brackets the translated I6 internal name, which will be slightly modified from the I7 name.

1 Like

Nice. Though among the liberties it can take is truncation: it may leave out some words altogether.

Also, if you give inform an obnoxiously long object name (which of course I promptly did, and this is why we can’t have nice things), it throws up its hands in disgust and makes the object internal name, e.g., I_etc_U1.

1 Like

Sadly not- if it’s privately named, there will never be a name property, whatever ‘Understand...’ phrases you write. Any names added to a privately-named object via ‘Understand...’ are accessed via a routine called by the parse_name property.

For something which is publicly-named, simple names added via e.g. ’
Understand "salmon" as the fish’ or ‘Understand "salmon" or "trout" as the fishor ‘Understand "salmon/trout" as the fish get added to the name property; anything more complex, including ‘Understand "salmon/trout" as the fish or multiple word names e.g. ‘Understand "brown trout" as the fish’ is part of the routine called by parse_name, which is why in that case the whole name must be entered in a command and in the correct sequence, i.e. ‘brown trout’ not ‘brown’ or ‘trout’ or ‘trout brown’ or ‘trout fish trout fish brown trout brown’ which would all be recognised by the parser after ‘Understand "brown/trout" as the fish

EDIT: Correction: ‘Understand "salmon/trout" as the fish’ and similar slash-separated-names are included as part of a parse_name routine, not as entries to a name property.

1 Like

I give you something, you just have to break it :laughing:

1 Like

This might be madness depending on your stage of development and certainly less cool than the suggestions others here will make, but maybe something like:

TestRealName is a number that varies. TestRealName is initially 0.

The printed name of Couch_LivingRoom is “[if TestRealName is 0]Couch_Living Room[otherwise]couch”

Use a custom action to flip that on or off.

1 Like

That’s a good idea! It brought to mind this scheme. Untested, but I think it’d work…

a room has a text called original name.
a room has a text called printable name. [ set these in advance ]

when play begins:
repeat with r running through rooms begin;
  now the original name of r is the substituted form of "[r]";
  now the printed name of r is the printable name of r;
end repeat;

(You could do the above with a single property, but it’d be horribly misnamed during one part of the operation or another and prone to cause confusion.)

1 Like