issues with the secret doors ext & combination locks

I’m shooting for a secret switch that is revealed when a certain CD is played in a boombox. This works fine. The secret switch is using the combination lock code from the “Safety” example in 17.6 in Writing with Inform.

I want to be able to enter a three digit code number and have a secret door revealed that is unlocked and open leading into the final prize room. I’ve tried modifying the code I’ve pasted below with a few different options, but nothing seems to help. The treasure room door is never revealed even if the proper code is entered. Also I can’t seem to get a “You got the code wrong” message to work. Not even sure how to report an unsuccessful action.

[code]The back wall is a secret switch in the Basement. The treasure room door is a secret door. The treasure room door is unlocked. The treasure room door is south of the Money Room. The treasure room door is north of the Basement.

The description of the back wall is "[if the back wall is revealed]You’ve clearly located the source of the scraping bricks you heard when you played the Buckaroo Banzai soundtrack. Twelve bricks in three rows of four all protrude from the wall. The mortar between and around the bricks is gone. You gingerly reach out and touch one of the bricks in the top row and find that it slides in easily. Pressing another brick in the top row causes both bricks to slide back out immediately after you push it in. Evidently, there’s a right way and a wrong way to press the bricks.

You distinctly remember a puzzle similar to this in an old text adventure game you and Corey played. It took both of you several hours of frustrating tries and retries before you figured out what to do. You had to create a three number combination indicating which brick in each row to press. Once you knew that, you had to say ‘press the bricks with’ the correct combination.

The funny part of this is that both of you raged about the ‘Brick Puzzle’ at every opportunity citing it as an example of cruddy game design. Eventually, any poorly designed anything was immediately labeled as a ‘Brick Puzzle’.[otherwise]You can’t see anything special."

Understand “bricks” as the back wall.

Pressing it with is an action applying to one thing and one number.

Understand “press [something] with [a number]” as pressing it with.

Check pressing it with:
if the noun is not the back wall,
say “[The noun] does not depress.” instead.

After pressing the bricks with 341:
now the treasure room door is revealed;
now the treasure room door is open.

Report pressing it with:
say “This time the bricks stay put. After a moment, an entire section of the brick wall slides noiselessly back on a swivel revealing an unlocked steel door.”

Understand “steel door” as the treasure room door.

The description of the treasure room door is “It’s a burnished, stainless steel door. It’s unlocked.”[/code]

I’ve included the Secret Rooms extension code as well in case you’re unfamiliar with it.

[code]Secret Doors by Andrew Owen begins here.

“Doors and switches that cannot be acted upon until they are
discovered.”

A secret door is a kind of door.
A secret door can be revealed or unrevealed.
A secret door is unrevealed.
A secret door is scenery.
A secret door is closed.

A secret switch is a kind of thing.
A secret switch can be revealed or unrevealed.
A secret switch is unrevealed.
A secret switch is scenery.

To print the you can’t go message:
say “[We] [can’t go] that way.”

To print the you can’t see message:
say “[We] [can’t see] anything special.”

Before going through a secret door which is unrevealed:
print the you can’t go message instead.

Before doing something to a secret door which is unrevealed:
print the you can’t see message instead.

Before doing something when a secret door is the second noun and
the
second noun is unrevealed:
print the you can’t see message instead.

Before doing something to a secret switch which is unrevealed:
print the you can’t see message instead.

Before doing something when a secret switch is the second noun and
the
second noun is unrevealed:
print the you can’t see message instead.

Secret Doors ends here.[/code]

Any help would be appreciated. Thanx in advance.

I’m somewhat new to Inform 7, so my solution here may be a bit kludgy, but it appears to work:



The anybrick is a secret switch. It is in the Basement.

The back wall is a secret switch. It is in the Basement. It is revealed.

The treasure room door is a secret door. The treasure room door is unlocked. The treasure room door is south of the Money Room. The treasure room door is north of the Basement.

The description of the back wall is "
[if the treasure room door is revealed]
A big section of the wall is gone and you see a nice unlocked door here.
[otherwise if the anybrick is revealed]You've clearly located the source of the scraping bricks you heard when you played the Buckaroo Banzai soundtrack. Twelve bricks in three rows of four all protrude from the wall. The mortar between and around the bricks is gone. You gingerly reach out and touch one of the bricks in the top row and find that it slides in easily. Pressing another brick in the top row causes both bricks to slide back out immediately after you push it in.  Evidently, there's a right way and a wrong way to press the bricks. 

You distinctly remember a puzzle similar to this in an old text adventure game you and Corey played. It took both of you several hours of frustrating tries and retries before you figured out what to do. You had to create a three number combination indicating which brick in each row to press. Once you knew that, you had to say 'press the bricks with' the correct combination.

The funny part of this is that both of you raged about the 'Brick Puzzle' at every opportunity citing it as an example of cruddy game design. Eventually, any poorly designed anything was immediately labeled as a 'Brick Puzzle'.[otherwise]You can't see anything special."

Understand "bricks" as the back wall.

Pressing it with is an action applying to one thing and one number. 

