I6: An object dummy or doppelganger

I’m trying to solve a Library problem in which if the PC is nameless and then switches bodies, the new PC can no longer examine or interact with the former PC. If the original PC is given a name, then things work fine. I don’t want to introduce a default name of any kind because I’m sure authors want to retain the ability to have a nameless PC.

The writeup for my problem is here: inform7.com/mantis/view.php?id=1350. One tack I’m exploring is the idea of having a dummy scenery object called “my former self” follow around the former PC when the body swap is done. Then whatever I do to the dummy will be done to the former PC.

Now then, my question: How can I create an object that will reflect EVERYTHING onto some other object?

I could edit selfobj in parserm.h to look like this:

Object selfobj "(self object)" with name 'my' 'former' 'self', short_name YOURSELF__TX, ...

But that allows the player to refer to “my former self” at all times, even when in the original body. Having three dictionary words up there for the name property will prevent the author from allowing one to address the PC using a proper name.

You want any action on the dummy to be redirected to another object? I think you could do

before [; <<(action) (otherobj) (second)>>; ]

…but it’s been a while and that probably needs some refining.

Having a dummy scenery object follow the character around is a hacky solution. I wouldn’t recommend it for the standard library.

The I6 library has always assumed that you could write your own player object if you needed to. Or customize it without replacing it, to some extent. The 6/11 selfobj has space for a parse_name property; a game author could use this slot to have it recognize “my former self” when the player variable is switched to something else.

Also, the trick for providing a name property that’s a dummy (can be filled in by the author) is

name ',blank1' ',blank2' ',blank3'

The commas make these untypable words.

If I use that trick, how do I get around this complaint?

[** Programming error: (self object) (object number 20) has a property name, but it is longer than 2 bytes so you cannot use "." to set **]

I’m attempting to do it like this:

[ Initialise;
        location = theroom;
        player.narrative_voice = 3;
        player.short_name = "George";
        player.name = 'George';
        player.nameless = false;
];
(player.&name)-->0 = 'george'

I see. I think that problem is now solved. Knowing this, I can make some alterations in ChangePlayer() and have things work automagically.

Here’s something else somewhat related: I found myself using metaclass() to check if player.short_name is a routine or string in the CSubject functions in english.h. If I simply call it like player.short_name(), it appends a newline. Why? What would break if the Inform compiler were altered to not do that? It would seem to me that it would be advantageous to not have to worry if the property is a string or routine.

Every game that calls obj.prop() on a string property. We’re not making a language change of that magnitude.

You could change it at the library level by replacing the CA__Pr() veneer property.

The way to print the short_name property (as a string or function) without a newline is:

PrintOrRun(obj, short_name, 1)

You can see this demonstrated in parserm.h in the PSN__() routine.

Or you could call the PrintShortName() routine, which winds up invoking PSN__(). Or maybe CDefart()? That would include “The” in the case of a non-proper-named third-person player. (“The detective…”)