Switching characters.

Hi, I’m a beginner at writing IF using Inform7, though I’m a quick learner, and I’m starting a scenario out. I’m getting the story and setting fleshed out pretty well, details and props and what have you. The player character is a parasite of sorts, so at the start of the story, you the player is in the body of (and in control of) one person, and I would like to be able to “transfer” into a non-player character, making the non-player character into the player, and the exited body turn into a non-player character. If anyone could give me some advice on this, maybe point me to some helpful sections of the manuals, I’d really appreciate it. Thanks to everyone in advance.

Actually, I figured out how to make a switch between players, but could someone help me with changing the characters’ descriptions after the switch?

You would say:

The description of Steve is "[If the player is Steve]Your wonderful host[Otherwise]A potential host[end if]."

That seemed so easy I should’ve known it already, thank you very much! I’m having some trouble now though (and hope nobody minds my question becoming a series of questions!) with calling the act of switching characters “transferring,” and having the act of transferring result in the switching of the player from one person to another. Here’s the codes for the two current example characters and my feeble start of a code for creating the action of “transferring.”

[code]Buddy Walker is a man in the Hotel Room. The player is Buddy Walker.

The infant is a person in the Hotel Room. The infant is fixed in place.

The description of the infant is “[If the player is the infant]You are in an infant. It knows very little about itself. It smells like shit.[Otherwise]A crying infant. Such a putrid sound.[end if].”

Understand “baby” as the infant.

Transferring is an action applying to one thing. Understand “transfer” and “transfer into” as transferring.[/code]

P.S. Just edited the update with your last bit of advice. :smiley:

Well you would need to understand “transfer into [something]” as transferring so that inform can take the noun into account, and then check transferring to make sure that you’re transferring into a person. Any other troubles with it?

Thank you again, that worked great. I changed it up a bit though, and instead of checking to make sure I’m transferring into a person, I added in the concept of a brain being a thing in the person, it being the object that you “transfer” into. Then I made it so the act of “transferring” into the brain switches out the characters, and voila, worked like a charm! Seems so far my troubles involve simpler things. For instance, I can get a description of the character I inhabit by typing “look at myself” but what if I want the player to be able to type “look at YOURself” to the same result? Or since a brain is not something you can see since it’s inside the skull, I want to encourage the player to type “sense brain” instead of “look at brain” to get a description of the brain, or anything else I decide the character can sense. How would I add in “sense” as a synonym of “look?” By the way, since it couldn’t hurt, if you’re interested here’s all the code I’ve put in so far. It’s simple, but there’s some stuff to look at and read, and the ability to transfer is working for now. No obligation to try it, but maybe if you see it all together there you can see if I’m doing something where I might cause myself extra trouble later on, or something like that.

[spoiler][code]“Hellion” by Jon Todd

Section 1 - Procedure

When play begins:
say “[italic type]Prologue~[paragraph break]Survival is the only purpose. And continuance. There must be continuance.[paragraph break]You are standing in a hotel room. The body of a man lays against the wall in the corner of the room. Blood is everywhere. Pain. A thick puddle is beginning to appear underneath your feet. Your surroundings are becoming a blur. You hear an infant crying. Its loud baying makes the pain more intense.[roman type][paragraph break]”

Rule for printing room description details: stop.

Rule for listing nondescript items: stop.

Transferring is an action applying to one thing. Understand “transfer [something]” and “transfer into [something]” as transferring.

Section 2 - Scenario

The Hotel Room is a room. The description is “The hotel room definitely needs a cleaning, but some of these stains will probably never come out. A corpse sits in the corner.”

Buddy Walker is a man in the Hotel Room. The player is Buddy Walker.

The infant is a person in the Hotel Room. The infant is fixed in place.

The description of the infant is “[If the player is the infant]You are in an infant. It knows very little about itself. It smells like shit.[Otherwise]A crying infant. Such a putrid sound. You can smell its brain from here, so fresh. To burrow in it would be pleasant.[end if].”

Understand “baby” as the infant.

Understand “baby’s brain” and “infant’s brain” as the infant’s brain.

The infant carries an infant’s brain. The description of the infant’s brain is “You sense the young, fresh brain. Tiramisu. Pistachio. Infant brain.”

Before transferring infant’s brain:
Now the player is the infant;

The description of the player is “You are in Buddy Walker. You care little about him at the moment. There is a large wound in his abdomin, and it’s bleeding generously. Buddy Walker seems to be dying. You need to find and transfer into a new host soon, before you die with him.”

The dead man is a supporter. It is here. It is fixed in place. The description is “The man has just died. He is covered in blood, as is everything around him, and there is a concentration of it around his mouth. A shattered vase is in pieces beside the corpse. It looks as if he is holding the largest piece tightly in his hand.”

Understand “corpse/body” as the dead man.

The broken vase is a thing. It is here. The broken vase is fixed in place. The description is “The vase has broken into many tiny pieces, and none look very useful.”

Instead of taking the broken vase:
say “The tiny pieces of the vase wouldn’t help anything.”

The hand is a thing. It is here. It is fixed in place. The description is “The man’s hand is holding a large, and very sharp piece of the vase. It’s covered in blood. He must have got you with it before you threw him against the wall. You wonder how badly.”

The large piece of vase is a thing. It is here. The description is “A large, jagged piece of vase. It has much blood on it.”[/code][/spoiler]

Here’s what I came up with so far:

A brain is a kind of thing. A brain is a part of every person.

This eliminates the need of having to give everything a brain, and the awkwardness of someone carrying their own brain.

[code]Transferring is an action applying to one thing. Understand “transfer [something]” and “transfer into [something]” as transferring.

Instead of transferring a person (called the host):
If a brain (called the target) is part of the host, try transferring the target;

Check transferring:
Unless the noun is a brain, say “You can only enter welcoming brains.”

Carry out transferring:
Say “You burrow your way into [the noun].”;
If the noun is part of a person (called the host):
Now the player is the host;
[/code]

That looks good so far. I would call the action “transferring into” instead of “transferring”, so you can write rules like “Instead of transferring into Bob…”

To add the verb “sense”, just add this line:

Understand the command "sense" as "examine".

Thanks both of you, you’re great help! I’ll start updating it with this new code and see how far I get before I have more questions! :wink:

Also, with this line…

Rule for listing nondescript items: stop.

…there will never be a paragraph about the “nondescript” things that are lying in a room. Like the infant that’s not mentioned anywhere so how’s the player supposed to know it’s there?