ADRIFT Forum


The place to discuss the ADRIFT Interactive Fiction toolkit

Intermediate: Door Examples - With locking mechanism!

This forum is the place to discuss the older ADRIFT versions 3.9 and 4.0.

Please refer to the ADRIFT 4 Manual for more information.

Postby Woodfish » Thu Jul 04, 2002 3:31 pm

<span style='font-size:19pt;line-height:100%'>Door Examples</span>

<span style='font-size:17pt;line-height:100%'>1. "Door with a locking mechanism" by Woodfish;</span>



This is a guide on how to create a door between two rooms, using v3.90. [Doors are incorprated into v4, so this guide doesn't apply]

[MWC: Message when completed
ED: Else display ]

First of all, you will need to create a variable called 'doorst'. Have the initial value be 0. We will be having 0 stand for closed, and 1 stand for open. (alternativley, if you wish to have the door open to start with, have 'doorst' start at 1.)

Make another variable, called 'lockst' and set this to 0, for locked, or 1 for locked to start with.

Then, delve into your ALR (see MileOuts turorial for help on ALRs), and make four new lines, saying:
doorst0|closed
doorst1|open
lockst0|locked
lockst1|unlocked

First, create an object "key". This should be dynamic, and very small. Put whatever you want in the description.

Next, create an object called "a door". Have this object as static, and position it in the two rooms you want the door to lead to. You do not need to make this open or close. In the description, write something like "The door is rough and wooden" or something, followed by "The door is currently doorst%doorst%."

Now that is all the objects and variables done. Now, we have to do the tasks.

The first task should be "open door" (remember all the other ways of phrasing it too), and have the message when completed be: "You open the door". The actions should be 'Change variable doorst to 1" (This is changing the door to open). The restrictions should be: "Doorst must be equal to 0", with the Else Display message being "The door is already open!" The other restriction should be "Lockst must be equal to 1", with the Else Display message being "The door is currently locked."

The next task should be called "close door", with the MWC being: "You close the door". The actions should be "Change variable doorst to 0", and the restrictions should be "Doorst must be equal to 1", ED: "The door is already closed!"

That takes care of the actual door, now to use the locking mechanism, have a task "unlock door", completable in both the rooms that the door is in, with a MWC something like "You unlock the door", with restrictions "Key must be held by Player" (ED: You do not have anything to unlcok it with"), and "Lockst must be equal to 0" (ED: "The door is already unlocked."), and an action "Change lockst to 1".

Do the opposite to that task, but with command "lock door" (obiously still requiring a key), and there you go! A brand new door!

Hope this helps,
Woodfish



Edited By MileOut on 08 July 2002 at 13:13
Woodfish
User avatar
Woodfish
Moderator
 
Posts: 2035
Joined: Sun Jun 23, 2002 12:19 pm
Location: England

Return to ADRIFT 3.9 and 4.0

Who is online

Users browsing this forum: No registered users and 4 guests