Locked things?

Parmenion
13 Aug 2003, 14:10
Thats what i have...
A trapdoor that is leading to the basement, but the exit is not created yet.
Next is a key. When i use it on the trapdoor an exit down is created.
Now i want to use the key to lock that trapdoor again. But the exit still exist.
How can i remove the down exit? Or is my approch completly wrong? :D

MfG
Parmenion

Anonymous
13 Aug 2003, 15:24
Yea, I cannot find a way to lock (i.e., remove an access to/from a room from within QDK. Is relocking really important though? If you have someone chasing you, I suppose it is. Also, you could say the exit is locked and require the player to have a key to go through it.

Chuck Smith

debsw2003
13 Aug 2003, 16:17
There doesn’t seem to be anyway to remove an exit, but there is a way to do what you want. It may seem a little bit convoluted but it works. What you need to do is create two identical rooms with identical trapdoors, and two identical keys. Try this code.



' Created with QDK Pro 3.12

define game <>
asl-version <311>
start <room1>
game info <Created with QDK Pro 3.12>
end define

define synonyms
end define

define room <inventory>

define object <key1>
alias <key>
use on <trapdoor1>
end define

end define

define room <storage>

define object <key2>
alias <key>
use on <trapdoor2>
end define

end define

define room <room1>
alias <room>
prefix <a>

define object <trapdoor1>
alias <trap door>
use <key1> {
msg <You use the key to unlock the trapdoor.>
goto <room2>
move <key1; storage>
move <key2; inventory>
}
end define

end define

define room <room2>
alias <room>
prefix <a>
south <basement>

define object <trapdoor2>
alias <trap door>
use <key2> {
msg <You use the key to lock the trapdoor. >
goto <room1>
move <key2; storage>
move <key1; inventory>
}
end define

end define

define room <basement>
north <room2>
end define

define text <intro>

end define

define text <win>

end define

define text <lose>

end define

Anonymous
13 Aug 2003, 21:43
Hi all

As Debsw2003 says, although you can't actually remove an exit in Quest, there are alternative ways of getting the same effect with a bit of lateral thought.

Like Debsw, I'd go for the dual room, dual trapdoor solution. The only bugbear is that you have to make the manipulation of the rooms invisible to the player or it betrays the 'trick' used and looks really naff!

I've used a single key and a flag to control the trapdoor exit capability, and put the whole thing into a little demo so you can see it in a game-like scenario.

It might not be actually opening and closing exits, but it LOOKS like it is to the player, and that's what matters.

Here's my code. N.B. Needs Quest 3.5 beta to run!


define game <Trapdoor demo>
asl-version <350>
game version <1.0>
game author <MaDbRiT>
game copyright <© 2003>
game info <Just an example>
start <hall>
startscript {
flag on <trapdoor_locked>
}
end define

define room <hall>
look <a hallway>
prefix <the>
south {
if flag <trapdoor_locked> then goto <pantry_1>
else goto pantry_2
}

define object <key>
look <old and rusty, but servicable.>
prefix <a>
take
end define

end define

define room <pantry_1>
alias <pantry>
prefix <the>
look <an old fashioned pantry. There is a trapdoor in the floor.>
north <hall>

define object <trapdoor_locked>
look <a heavy wooden trapdoor, securely fastened with a big rusty lock.>
alias <trapdoor>
prefix <a>
use <key> {
msg <The trapdoor unlocks with surprising ease and drops open revealing a flight of steps leading down into darkness.>
outputoff
goto <pantry_2>
outputon
}
end define

end define

define room <pantry_2>
alias <pantry>
prefix <the>
look <an old fashioned pantry. There is a trapdoor in the floor.>
down <basement>
north <hall>

define object <trapdoor_unlocked>
look <a heavy wooden trapdoor. It is unlocked and hangs open.>
alias <trapdoor>
prefix <a>
use <key> {
msg <The trapdoor locks securely, effectively sealing off the stairs down.>
outputoff
goto <pantry_1>
outputon
}
end define

end define

define room <basement>
look <a grim basement>
prefix <the>
up <pantry_2>
end define

define text <intro>
Enter intro text here
end define

define text <win>
Enter win text here
end define

define text <lose>
Enter lose text here
end define



I think all of this can be accomplished from QDK with no problem.

Al

MaDbRiT
13 Aug 2003, 21:48
ARGH!

In my demo above, the board software has 'word-wrapped' the line of code beginning:

"msg <The trapdoor unlocks with surprising ease "

the whole line needs to be unbroken, or broken with an underscore or Quest will complain.

Al

Parmenion
14 Aug 2003, 06:10
Thanks for the help. I used MaDbRiT example and it works fine.

MfG
Parmenion