"Yourself" vs "The player"

I’m considering a project which involves lots of identity/body switching, and I wanted to make sure I understood this concept first before I got too far in and discovered I’m DOING IT RONG!!1

I’m used to referring to the PC as “the player” - such as in the command “if the player consents”, but I know there are rules that require the code to instead refer to “yourself”.

From posts I’ve researched, it’s suggested that if a game involves switching between NPCs, that you want to name all the characters and start with “The player is Bob.” (or whomever) since Inform will otherwise make a default character “yourself” with no actual identity and it is referred to as “your former self” if the player “inhabits” a different body.

I’m still a bit confused about the specifics.

Question 1:
Do I need to consistently refer to the player as “yourself” for coding such as

The description of the marsupial statue is "[if yourself is bob]As an expert on Australian fauna, you clearly identify that this is a statue of a platypus[otherwise if the player is fred]It's a weird statue sort of like a cross between a beaver and a duck. What the hell?[end if]"

Or should this be [if the player is Bob]?
Is there a shortcut way to do this such as [if Bob]…[otherwise if Fred]…?

Question 2:
With actions, do I basically code everything as an actor, or does the non-actor form always refer to whomever the player is inhabiting?

After jumping: say "You're doing a great job jumping, [yourself]!" After jumping: say "You're doing a great job jumping, [the printed name of yourself]!" After jumping: say "You're doing a great job jumping, [the printed name of the player]!" [???] After an actor jumping: if the person asked is yourself: if yourself is Bob: say "You're doing a great job jumping, Bob!"; if yourself is Fred: say "Attaboy, Fred."...

Am I making this way too complicated? Does the rule form “After [verb]ing” always refer to the player, no matter what body they’re in?

As a followup then, would it work to say “If yourself consents:” ? That’s I think where I’m getting confused that “The player” is the human player in front of the keyboard as opposed to "yourself’ referring to the body worn by the PC.

Question 3:
Any other pitfalls I’m possibly not even aware of?

Is there a documentation section that spells this all out? I paged through a few, but it always seems to be referred to in passing onto another topic. (I’ve just discovered RB 5:6)

I always use “the player” in place of “yourself”.

Getting it to print your actual name is hard, though. Having it print “[the player]” will just print “yourself”. I ended up having to create a “text that varies” variable that stores the new pc’s name before switching.

I read RB 5:6 and I’m starting to think I have it backward - “the player” always references whomever the player happens to be and “yourself” is the generic but unnecessary placeholder when the player is not a named “body”.

Also, there’s a neat I6 code to drop in for text switches for viewpoint characters (thanks, Emily!).

My understanding is “yourself” is just the internal name of the person-object that the human player controls by default, while “the player” is a global variable that refers to whichever person the human player is currently controlling.

“The player” should work in any context where “yourself” would work, except where the syntax requires a specific object (as opposed to a variable). A good example would be statements about the past tense. You cannot, for example, say “if the location was visited,” because “location” is a variable; you have to be specific and say “if the Fallout Shelter was visited,” and so forth. Similarly, you can’t say “if the player has been in the Fallout Shelter,” because “the player” is a variable; you have to refer to a specific person, so most of the time you’d say the slightly less grammatically elegant, “if yourself has been in the Fallout Shelter” (or, if the player is Bob, “if Bob was in the Fallout Shelter”).

These situations are actually pretty rare; there might be another one but at the moment past tense is the only one I can think of.

It’s pretty easy to override the “your former self” behavior with a “when printing the name” rule, like:

Rule for printing the name of yourself when the player is not yourself: say "Jim".

However, you could still end up having to write a lot of code that sometimes checks “if the player is Bob” and elsewhere checks “if the player is yourself,” which would presumably get confusing; hence the advice to immediately assign the player to a named person-object so you can refer to everyone by name.

Correct.

And I’m pretty sure “If the player consents” is a set phrase that has to be written as such.

For the abbreviation, maybe you can try something like this:

To decide whether as (subject - a person): decide on whether the player is the subject.

and then you could write:

The description of the marsupial statue is "[if as bob]As an expert on Australian fauna, you clearly identify that this is a statue of a platypus[otherwise if as fred]It's a weird statue sort of like a cross between a beaver and a duck. What the hell?[end if]"

Thank you all for the advice! I think I have enough of a handle on it now that I can experiment intelligently without having to chase down my previous misconceptions.