Car ignition

I was trying to make a car that has to use a key to start an ignition to be able to drive to other places.

I tried a couple of different things but none seemed to work yet. if it can I would like to be able to make it require the keys to be able to use the car.

So for starters, check 3:16 about vehicles in the documentation. http://inform7.com/book/WI_3_16.html

Then check recipe book 8:1 example “No Relation” for a vehicle that has an ignition that can be switched on and off.
http://inform7.com/book/RB_8_1.html

You can then create a check rule to check for an object before switching on the ignition.

Check switching on the ignition:
     if the player does not carry the car keys:
          say "The car needs a key to start. You'll need the car keys before you can drive anywhere." instead.

You could, of course get more complicated and model a fixed-in-place container called a keyhole or receptacle that will only allow insertion of the key, then require the player to TURN the key, but in most cases the less fiddly detail you create for the player in the name of narrative the better. Even without modeling this, you could redirect natural actions the player might try like:

Check inserting the keys into the car:
     if the player is not in the car:
          try entering the car.

Check inserting the keys into the car:
     if the player is in the car:
          try switching on the ignition instead.

Check inserting the keys into the ignition:
     if the player is in the car:
          try switching on the ignition instead.
3 Likes

Hanon’s solution is a good one, but an alternative, if you want it:

A car is a vehicle in the Driveway. The player carries some keys.

Instead of going by car when the player is not carrying the keys: say "You'd need the key to do that."

With this model, if the player has the keys, they can drive the car, with all the fiddly details of putting it in the keyhole, turning it, turning off the parking brake, etc abstracted away.

You can even extend this to other NPCs if you want:

Instead of an actor going by car when the actor is not carrying the keys:
    if the actor is the player, say "You'd need the keys for that.";
    stop the action.
3 Likes

+1 @Draconis

Removing superfluous fiddly details is a very good thing in parser narratives.

It’s reasonable for a player to assume they need car keys to drive and for the author to advance the story narratively when the player meets the requirements. It’s also reasonable to assume the character understands they are inherently performing all the fiddly details of starting and driving a car (inserting the keys, turning the keys, shifting gears, etc) without bogging your story down with them. Because the player probably knows how to drive - they likely will not know exactly how the author wants them to drive via a parser interface.

It also saves a lot of coding and debugging and testing on those fiddly details.

It’s one thing if you’re simulating unusual and arcane machinery that the player should need to experiment with, it’s another if the player gets stuck on something they know how to do easily in real life.

Guess the verb is not fun. If the player needs to brush their teeth to advance the story, it’s much easier to just narrate that instead of going through the simulationist backflips of implementing a brush, bristles to support toothpaste, a mouth full of teeth, a toothpaste tube with a finite level of paste and a removable cap that has to TURN and/or UNSCREW, and verbs BRUSH UP, BRUSH DOWN, RINSE, SPIT…

7 Likes

Yes, and it may also be a good idea to catch things like “put key in ignition”, and respond that the player merely has to say what direction to drive in.

1 Like