I7: Different positions inside a vehicle

Hi,

in one of my projects I have a car which is enterable by the player (currently it’s a “vehicle” not a simple container). What I’d like to do, is to implement the different positions the car has (drivers seat, passengers seat, backseat). The player should be able (when inside the car) to climb from one seat to another and (when outside) enter the car from the corresponding doors. Each positions should have it’s own descriptions, items etc.

Any hints on how I should approach this problem?

Jens

Jens,
Just having a quick go at a vehicle with multiple seats, etc. This has only been tested in isolation.

[code]Expressway is a room. The Jeep is a vehicle in Expressway.

A seat is a kind of container. The carrying capacity of a seat is usually one. A seat is usually fixed in place, lockable, enterable, closed, transparent, and openable. A lid is a kind of thing. A lid is part of every seat. A driver seat is a kind of seat. It is part of every vehicle. A passenger seat is a kind of seat. It is part of every vehicle. A back seat is a kind of seat. It is part of every vehicle.

Understand “driver/drivers/driver’s” or “seat” as a driver seat. Understand “driver/drivers/driver’s” or “door” as a driver seat’s lid. Understand “passenger/passengers/passenger’s” or “seat” as a passenger seat. Understand “passenger/passengers/passenger’s” or “door” as a passenger seat’s lid. Understand “back” or “seat” or “backseat” as a back seat. Understand “back” or “door” as a passenger seat’s lid. [/code]
This gets us a vehicle with three enterable seats, which are containers, with lids that represent car doors, and Inform should understand references to seats and doors.

[code]Before opening a lid which is part of a seat (called the item):
try opening the item instead.

Before closing a lid which is part of a seat (called the item):
try closing the item instead.

Report opening a seat which is part of a vehicle:
let txtNoun be “[the noun]”;
replace the text “seat” in txtNoun with “door”;
say “[We] [open] [txtNoun].”;
stop the action.

Report closing a seat which is part of a vehicle:
let txtNoun be “[the noun]”;
replace the text “seat” in txtNoun with “door”;
say “[We] [open] [txtNoun].”;
stop the action.[/code]
These rules provide the door opening and closing functionality, and do some text replacement so Inform doesn’t report “You open the Jeep’s driver seat.”

The last bit needed is a rule to let you move from one seat to another while you’re inside the vehicle:

instead of entering a seat while the actor is in a seat: say "[We] move to [the noun]."; move the actor to the noun.
More would be needed to clean up the process. For example, moving from the driver’s seat to the passenger’s seat works fine, but then you get:

And, some code will be needed to respond differently when the player attempts to get in the driver’s seat when they are already sitting in the driver’s seat.

Maybe make the seats enterable supporters in the car and automatically move the player to one of them when they enter the car? You’d also have to make sure that the player can’t exit the seat and remain in the car.

One design decision you have to make if you want to have the player enter the car from different doors: When the driver’s side door and passenger’s door are both open and the player types “ENTER CAR,” what happens?

Thanks for the input guys. I will give it a try on the weekend and report back …

Jens