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.
I created two objects:
a chest
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.
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.
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.
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.
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:
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: