Replicating some puzzles from Alone in the Dark

Hello everyone, I hope you are well. :slight_smile:

Both for learning and for fun, I’m trying to “convert” some puzzles from the first Alone in the Dark (1992) into Inform 6.

One of the first puzzles in the game, set in the attic, requires you to move a heavy chest over a trap door, to block the entrance of one of the monsters.

Derceto attic

I created two objects:

  1. a chest
  2. a trapdoor with: static, supporter and StartTimer(self, 5) to spawn the monster within 5 turns

When the chest is moved onto the trap door, the timer should stop preventing the monster from spawning.

My first question is: actually I managed to achieve this by intercepting the PutOn verb with the chest and second == trapdoor, but I wonder if there is a better (more specific) way to check if a given object is above a supporter.

Thank you!

2 Likes
if (parent(chest) == trapdoor) {
2 Likes

I fear that’s static and has to be checked in each_turn. I would go for an event: when the chest is moved onto the trapdoor: stopDaemon or whatever is used.
Away from the computer and not a great coder myself. There’s 98% probability that Stefan is right.

2 Likes

So a supporter becomes a parent of the object it supports… thank you!

I loved Alone in the Dark saga. Go for It.

1 Like

I imagine this in a game scenario where the monster is chasing you and you climb through the trapdoor into the attic to escape from it. Once you enter the attic, you have to close the trapdoor, then put the crate on it to prevent the monster from opening it and catching you. If this is what you had in mind, then:

  • The trapdoor is a normal door that can be opened and closed like any door, except that it can’t be opened when the chest is on it.
  • The trapdoor may initially be open or closed, that’s up to you, but it isn’t initially a supporter.
  • When you close the trapdoor, it becomes a supporter.
  • When you open the trapdoor, it is no longer a supporter.
  • You can’t put the chest on the trapdoor when it is open.
  • You can put the chest on the trapdoor when it is closed.
  • You can open the trapdoor when the chest isn’t on it.
  • You can’t open the trapdoor when the chest is on it.
1 Like

Thank you so much for the inspirational comments.

Actually, to make it simple, I’d stick to the source material: the trapdor is not “accessible”, it only serves to spawn a monster.

Honestly, I’m struggling a bit with the verbs (I’m using Inform 6 in Italian) especially for “put the chest on the trapdoor” (I should “take” the chest first) and “push the chest onto the trapdoor” (the parser stops at “chest”).

As soon as I better understand the correspondence between these Italian and English verbs in Inform 6, other requests for help and suggestions will surely follow.

2 Likes

I can’t help you with the Italian library, but I can give you some pointers with the English library and you may be able to use this with the Italian library.

In Inform 6, the grammar is defined in grammar.h. Open this in a text editor and search for ‘push’ (or whatever it is in Italian). You should find the grammar definition. In the English version, it looks like this:

Verb 'push' 'clear' 'move' 'press' 'shift'
  * noun -> Push
  * noun noun -> PushDir
  * noun 'to' noun -> Transfer;

You can see from this that you can move an object to another using the Transfer action. Open verblib.h and search for TransferSub. Check this to make sure that it does what you want. Indeed, it does. There is a line that says:

if (second has supporter) <<PutOn noun second, actor>>;

This means if you PUSH CHEST TO TRAPDOOR, it will be converted to PUT CHEST ON TRAPDOOR. Perfect. However, we need to expand the grammar to allow for PUSH CHEST ON TRAPDOOR or PUSH CHEST ONTO TRAPDOOR (or the equivalent in Italian). To do this, extend the grammar as follows:

Extend 'push'
  * noun 'on'/'onto' noun -> Transfer;

This code is untested, but it should (hopefully) get you on the right track.

Incidentally, a more concise way of testing whether the chest is on the trapdoor is:

if (chest in trapdoor)

This might sound a bit odd, but it just means (in plain English):

  • if chest is a child of trapdoor
    OR
  • if trapdoor is the parent of chest