Sliding an object though a door or wall.

Hiya folks,

Here’s my dilemma: I’m trying to create a slatted wood wall between two areas. The wall needs to be unbreakable, but with slats wide enough to slide an object through (a teleporter exit) to allow the player to teleport to the other side.

As a rank beginner, I’m totally lost how to do this, and everything I’ve tried for the last 6 hours has given me nothing but an error.

Any code examples would be very helpful.

Thanks!

Depends on how you want it to work – can the player see through the wall? What commands can they enter to solve the puzzle?

If you want to define a new command like “push exit through wall” then you probably want to define a new action:

Pushing it through is an action applying to two things. Understand "push [something] through [something]" as pushing it through. Understand "slide [something] through [something]" as pushing it through. 

which you then have to write new rules for. The rules will probably involve moving the noun (the first thing in the command) to the right room if the player is pushing something through the wall, and printing a message if you’re trying to push something through something else.

Here’s an implementation:

[code]Verandah is a room. “There is a slatted wall to the north.” The slatted wall is scenery in the Verandah. The description of the slatted wall is “It has narrow wooden slats, wide enough to slide a small object through.”

Gazebo is a room. “Here’s everything else!”

The player carries a teleporter device and a teleporter exit.
The description of the teleporter device is “It has a little button that, when pressed, will teleport you to the exit.” Understand “button” as the teleporter.

Instead of pushing the teleporter device:
if the location of the teleporter exit is not the location of the player:
say “You teleport with a zap!”;
now the player carries the teleporter device; [just so they can’t trap themselves by dropping the teleporter and pushing the button]
move the player to the location of the teleporter exit;
otherwise:
say “You push the button but you’re already where the teleporter exit is.”

The description of the teleporter exit is “A tiny but powerful whatchamagig. The teleporter will teleport you to the exit when the button is pressed.”

A thing can be small or large. A thing is usually large. The teleporter exit is small.

Pushing it through is an action applying to two things. Understand “push [something] through [something]” as pushing it through. Understand “slide [something] through [something]” as pushing it through.

Instead of pushing something through something when the second noun is not the slatted wall:
say “You can’t push things through [the second noun].”

Instead of pushing something through the slatted wall:
if the noun is small:
say “[The noun] slides through the slatted wall!”;
now the noun is in the Gazebo;
otherwise:
say “[The noun] is too big to fit through the slats.”

Instead of pushing something to the north in the Verandah:
try pushing the noun through the slatted wall.[/code]

The last line means that that the command “push exit north” will be understood–pushing it to is a built-in action, which usually lets you move yourself and an object to another room, but in this case it seems friendly to allow it as a way for the player to push something through the wall.

I didn’t put a slatted wall in the Gazebo out of laziness, but you could make another one. (You could make the wall a door, in which case it’d be in both rooms, or you could make two different objects in the two rooms with the printed name “slatted wall”; then you could write different rules for sliding things back and forth between them.)

If you want the player to be able to see through the wall it’s more complicated. You could look at §3.6 of the Recipe Book (“Windows”) for some ideas; the most useful one might be example 217, “Dinner Is Served,” specifically the part where it says “The rest is window dressing” which gives a way to describe the other side of a window. The rest of that example gives you a way to reach through the window, which you probably don’t want.