The Quill: overriding movements
I often recieve questions from people seeking advice when writing their own interactive fiction for classic computers. The world needs more adventures, so I’m always happy to help. The newest request from Paul J. Beel now finally convinced me to start my own collection of professional tips and tricks for the amazing adventure writers by Gilsoft / Infinite Imaginations, which you can download from this page. For Quill and PAWs, I will be from now on sharing random knowlege. DAAD will be extensively covered in a series of articles that will guide you on your path from apprentice to wizard. Today’s tutorial is for Quill, the code though can be easily adapted to PAWs and DAAD since these systems support backwards compatibility.
Scenario: If I have a room that I want a beast to be in and you have to do something to defeat this beast before you can go through the two exits ahead. How would I do that? Also the player should have the option to go back through the door he just came from.
Scenario clear? Let’s first create a nice atmosphere.
It’s true that they say “all roads lead to Rome”, but I will show you how I would implement it. We define a few assumptions first for this particular case.
- The room where this is happening is room 1.
- “The beast” is an object you defined, let’s say it’s object 1.
- You can either trigger the creation of the beast while progressing in the game or you give it room 1 as start location. We assume anyway the beast object is in the room when the player enters it.
- The doors blocked by the beast are in directions NE and NW.
- The door you can “flee” through anytime is in the SOUTH.
- The movement tables are properly set up, so from room 1 you can go SOUTH, but you cannot got NE or NW.
- You defined a meaningful message what happens when you try to pass through the exits NE or NW while the beast is in the room. See the example below (message 3).
Here is how the object table with the beast could look like:
What you can do with Quill’s CondActs is overriding the movements. Please enter the following statements in the event table, only the first four entries are relevant:
I will translate the statements to a proper English: If you want to go NE or NW from room 1 and the beast is there, tell the player he can’t go in that direction (message 3) and then don’t process any further. Important is the DONE statement at the end of the CondAct, forcing the interpreter to not process any further after the override was processed. Also important is what you don’t see. Since the player always can go back SOUTH, we defined no CondAct for it as no behavior needs to be altered.
Please note that this method is easily adaptable to other scenarios. Imagine that the beast object now is a locked door. As long as the door is locked, you can’t go NORTH.
Now let’s do something funny and kill the beast. That’s what adventures are about, right? In this tutorial the action gets triggered when you carry the sword (object 2) and you either USE SWORD or KILL BEAST in the room where the beast is (room 1).
You can download the database containing the code for this tutorial from here.