killing "your former self"

So, I would like I7 to never identify anyone as “your former self”. I’ve read different things saying that “your former self” is the name that I7 gives to “yourself” when you switch to another player. But, I can’t reconcile that with, for example:

[code]The Parlor is a room. Alice, Bob, Claire, Dave, and Eve are people in the parlor. The player is Alice. When play begins: let the subject be a random person in the parlor; now the player is the subject.

A person has a stored action called the next-action.

Instead of jumping:
say “The stored action is [the next-action of the player].”;
stop.

test me with “jump”.[/code]

Which gives the very ugly output of:

The stored action is the your former self waiting.

Anybody have any ideas about what’s up here, and how one could ward off all references to “your former self.”

That’s correct.

Your sample code doesn’t surprise me. The default value for stored actions is “yourself waiting”, and after the switch, “yourself” is printed as “your former self”.

If you remove the previous player object from play, there aren’t a lot of ways that “your former self” could possibly be printed. If you don’t do that thing with the stored action, that is.

What references are you trying to ward off?

The “your former self” text is a response – print protagonist internal rule response C. So you could change it with the usual response tools to something else, perhaps “somebody” or “John Doe”.

This bit seems to solve the immediate issue, but I don’t know if it covers everything you want:

The Void is a room. The player is in The Void.

The Parlor is a room. Alice, Bob, Claire, Dave, and Eve are people in the parlor.

When play begins:
    Now the player is Alice;
    let prevname be the printed name of the player;
    Now the printed name of yourself is prevname;
    let the subject be a random person in the parlor;
    now the player is the subject;

A person has a stored action called the next-action.

Instead of jumping:
    let prevname be the printed name of the player;
    Now the printed name of yourself is prevname;
    let the subject be a random person in the parlor;
    now the player is the subject;
    say "The stored action is [the next-action of the player].";
    stop.

test me with "jump".

Somewhat kludgy, but there you go. Output:

Testing
An Interactive Fiction by "Phillip J Rhoades" The story headline is "A testbed"
Release 1 / Serial number 180811 / Inform 7 build 6M62 (I6/v6.33 lib 6/12N) SD

Parlor
You can see Alice, Bob, Claire and Eve here.

>jump
The stored action is Dave waiting.

>look
Parlor
You can see Alice, Bob, Claire and Dave here.

>jump
The stored action is Eve waiting.

>look
Parlor
You can see Alice, Bob, Claire and Eve here.

>

You might be able to clean that up a bit to make it work, or at least it might get you going in the right direction. Best of luck. :slight_smile:

One thing about the original code is that when you declare “The player is Alice,” it automatically starts the “yourself” object out of play. I think this must be some special-casing wizardry–in the Index “yourself” appears in The Parlor, but if you do “showme yourself” on the first turn it’s nowhere.

As zarf said, that means that there aren’t many occasions where “your former self” will be printed. The reason it prints in your code is because you never set an initial value for the next-action, which means it gets the default value for stored actions–and the actor part of the default value for stored actions is the “yourself” object. You could change that particular thing by specifying a different default:

The next-action of a person is usually Alice waiting.

[EDIT: This next part was wrong; see post below.] Note that, in default Inform, you can only specify stored actions either by literally specifying them in full (“Alice waiting,” “Claire kissing Bob”) or getting them out of “the current action” or another stored action variable. (I think “the current action” is the only other option.) If you want to be able to do something like set the next-action of every person to that person waiting, you need the extension Editable Stored Actions by Ron Newcomb, which does seem to be working for the latest version of Inform.

I don’t think you need Editable Stored Actions for that. This seems to work.

When play begins: 
	repeat with Joe running through people:
		now the next-action of Joe is Joe waiting.

Ah! I was trying to do it the other way around, by changing “the actor of the next-action,” which I guess is something that can only be evaluated rather than changed. But it does seem like you can use a variable in the specification of the action. That’s very useful to know!

Thanks for all this. This is really helpful.

Just so I understand stored actions closer to correctly, am I right to think:

  1. That there isn’t a way to have a stored action without a specified actor? (My use case for this would be something displaying the action. My assumption is that I’d have to instead have phrase that splices together the action name part and noun part of the stored action.

  2. That in order to basically copy person A’s action to person B, I would have to use the Editable Stored Actions extension that was mentioned. That is, otherwise there isn’t a way to elaborate Zarf’s example to the equivalent of:

When play begins: repeat with X running through people: now the next-action of X is ((X doing the next-action of person Y))

A stored action always has an actor.

When saying a stored action, the actor is omitted (in the printed output) if it’s the same as the player. So if your goal is to print the stored action in game output, you might need to use the Editable Stored Actions trick.

I think you need Editable Stored Actions. As jrb pointed out, you can use variables for things in stored actions without the extension, but I don’t think you can use variables for action names in specifying stored actions without the extension–Inform wouldn’t know how many nouns need to be specified, or what preposition if any, without knowing the action name. (That is: if Alice’s next-action is looking, and Bob’s next-action is examining Alice, you can extract the action-name from either of those, but if you tried assembling a new action-name out of it you wouldn’t know whether you need a noun or not.)

As it turns out: I couldn’t get Editable Stored Actions to work AT ALL. I couldn’t even get its own examples to work. Maybe I was doing something wrong or now dependencies on my machine are mixed up as I am trying to sort through different versions of extensions to handle a different issue. If anybody has used it lately and can affirm that it does work under the current version of Inform and such, I’d poke around at it more.

Oh, I’m sorry. I tried including Editable Stored Actions in a project and it compiled, but I didn’t thoroughly check it out.

Looking at version 10 of Editable Stored Actions, which is the one I have and which can be found here or here, it looks like the code for “text part” of the stored action is commented out in the extension itself, but not in the examples. I was able to get the second example in the documentation to compile by deleting the references to a “text part” in the example. The first example didn’t contain references to a text part and worked as it was.