The opposite of the printed name?

Hi everyone,

So I’m in the testing phase of my game and this is an offshoot of my previous thread which involves letting the player reference the location.

All of the advice there worked great. The player can examine the location using its name, or the word “room” and other synonyms.

However, a lot of my rooms have names that are not exact matches of their printed name. So I’ll need to do some extra work to get those to behave the same way. I know how to do it, but my question involves streamlining the process.

I’d like to get Inform to tell me of every room in my game which has a different printed name from its actual name. I’ve been working on this game for months and I have a lot rooms like this in my game. I know I can search my code for “the printed name of…” and I’ll do that if necessary. But I’ve also changed the printed name of every room in certain regions, different “kinds” of rooms, etc. So sometimes I change the printed names of multiple rooms with one line of code. I’m afraid I’m going to miss something.

I know what I’m asking for is a paradox. I want to print the original name of each room next to its printed name if there’s a difference between the two.

I know I can ask inform to compare different types of text and names and such, but I don’t know what the opposite of “the printed name” is or how to reference it.

If it’s not possible to do this, that’s OK. But if it is, it would be really helpful and a time saver.

I’m starting with the below, but I’m just not sure where to go from here:

rooming is an action applying to nothing.

Understand "room it" as rooming.

Carry out rooming:
	repeat with space running through rooms:
		say "[the space][line break]";

Obviously, that just gets me the printed name. Is there a way to do what I’m asking?

Thanks in advance!

Are you using the IDE? I think the simplest way to do this would be to just look through the Map tab of the Index, since you can expand each room to see its printed name property.

(I don’t think there’s a simple way to get Inform to output the object name rather than the printed name, and the more complex ways are going to be more work than just checking out the index).

1 Like

I’ve been told by those who know that original names cannot be retrieved because the compiler doesn’t keep a record of them. As I understand it.

1 Like

Yeah, you’d need to do a workaround - like do a find and replace to change “printed name” to some other newly-created property, do the output test, then find and replace to change things back. But potentially messy and bug-introducing.

I wonder if they’re in auto.inf somehow. Then you could run sed on it to recover the names. LOL

1 Like

Yes I am and I didn’t realize that I could see the printed name by expanding the room names in the index, so that is helpful. Thanks!

What’s odd about that is that if I changed the printed name of a kind of room rather than the room itself, then the printed name of that room isn’t available when I expand that room’s name (unless I’m missing something obvious).

But, I suppose that the absence of a printed name will also be evidence that I changed the name of the room, so that’s not much of a problem.

Thanks again!

1 Like

Bummer. Well, it was worth a shot. Thanks anyway!

1 Like

For most properties, if you don’t set it explicitly, it’ll have some default value (usually “”) that you can check for at runtime.

But printed name is an exception; if you don’t set it explicitly, it’ll be set automatically to the source-code name.

So unfortunately there’s no way to tell at runtime if something has a printed name property set or not. You could technically compare the dictionary values against the printed name property, but that’s a royal headache and very brittle (it’ll break as soon as you have any “understand X as Y” lines).

2 Likes

Yes, they are, up to a point. They don’t preserve capitalization or the difference between - and _. Maybe other things, I don’t know. Anyway, if you’re masochistic.

1 Like

Courtesy of @drpeterbatesuk here: Printing the original name of something - #7 by drpeterbatesuk

you can print the ugly internal name with:

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

Since I asked that question myself, you’d think I’d remember the answer. D’oh!

In one of the many threads that link to, repeat, and/or expand on @drpeterbatesuk code I found the following, which pretties up the name. I can’t for the life of me find that post now that I’m looking for it!

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

To say original name of (o - object):
	let X be "[internal name of o]";
	if X matches the regular expression "^\(I_(.+)_U\d+\)$":
		now X is the text matching subexpression 1;
	say "[X]".

Which could then be used to do this:

Rooming is an action out of world.
Understand "room it" as rooming.

Carry out rooming:
	repeat with space running through rooms:
		say "[the space] ([original name of space])[line break]".
1 Like

Heh. Think that was me. Inform is driving me insane: why does declaring a room work in one place, but not another? - #5 by Zed

1 Like

Now that all the actual answers have been given, I can say that the opposite of the printed name is the unprinted name.

-Wade

1 Like

Thank you! That did it!

And on a list of things I never could have figured out on my own in a million years, that is right near the top.

Thanks again!