Container problem in Quest 4.1.2.
Tomsa
20 Mar 2010, 10:58So...I wanted to make a chest that is unlockable/lockable with a key, but stumbeled into a problem. It goes like this...
When setting up the container, run script when open - if chest property of locked - print "it is locked", else print "you open the chest using the key" + open object (chest)
When setting up use options for key - use on chest - give chest property of unlocked
However, when I unlock the chest and open it, the contents are not there!
I know I am missing some simple detail here, but what is it?
PS I do not know ASL
When setting up the container, run script when open - if chest property of locked - print "it is locked", else print "you open the chest using the key" + open object (chest)
When setting up use options for key - use on chest - give chest property of unlocked
However, when I unlock the chest and open it, the contents are not there!
I know I am missing some simple detail here, but what is it?
PS I do not know ASL
Alex
20 Mar 2010, 18:22I made a test file and it worked for me - please can you send me your ASL file and I'll see what's going on.
Tomsa
20 Mar 2010, 19:35Here is the ASL snippet:
define object <desk>
alt <drawer>
look <It is a fine mahogany desk of excellent craftmanship. The middle drawer is adorned with a brass ring.>
prefix <a>
displaytype <Object>
article <it>
gender <it>
container
open {
if property <desk; unlocked> then {
msg <|s00You open the desk using the key.>
open <desk> } else msg <The desk is locked.>
}
close
add
remove
end define
define object <book>
look <A leather-bound booklet small enough to fit in a vest pocket.>
take <You pick up the small book and put it in your vest pocket.>
prefix <a>
displaytype <Object>
article <it>
gender <it>
parent <desk>
action <read> do <chapters>
end define
define object <matches>
look <A box of extra long matches.>
take
displaytype <Object>
article <it>
gender <it>
parent <desk>
use on <firewood> {
if property <kiln; ready to light> then {
msg <You strike a match and set the stacked wood on fire, using some leftover paper as igniter. Soon the kiln emits a warm glow, which means it is ready for use.>
flag on <kiln ready for use>
hide <firewood> } else msg <You need to put the firewood into the kiln before setting it on fire. After all, you do not want to torch the place.>
}
end define
define object <painting>
look <The classic "Old fisherman with a pipe" gives your office a grandmotherly feel. As you watch the painting while listening to the waves breaking puts you at ease before the daunting task ahead of you. It hangs slightly askew.>
prefix <a>
displaytype <Object>
article <it>
gender <it>
invisible
properties <move>
action <move> {
msg <As you unhook the painting and put it gently on the floor, you reveal a small key hanging on the crooked nail upon which the painting had hung.>
show <key>
}
end define
define object <key>
alias <drawer key>
look <It is a small key of rusted iron.>
take <You take the key from the crooked nail on the wall and slip it into your pocket.>
prefix <a>
displaytype <Object>
article <it>
gender <it>
hidden
use on <desk> {
msg <As you put the key into the keyhole of the desk drawer and turn, you hear a loud clicking noise.>
property <desk; unlocked>
}
end define
end define
In other words, I move the painting in order to get the hidden key, which I use on the locked desk to open it, revealing its contents - the book and the matches.
define object <desk>
alt <drawer>
look <It is a fine mahogany desk of excellent craftmanship. The middle drawer is adorned with a brass ring.>
prefix <a>
displaytype <Object>
article <it>
gender <it>
container
open {
if property <desk; unlocked> then {
msg <|s00You open the desk using the key.>
open <desk> } else msg <The desk is locked.>
}
close
add
remove
end define
define object <book>
look <A leather-bound booklet small enough to fit in a vest pocket.>
take <You pick up the small book and put it in your vest pocket.>
prefix <a>
displaytype <Object>
article <it>
gender <it>
parent <desk>
action <read> do <chapters>
end define
define object <matches>
look <A box of extra long matches.>
take
displaytype <Object>
article <it>
gender <it>
parent <desk>
use on <firewood> {
if property <kiln; ready to light> then {
msg <You strike a match and set the stacked wood on fire, using some leftover paper as igniter. Soon the kiln emits a warm glow, which means it is ready for use.>
flag on <kiln ready for use>
hide <firewood> } else msg <You need to put the firewood into the kiln before setting it on fire. After all, you do not want to torch the place.>
}
end define
define object <painting>
look <The classic "Old fisherman with a pipe" gives your office a grandmotherly feel. As you watch the painting while listening to the waves breaking puts you at ease before the daunting task ahead of you. It hangs slightly askew.>
prefix <a>
displaytype <Object>
article <it>
gender <it>
invisible
properties <move>
action <move> {
msg <As you unhook the painting and put it gently on the floor, you reveal a small key hanging on the crooked nail upon which the painting had hung.>
show <key>
}
end define
define object <key>
alias <drawer key>
look <It is a small key of rusted iron.>
take <You take the key from the crooked nail on the wall and slip it into your pocket.>
prefix <a>
displaytype <Object>
article <it>
gender <it>
hidden
use on <desk> {
msg <As you put the key into the keyhole of the desk drawer and turn, you hear a loud clicking noise.>
property <desk; unlocked>
}
end define
end define
In other words, I move the painting in order to get the hidden key, which I use on the locked desk to open it, revealing its contents - the book and the matches.
Alex
20 Mar 2010, 19:57I get this output, which looks fine to me:
Is this not the behaviour you expect?
> move painting
As you unhook the painting and put it gently on the floor, you reveal a small key hanging on the crooked nail upon which the painting had hung.
> take key
You take the key from the crooked nail on the wall and slip it into your pocket.
> use key on desk
As you put the key into the keyhole of the desk drawer and turn, you hear a loud clicking noise.
> open desk
You open the desk using the key.
> x desk
It is a fine mahogany desk of excellent craftmanship. The middle drawer is adorned with a brass ring.
It contains a book and matches.
Is this not the behaviour you expect?
Tomsa
21 Mar 2010, 16:10I WANT it to behave that way, however, when I type "open the desk" after using the key on it, it does not display its contents (book and matches) even though the desk is their parent object.
I have used an if statement in container properties that goes like "if desk has the property unlocked, then print 'You open the desk drawer' Open 'desk'. Else print ' The desk is locked'.
The use details of the key is to modify the property of the desk to unlocked.
Everything seems to be in order, exept that I cannot see the contents of the desk when I finally open it. Is there something wrong in my ASL?
I have used an if statement in container properties that goes like "if desk has the property unlocked, then print 'You open the desk drawer' Open 'desk'. Else print ' The desk is locked'.
The use details of the key is to modify the property of the desk to unlocked.
Everything seems to be in order, exept that I cannot see the contents of the desk when I finally open it. Is there something wrong in my ASL?
Alex
21 Mar 2010, 16:46I copied your ASL code and got the output above, so the ASL code you pasted is working at least. What exact output do you get? If you could attach the entire ASL file that would also help.
Tomsa
21 Mar 2010, 22:30I played around with the chest.asl you sent me and...problem solved! I did exactly the same as I did before, with the minor change that I edited the use options for the desk instead of the key (key being the object that you could use on the desk), and I also dropped the whole changing property thing. In my eyes, the same thing but different results...but still, I solved the problem. Now I can finally sleep. Expect a new game for textadventures.co.uk soon!