intfiction.org

The Interactive Fiction Community Forum
It is currently Mon May 28, 2018 12:10 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Thu May 10, 2018 12:27 pm 
Offline

Joined: Tue Nov 08, 2011 8:11 am
Posts: 2482
Location: US - Central
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

Code:
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?

Code:
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)


Top
 Profile Send private message  
Reply with quote  
PostPosted: Thu May 10, 2018 12:39 pm 
Offline

Joined: Tue Jul 28, 2015 1:05 pm
Posts: 1127
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.

_________________
-My IFDB name is Mathbrush, and I'm @MathBrush on Twitter.

The rough draft of my book on IF history and criticism is available at https://www.dropbox.com/s/xd2isl3tk7dxt97/learning-text.pdf?dl=0


Top
 Profile Send private message  
Reply with quote  
PostPosted: Thu May 10, 2018 1:21 pm 
Offline

Joined: Tue Nov 08, 2011 8:11 am
Posts: 2482
Location: US - Central
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!).


Top
 Profile Send private message  
Reply with quote  
PostPosted: Thu May 10, 2018 1:35 pm 
Offline

Joined: Sun Oct 11, 2015 5:09 pm
Posts: 306
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:

Code:
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.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Thu May 10, 2018 2:18 pm 
Offline

Joined: Sat Jan 23, 2010 4:56 pm
Posts: 5650
Quote:
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.


Correct.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Thu May 10, 2018 2:49 pm 
Offline

Joined: Tue Mar 09, 2010 2:34 pm
Posts: 5276
Location: Burlington, VT
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:

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


and then you could write:

Code:
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]"


Top
 Profile Send private message  
Reply with quote  
PostPosted: Sat May 12, 2018 11:49 am 
Offline

Joined: Tue Nov 08, 2011 8:11 am
Posts: 2482
Location: US - Central
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.


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: Baidu [Spider], Google [Bot] and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group