Trouble With Locked Containers

up2ng
01 Dec 2014, 10:46
Hello everyone,

I am brand new to this as I have just downloaded Quest 5.5.1 (build 5.5.5328.26623) just this weekend! (I have an old Windows XP machine.) I have been working my way through the excellent tutorial and have run into some wierd behavior when trying to implement the locked containers.

The tutorial suggests that we create a box in the Lounge and place the defibrillator inside of it. We make it so that this is a locked box which can be unlocked with a key that exists as an inventory item in the Kitchen.

When running the game, we are supposed to try to open the box, which is supposed to fail. Then, we try to unlock the box, which is supposed to fail. Then, we go to the kitchen, pick up the key, come back to the Lounge and try to open the box and that works (unlocking automatically), revealing the defibrillator.

However, when I run my game, I attempt to open the box ... and it works immediately! The key is not showing in my inventory, and yes, the checkmark for "Locked" is checked within the box object.

Since I am so new with all of this I did not want to just jump straight over and report a bug when I very well could be just doing something dumb so I thought I'd ask here first.

Interestingly, my screen in my version of Quest showed an extra field in the "Locking" section of my box object, which is "Number of keys to unlock container:" with a widget that can take a number from 0 to 5 and a corresponding number of Key fields pop up where we can assign the Key object that is used to unlock the container. In the tutorial (I believe was written for Quest 5.3?), this widget is absent and there is simply one Key field for the author to set. I wonder if this "multiple keys" business is a very recent change to Quest which broke the functionality?

Furthermore, if I increase my number of keys to 2, some interesting things happen. I set Key to my key object, and then I set Key 2 to my packet of rice object (another "takeable" object, residing inside the Kitchen's cupboard, that had already been created earlier in the tutorial). Now when I try to open the box, it fails! Now I go to the kitchen, pick up the key, come back to the Lounge and try again to open the box, and it still fails! So, I go back to the kitchen and ALSO pick up the packet of rice (both are now in inventory), and return to the Lounge, open the box, and success! It opens. Which is what I assume is correct functionality when assigning 2 keys (although I'm not sure).

But here is where it gets more strange -- if instead I just go to the kitchen and take the packet of rice (and NOT the key) so that only this one object is in my inventory, and now I go back to the lounge and try to open the box ... it works! The box opens using ONLY key 2, or with key 1 AND key 2, but NOT with ONLY key 1.

I think what's happening is that Key 1 is sort of getting ignored.

Anyways, without really knowing what I'm doing, I did some poking around and ended up looking at a library function called AllKeysAvailable. There's a for loop in there that I think might be broken.

Then again, I might be just doing something dumb! Anyone else having this problem?

HegemonKhan
01 Dec 2014, 11:35
ya, most of the resources are for older versions of quest, (you too got an old pc still with win XP, eh, hehe), but here's some links that may be of help to you:

viewtopic.php?t=3348 (my own noobie thread when I started quest 2-3 years ago, I too had trouble with the tutorial)
http://docs.textadventures.co.uk/quest/
http://docs.textadventures.co.uk/quest/ ... notes.html
http://docs.textadventures.co.uk/quest/tutorial/
http://docs.textadventures.co.uk/quest/guides/
http://docs.textadventures.co.uk/quest/ ... gexit.html
http://docs.textadventures.co.uk/quest/ ... exits.html
viewforum.php?f=18

enjoy :D

jaynabonne
01 Dec 2014, 12:20
You not only have run into a bug, but you've found where the problem lies. This thread should have a workaround:

viewtopic.php?f=10&t=4526&p=29731

Marzipan
01 Dec 2014, 15:49
Makes me think there ought to be a note somewhere on that tutorial page about it not working, if not a complete rewrite.

I'm glad I just read the thing instead of going along with it step by step, if I'd hit a bug in the newbie guide of all places I would have gotten a bad impression of the program right out of the gate.

Silver
01 Dec 2014, 19:39
I don't think it used to be a bug...

up2ng
02 Dec 2014, 02:32
Thanks very much for your help everyone! I had looked for old threads before posting but did not see that one from August that you referenced. Indeed, that was the same bug found in that thread and the workaround is pretty much the same as what I came up with.

I ended up actually creating a new attribute in my box object called key1 and I just "hardcoded" its value to be the same object as the key attribute held, which was called key (could have been silver key or whatever). I was trying pretty hard to figure out how to set the value of key1to something like this.key or even box.key or something (so that if the key object was changed in the pulldown it wouldn't break the functionality if I forgot to also manually change the key1 attribute) but had no luck with that. I did not even realize that I could have just actually renamed the key to key1 as suggested in the workaround in that other thread. I think that's a cleaner solution. Of course, if the developers of Quest make the easy fix to their for loop in that AllKeysAvailable function in their next software release, our game might break if we actually renamed the attribute right?

Anyway, thanks again! This is fun stuff so far.

Pertex
02 Dec 2014, 08:03
You can just add another key and use the same key object twice, then it should work

Key: key
Key2: key