inform 7: swiching the player

i need a code that lets me switch between the player and animals. i tried using the transfigeration machine code but i can’t figure it out. i don’t want to use a machine and i dont want the player to change randomly.

How do you want this to happen? It’s pretty simple to switch the identity of the player; all you have to do is write “Now the player is…” Here’s an example that lets the player do it with a simple command:

Lab is a room. Robert is a man in Lab. Connor is an animal in Lab. The player is Robert. Becoming is an action applying to one thing. Understand "become [something]" as becoming. Carry out becoming: if the noun is not a person: say "You can't become something inanimate."; otherwise if the noun is the player: say "You're already yourself."; otherwise: say "You become [the noun]."; now the player is the noun; try looking.

One thing is animals are considered to a kind of person in I7.

I don’t know what you mean by “the transfiguration machine code.”

The phrase you need is

now the player is the hedgehog

See chapter 8.9 on “Moving the player”.

If you want the player to change between characters at will, you have to define an action that lets him/her do that. Something like:

[code]Playing is an action out of world applying to one thing.
Understand “play [someone]” as playing.

Check playing:
if the player is the noun:
say “You already play the part of [the printed name of the noun].”;
stop the action.

Carry out playing:
now the player is the noun;
say “You now play the part of [the printed name of the noun].”
[/code]

And if you want the player to be able to change back to his former self, you had better define that person just like any NPC at the beginning of the game and tell Inform which of the characters in the game the player begins as. Like so:

The Lawn is a room.
Dr Doolittle is a man in the Lawn.
A hedgehog is an animal in the Lawn.
A fox is an animal in the Lawn.
A tree is in the Lawn.
The player is Dr Doolittle.