prevent player from using object inside vehicle

#1

I have a clown car in my game.

Inside the car is a honk-honk horn.

I want to prevent the player from being able to honk it when they are not inside the car. - I think I need ‘scope’ for this but struggling to get it to work.

I’d also like to be able to control what contents of the car can be seen from the outside.

Thank you!

0 Likes

(matt w) #2

For the first part, you can use a rule for reaching inside:

    Circus is a room.

    A clown car is a vehicle in Circus.

    A honk-honk horn is in the clown car. 

    Before taking the horn: say "You can't remove that from the vehicle." instead.

    Instead of squeezing the horn: say "HONK[paragraph break]".

    Rule for reaching inside the clown car: 
    	say "You'll have to get into the clown car.";
    	deny access.

(I’d say you might want to have the horn be part of the car, but then the Rule for Reaching Inside wouldn’t work.)

For the second one, you can begin by looking at "omit contents in listing from §18.10 of writing with inform:

Circus is a room.

A clown car is a vehicle in Circus.

A honk-honk horn is inside the clown car. 

A matchbook is inside the clown car.

Before taking the horn: say "You can't remove that from the vehicle." instead.

Instead of squeezing the horn: say "HONK[paragraph break]".

Rule for reaching inside the clown car: 
	say "You'll have to get into the clown car.";
	deny access.
			
After printing the name of the clown car while looking when the clown car does not enclose the player: 
	say " (in which you can see a honk-honk horn, though anything else that may be inside is concealed from view)";
	omit contents in listing.

(There are other cases to take care of here but I have to go now!)

0 Likes

#3

Perfect. Thank you.

0 Likes

(matt w) #4

I should mention that the code doesn’t prevent you from examining the matchbook from outside the clown car. Maybe using a rule for deciding the concealed possessions of the car (§18.9) is what’s called for there.

0 Likes