Alternatives for the me in "x me"?

I’d like an alternative for the me in “x me”. Let’s say the player is called Captain Jon and the player should be able to say “x jon” or “x captain”.

What I tried so far is

Bridge is a room. 

Captain Jon is a man in the bridge.
The player is Captain Jon.
Description of the player is "You are Captain Jon.".

which leads to

Bridge

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

>x me
You are Captain Jon

I also tried

Understand "captain", "jon" as me.

and

Understand "captain", "jon" as the player.

but both throw errors.

I did not find anything related in the documentation. Is there even an easy solution to this?

1 Like

Perhaps the following does what you want?

Bridge is a room. 

Captain Jon is a man in the bridge.
The player is Captain Jon. Understand "Captain", "Jon" as Captain Jon.
Description of the player is "You are Captain Jon."
3 Likes

Thanks!
This indeed works – but I don’t understand why!?! :thinking:

1 Like

I am new to Inform7 myself but am building a game with a similar idea: the player is one of the NPCs (and in fact can switch between NPCs.) The example “Terror of the Sierra Madre” does something like this. Although I ran across some issues on descriptions etc. An interesting thread is Role-based interactive.

In my own game I now use a different approach since I want all NPCs to be handled identically. Then it would translate into something like:

Bridge is a room. 

Captain Jon is a man in the bridge. The description of Captain Jon is "[if the player is Jon]You are Captain Jon[otherwise]Captain Jon is here."

When play begins:
	now the player is Captain Jon;
	now yourself is nowhere;
2 Likes

The name of the object representing the player is by default “yourself”, as can be seen in the World tab of the Index in the IDE.

It’s not always easy to know when Inform expects “the player” and when it expects “yourself”. I am confused by that from time to time, too, but the general rule is to just use “the player”.
However, in this case there’s a hint in the error message you get when you use “Understand "captain", "jon" as the player.”:

The last sentence leads to a working solution:

Bridge is a room.

Understand "captain", "jon" as yourself.
4 Likes

It is, in my opinion, a bug in Inform. The privately-named property gets applied to whatever the “player” variable is initially set to, which means it doesn’t get any Understand lines by default.

4 Likes

Thanks a lot for the detailed explanation!

My bad! I could have (should have) thought of that… I must have been blinded by my hastiness. I should have read the error message more carefully. :roll_eyes:

Many thanks to all for your help!

2 Likes

You’re welcome, and no worries! :slight_smile:

I often neglect the Index a bit myself, but it can be very useful, that’s why I mention it from time to time.

And Inform’s error messages are sometimes helpful, and sometimes more confusing than helpful, so it can easily happen that one overlooks the hints in them.

3 Likes