Understand "press [something] with [a number]" as pressing it with. 

Check pressing it with: 
	if the noun is not the back wall, 
		say "[The noun] does not depress." instead. 

After pressing the back wall with 341: 
	say "This time the bricks stay put. After a moment, an entire section of the brick wall slides noiselessly back on a swivel revealing an unlocked steel door.";
	now the treasure room door is revealed;
	now the treasure room door is open.

Report pressing it with:
	say "Well, that didn't work... The wall refuses to become a door!";

After touching the back wall:
	now the anybrick is revealed;
	try examining the back wall;

Understand "steel door" as the treasure room door.

The description of the treasure room door is "It's a burnished, stainless steel door. It's unlocked."

This results in the brick wall being a switch, but visible as an object that can be interacted with. The “anybrick” switch is tripped by touching the wall, which reveals that the wall is a bunch of brick-switches. Once the brick-switches are revealed, the player is made to examine the wall, revealing the new description which explains the “press bricks with number” puzzle. Now, the player can

press bricks (or the back wall) with 341
And the door will be revealed. Once the door is revealed, the “wall is gone, there’s a door here” description becomes visible for “examine wall.”

That looks good. There are a few issues with the original code:

You have a rule as “After pressing the bricks with 341,” but the source code name for that thing is “back wall.” The Understand statement allows the player to refer to the back wall with “bricks,” but it doesn’t allow your source code to refer to the back wall as “bricks.”

More importantly, as howtophil pointed out, you don’t have any way of revealing the back wall in your code! It starts out secret so you can’t press it.

Your “After” rule doesn’t print a message, so… no message gets printed.

As for reporting a wrong code, you could use a “Report” rule like howtophil did, or you could use a check:

Check pressing the back wall with: if the number understood is not 341: say "Well, that didn't work... The wall refuses to become a door!" instead.

Thanx for the help!

I do have back wall revealed successfully elsewhere. I should have made that more clear or included that code as well.

OK! Well, then it looks to me like you have three problems… also I misread your code a bit in the previous post.

  1. As I said above, you need to call the back wall “the back wall” in your source code, not “the bricks.”
  2. An “After” rule by default stops the action processing, so you never reach the Report rules. That’s why your message isn’t printing. One way to solve this would be to move the Report text into the After rule; another (and maybe preferable) is to change the After rule into a Carry Out rule (which is what is often used for running the in-world effects of an action), which will allow the Report rule to run.
  3. You want a Check rule to stop the action when the wrong code is entered, or pressing the back wall with a number will always work.

Putting this together, with a room definition and with the back wall starting off revealed, I get this and it works:

[code]Include Secret Doors by Gavin Lambert.

The Basement is a room. “[if the back wall is unrevealed]The basement seems entirely unremarkable[otherwise]You see a mysterious array of bricks on the back wall[end if].”

The back wall is a revealed secret switch in the Basement. The treasure room door is a secret door. The treasure room door is unlocked. The treasure room door is south of the Money Room. The treasure room door is north of the Basement.

The description of the back wall is "[if the back wall is revealed]You’ve clearly located the source of the scraping bricks you heard when you played the Buckaroo Banzai soundtrack. Twelve bricks in three rows of four all protrude from the wall. The mortar between and around the bricks is gone. You gingerly reach out and touch one of the bricks in the top row and find that it slides in easily. Pressing another brick in the top row causes both bricks to slide back out immediately after you push it in. Evidently, there’s a right way and a wrong way to press the bricks.

You distinctly remember a puzzle similar to this in an old text adventure game you and Corey played. It took both of you several hours of frustrating tries and retries before you figured out what to do. You had to create a three number combination indicating which brick in each row to press. Once you knew that, you had to say ‘press the bricks with’ the correct combination.

The funny part of this is that both of you raged about the ‘Brick Puzzle’ at every opportunity citing it as an example of cruddy game design. Eventually, any poorly designed anything was immediately labeled as a ‘Brick Puzzle’.[otherwise]You can’t see anything special."

Understand “bricks” as the back wall.

Pressing it with is an action applying to one thing and one number.

Understand “press [something] with [a number]” as pressing it with.

Check pressing it with:
if the noun is not the back wall,
say “[The noun] does not depress.” instead.

Check pressing the back wall with:
if the number understood is not 341:
say “The bricks pop back out. Apparently that wasn’t the right code.” instead.

Carry out pressing the back wall with 341:
now the treasure room door is revealed;
now the treasure room door is open.

Report pressing it with:
say “This time the bricks stay put. After a moment, an entire section of the brick wall slides noiselessly back on a swivel revealing an unlocked steel door.”

Understand “steel door” as the treasure room door.

The description of the treasure room door is “It’s a burnished, stainless steel door. It’s unlocked.”[/code]

(Also the version of Secret Doors I have is by Gavin Lambert–it’s just like yours except the rule responses are labeled to make them easier to substitute.)

Everything works perfectly! Thank you. I’m definitely weak on making sure all of the processes of my actions (checks, carrying out, and reporting) are legit. That part of Inform doesn’t seem to have gel’d yet in my head.