I7 making sitting, standing on, and lying down different

Hi,
I’m trying to write some code that will mean that the player will be able to sit on, lie on, or stand on the bed. I would also like the player to start the game on the bed. This is my first Inform game, so I am not very experienced with the coding.

This is my code for the room:

[code]Bedroom is a room. The bedroom is dark. A bed is here. It is fixed in place. It is a supporter. It is enterable. The light switch is a switched off device in the Bedroom. It is fixed in place. “Light is pouring from a large, old-fashioned lamp beside the bed. As you look around the room, you wonder why you chose it. The room is small, cramped and smells of rotting wood. Unfortunately the rest of the house is like this. Which is probably why you got it so cheap.”.
Carry out switching off the light switch: now the Bedroom is dark.
Carry out switching on the light switch: now the Bedroom is lighted.
Understand “flip [something switched off]” as switching on. Understand “flip [something switched on]” as switching off. Understand “flip [something]” as switching on.
After deciding the scope of the player when the location is the Bedroom:
place the light switch in scope.

The solid oak door is south of the landing and north of the bedroom. The solid oak door is a door. The landing is lighted.
Understand the commands “stand” and “sit” and “lie” as something new.

Understand “sit on [bed]” as sitting on.
Understand “lie on/down [bed]” as lying on.
Understand “stand on [bed]” as standing on.

Sitting on is an action applying to one thing.
Lying on is an action applying to one thing.
Standing on is an action applying to one thing.
After sitting on bed, say “You are sitting down on the bed. The only problem is that several of the springs have broken, and the few springs that were fine have now also broken thanks to the amount of pressure placed on the (now broken) springs.”. now you are on the bed.
After lying on bed, say “You are now lying down. Although this is very comfortable, you are hardly going to save the world by lying down. You then realise that this, and decide to get out of the bed”.
After standing on bed, say “Your feet go straight through to the floor. There is now a gaping hole in the bed. Not really any use now, is it!”. now you are on the bed.
Instead of opening the door when you are on the bed, say “How am I going to reach the door. Getting up might help.”.[/code]
Thanks

To have the player start in bed, simply add “The player is on the bed.”

The lines

will not move the player to the bed. You need a semicolon instead of a full stop between the different things you want a rule to do.
Write:

After standing on bed: say "Your feet go straight through to the floor. There is now a gaping hole in the bed. Not really any use now, is it!"; now the player is on the bed.
Mind the colon and the semicolon!
(The same thing of course goes for the after sitting on rule …)

As it stands the line “now the player is on the bed” is what makes inform print that mysterious comment inside parentheses: “(on the bed is now you)”.

I also think you probably shouldn’t redefine the command “stand”. That’s a standard command for getting off beds in IF, and players will try to use it thus. It’s better if you understand “stand on” as something new and keep “stand” as it is.

Good luck with your game!

The neat-freak way to get this done, which Inform 7 makes surprisingly “easy,” is to abolish regular I7 supporters entirely (Or use them for one of the relations you want, e.g. standing on) and then add new relations for lying on and sitting on things. I’m not really sure of everything needed to make this work, as that essentially means rebuilding a small chunk of the standard world model.

You might want to check out Emily Short’s “Postures” extension.

inform7.com/extensions/Emily%20S … index.html

It worked but now I get the room description repeated which I don’t want.

Here is the code:

After sitting on bed: Now the player is on the bed; say "You are sitting down on the bed. The only problem is that several of the springs have broken, and the few springs that were fine have now also broken thanks to the amount of pressure placed on the (now broken) springs.".

Use the phrase “move the player to the bed, without printing a room description” instead of “now the player is on the bed”:

After sitting on bed: move the player to the bed, without printing a room description; say "You are sitting down on the bed. The only problem is that several of the springs have broken, and the few springs that were fine have now also broken thanks to the amount of pressure placed on the (now broken) springs.".

I thought ‘move’ instead of ‘now’ is deprecated? Was I wrong? I’m wondering if there is a way to achieve this effect without using a deprecated command.

Paul.

You’re wrong. :slight_smile: It’s not deprecated.

Paul, you might have been thinking of one of the ‘change’ phrases. There were also a couple of move phrases related to rule ordering.

Ah that sounds likely. Thanks guys!

Thanks everyone. Now I know what to do.