List of actions?

I’m embarrassed to say that I’m having a hard time understanding the documentation included with Inform7. So here’s the problem I’m having now…

My character is a shapeshifter. The game begins with her waking up not in her human form. What I want is for the player to have to use a command like “Turn into human” to get her into human form, then “Take clean clothes” to get dressed, followed by leaving the room. If she tries to leave without shifting first, I want it to not allow it, saying something like “I can’t let my family know my secret!”, and if they try to leave without getting dressed first it’ll say something like “If you think I’m going anywhere naked, think again!”

Thanks!

For the shapeshifting part, you’ll need to create a new action. There are lots of ways of organizing it, but I would start by creating a new kind of value, “form”, which can be human, wolf, or whatever.

A form is a kind of value. The forms are human and wolf.

Now the player needs to be given a form.

 The player has a form. The form of the player is wolf.

(Depending on what your game is about, you might want everyone to have a form. In which case, you could write “A person has a form. The form of a person is usually human. The form of the player is wolf.”)

Next we create the shapeshifting action, and write basic rules for it.

Shapeshifting is an action applying to one form. 

Check shapeshifting when the form understood is the form of the player:
	say "You are already in [the form understood] form." instead.
Carry out shapeshifting:
	now the form of the player is the form understood. 		
Report shapeshifting:
	say "You feel the change coming over you. You now have the form of a [the form understood]."

You also need to provide verbs which let the player use the new action. (None are created by default.)

Understand "shift to [a form]" or "turn to/-- [a form]" or "become [a form]" as shapeshifting. 

(The to/— makes this word optional, so “TURN HUMAN” will also work.)

Now we’re ready to set up the situation that you described:

The Bedroom is a room. Some clothes are in the bedroom. The clothes are wearable.
The Top Landing is north from the bedroom. 

Check going from the bedroom:
	if the form of the player is wolf:
		say "No! I can't let the family know my secret!" instead;
	otherwise if the clothes are not worn:
		say "If you think I’m going anywhere naked, think again!" instead.

(This could be done with two separate rules, and it could be done using instead rules instead of check: mainly a matter of taste.)

No doubt you will want to write other general rules concerning such things as public nudity and shapeshifting exhibitions. So here’s a start.

Instead of taking off the clothes when the location is not the bedroom:
	say "This is hardly the place, don't you think?"

Instead of shapeshifting in the presence of a person who is not the player:
	say "No! I can't let anyone see."
5 Likes

Jrb’s response closely resembles the response I was going to give. One thing, however:

The standard rules have a turning action, so if the player says TURN WOLF in a room that contains an object understood as “wolf” the parser might respond with “I don’t think the wolf would like that.”

There should be a rule for handling attempts to turn into something other than one of the allowed forms. With the code given, if the player types TURN INTO BEAR the response is “You can’t see any such thing.” (That’s the sort of thing you usually don’t worry about until after you’ve made sure the rules do what you want.)

Okay, that was two things…

1 Like

I just tried this out, but it isn’t working. It lets the player pass no matter what form they’re in.

Check going from Keira's room:
	If form of the player is fox:
		say "If I go out there as a fox, my parents will freak! I'd better shift into human form first."

Maybe it’s because I’m using Easy Doors? Will I have to do something different to effect how an Easy Door works?

Check rules do not prevent the action by default. You need to tell Inform to cut off the action. In my code this was done with the word “instead”. Alternatively:

Check going from Keira's room:
	If form of the player is fox:
		say "If I go out there as a fox, my parents will freak! I'd better shift into human form first.";
                stop the action.
2 Likes

Good point. (Actully the response is “Nothing obvious happens,” which is even more confusing.) That’s probably a good enough reason not to allow “TURN WOLF” as a command for the new action.

Something like this, perhaps…

Understand "turn to/into" or "switch to/into" or "become" as "[shapeshift]".

Rule for printing a parser error when the latest parser error is the can't see any such thing error and the player's command includes "[shapeshift]":
	say "That is not one of your available forms."
1 Like

Yes, easydoors are always ENTERed, and you can catch that:

Keira's bedroom door is an easydoor in Bedroom. It leads to Hallway.

Check entering Keira's bedroom door:
	If form of the player is fox:
		say "If I go out there as a fox, my parents will freak! I'd better shift into human form first." instead.

ACTIONS is an essential command when testing. It will show you the exact action-name Inform’s parser understood and is attempting from what was typed:

Hub

Alice is here, looking rather lost.

You can also see the first door, a green door, a blue door, an incorrectly-made door, a false door and a red herring door here.

ACTIONS

Actions listing on.

open first door

[opening the first door]

You open the first door.

[opening the first door - succeeded]

go through first door

[entering the first door]

[(1) looking]

Room1

You can see a return door here.

[(1) looking - succeeded]

[entering the first door - succeeded]

3 Likes

Yes, that worked for both cases.

BTW, if the thing understood as “wolf” is an inanimate object the response would be “Nothing obvious happens.” If its an animal or person the response would be “I don’t think the wolf would like that.”

2 Likes

Thanks, guys. Similar question now: if I want her bedroom mirror to have a different description based on what form she’s in, how would I code that in?

The description of bedroom mirror is "You catch a glimpse of yourself looking rather [form of the player]-ey. As good-looking as ever!"

or

The description of bedroom mirror is "[if form of the player is fox]Woohoo! Foxy![otherwise]You look like your usual human self.[end if]"

1 Like

You probably also want to put similar variations in the description of the player (i.e. what is printed when the command is “X ME”).

Or, just change the description of the player and have the mirror “reflect” it:

Instead of examining the bedroom mirror:
      say "You catch a glimpse of yourself in the mirror. [The description of the player]".