The Disappearing Bob

In retesting the code in my Handbook, I’ve hit an example in Chapter 5 that may have worked formerly but doesn’t quite work now. Or maybe it never did, but I didn’t test thoroughly enough. Here’s the code:


The Test Lab is a room. "Many devious tests are conducted here."

[When play begins: Now the player is Bob.]

Bingo is an animal in the Lab. The description is "[if the player is Bingo]You are[otherwise]Bingo is[end if] a peppy-looking cocker spaniel."

Bob is a man in the Lab. The description is "[if the player is Bob]You are[otherwise]Bob is[end if] a heavyset, muscular man."

The player is Bob.

Linda is a woman in the Lab. The description is "[if the player is Linda]You are[otherwise]Linda is[end if] a sultry and curvaceous beauty."

The red button is in the Lab.

Instead of pushing the red button:
	if the player is Bob:
		now the player is Linda;
		say "A strange tingly feeling overtakes you. You feel much more feminine than before.";
	otherwise if the player is Linda:
		now the player is Bingo;
		say "Your head spins. When you recover, things seem to have changed. The world is larger, and you're covered with fur.";
	otherwise:
		now the player is Bob;
		say "You feel odd for a moment Yes, you're human again, and muscular, and male."

You’ll note that I’ve commented out the “When play begins” rule. Instead, I’m declaring by fiat that “The player is Bob.” With the code in this form, here’s the output after the player presses the button and becomes Linda:

Test Lab
Many devious tests are conducted here.

You can see Bingo, Bob and a red button here.

>x bob
You can't see any such thing.

>showme bob
There seems to be no such object anywhere in the model world.

Yes, Bob is shown in the room description, and yet Inform claims he doesn’t exist. If I comment out “The player is Bob” and uncomment my “When play begins rule,” I get a different problem:

Test Lab
Many devious tests are conducted here.

You can see your former self, Bingo, Linda and a red button here.

This is not an improvement. And just for the record, the search engine in the IDE can’t find “your former self” anywhere in the Documentation. So I clearly need to put a full explanation of it in the Handbook.

More urgently, however, I need to make this example work as it’s supposed to work, with Bob but with no former self. How would I do that?

Just have a few minutes now so I’m sure others will be along with fuller explanations, but:

  1. “Your former self” is the “yourself” that’s created as the default player character – it’s discussed in the docs a couple times (you can find them listed under “yourself” in the general index).

  2. I think the issue with not being able to refer to Bob is that by default, Inform doesn’t assume that you should be able to refer to yourself in the third person, which is generally a harmless assumption but breaks down once the viewpoint shifts (or if you write in the third person, presumably!) For a quick code fix, “Understand “Bob” as Bob.” should do the trick, at least. Could be it defaults to privately-named and you can manually override that? I can’t test that right now though.

1 Like

Thanks. That seems to do the trick – Understand “bob” as Bob. I actually thought of that, but didn’t bother to try it, because every other object in the model world gets its name stored as a possible vocabulary item.

Inform is weird. That hasn’t changed.

I’d still like to understand how to get rid of “your former self” in situations where the PC is body-hopping. Would “now yourself is nowhere” do it, I wonder. Probably not.

1 Like

You can say that again! Case in point:

I am 99% certain that this does work!

It seems to work.

When play begins:
	now the player is Bob;
	now yourself is nowhere.

I didn’t know about this until this thread in September:

It turns out setting the player in an assertion is a very different thing from doing:

when play begins:
  now the player is Bob;
1 Like

Has anyone asked Alice how she feels about all this?

1 Like

If you’re never going to have another use for the ‘yourself object’, the best answer to this conundrum is not to create a new object to be the player and find a way to discard the yourself object, but simply to mould the yourself object to your requirements:

"Tiddles" by PB

Lab is a room.

A cat is a kind of animal.
Yourself is a cat with description "Undoubtedly the handsomest of them all." and printed name "your beautiful, [if the player is not yourself]former [end if]furry self".  Understand "Tiddles" as yourself. 

EDIT: the only downside to this approach is that elsewhere in source you’d need to refer to this object as ‘Yourself’ (the internal name of the object) rather than ‘Tiddles’ (which only the parser will recognise as referring to the Yourself object). So:

If the player is yourself:

rather than

If the player is Tiddles:

Yes this sounds very familiar. It came up for me (hence the post mentioned about the Sierra example) when I wanted to create a game with two NPCs (Alice and Bob) where the player could switch between them:

when play begins:
	now the player is Bob;
	now yourself is nowhere;
	now the command prompt is "[bold type][printed name of the player][roman type]>".

I like the symmetry of it. I did have to change the command prompt to refer to [printed name of the player] instead of [player] to show who you are, because [player] will print as yourself.

Poor Alice will be happy to know that Bob is not somehow more special than her…

2 Likes