TypeLib Container Question
Alf
31 Dec 2003, 12:50I create a container object and a containable object. I can pick up and take the container (a backpack), or I can pick up and take the containable object (a seashell). However, I can't put the seashell into the backpack. If I start the game with the shell in the backpack, I can take it out. But, I can't put it back in.
Extremely new to this, so my apologies if it's a dumb question.
Thanks!
Alf
Anonymous
31 Dec 2003, 15:52
I create a container object and a containable object. I can pick up and take the container (a backpack), or I can pick up and take the containable object (a seashell). However, I can't put the seashell into the backpack. If I start the game with the shell in the backpack, I can take it out. But, I can't put it back in.
Almost certainly something "not quite set up right" in your code. You don't say whether you are using QDK or doing your coding by hand, but either way there are a few little foibles to using the currently available version of 'typelib.qlb'.
If you are using QDK you have to ingore the default TAKE tab, my typelib by necessity intercepts all take/give commands so putting anything in here will cause peculiar results. Instead go to the typelib added BASICS tab and check regular object as takeable there. Then proceed by making the backpack and seashell both takeable with the former also made a container and the latter a containable.
At that point save and run and it will all work as you require.
Sorry that it seems a bit messy to have to ignore bits of QDK in favour of the typelib added bits, but I think the easy to get results are worth the inconvenience.
Here's a demo of the required items in ASL, should you be a hand coder, this will clear up what you need to do. If you are NOT a hand coder, cut and paste the following code into notepad and save it as "demo.asl" in your Quest working folder (or wherever you put typelib.qlb) - you can then run it in Quest to prove it works and open it in QDK to see how I set it up.
' Created with QDK Pro 3.5
!include <Typelib.qlb>
define game <demo>
asl-version <350>
gametype singleplayer
start <here>
game info <Created with QDK Pro 3.5>
end define
define synonyms
end define
define room <here>
look <here>
define object <backpack>
type <TLTobject>
type <TLTcontainer>
end define
define object <seashell>
type <TLTobject>
type <TLTcontainable>
properties <isIn=backpack>
end define
end define
define text <intro>
end define
define text <win>
end define
define text <lose>
end define
Hope this helps - if not e-mail me or IM me and I'll go through it with you.
You may notice from the above just how little code you have to write to get all the fancy container functionality from typelib.qlb
Good luck with Quest, and welcome aboard!
Al (MaDbRiT)
Alf
31 Dec 2003, 16:07Anonymous
31 Dec 2003, 16:29Make the backpack a "coat" and you should find it works as a wearable, let me know if that works for you.
Al (MaDbRiT)
Alf
31 Dec 2003, 16:58Thanks again for all the help, and thanks for making the library available.
Alf
paul_one
01 Jan 2004, 06:27I'm curious if you still use the old 1/2/4/8/16 method (old in the sense of "you were using it last time I looked), or have moved to variables or flags fr the seperate layers.
Anonymous
01 Jan 2004, 11:31
So Al - there's no "outside a coat" wearable then? No bag / outside thingy...
No there's not - at least not a type officially labelled as being such. Bear in mind though that you do have 5 levels of layers already and it's unlikely you'd ever truly need more than that. The layer names are mostly just there for convenience rather than labelling them layer 1,2,3,4 & 5. You are at liberty to demote / promote descriptions (within some limititions) as you see fit. You are unlikely in this case to want to provide the player with a vest, shirt, sweater, jacket and coat (that's the order) so you can use the coat as the top layer and call it a backpack, and if a coat is required use the jacket type instead...
If anyone thinks it is really needed, an external carryable like a rucksack or backpack type could be fairly easily built on to the exisiting structure for the next lib release - it is expandable.
The idea of typelib was for it to be a reasonably flexible general purpose add on. Being able to "misuse" the coat type, make it a container and treat it as a backpack object is an example of exactly the sort of thing I was trying to achieve.
You could also give the coat handy pockets in exactly the way you'd make it perform as a backpack - by just retaining it's description as 'coat' for instance
I'm curious if you still use the old 1/2/4/8/16 method (old in the sense of "you were using it last time I looked), or have moved to variables or flags for the seperate layers.
I am still using the binary (1,2,4,8,16) method because it means my tests can often be simplified to using addition inside a test loop, rather than add to the forest of nested IF-THEN statements that typelib already is. Basically I can add together the values of the layers already worn and do one test to check for wearability/unwearability, rather than have to test for each layer inside a test for it's preceding layer or whatever which is what variables or flags would require me to do.
This is also a case of 'if it ain't broke, don't fix it' of course. As anyone who looks back at code they wrote ages ago will confirm, you can often see another way (even a better way) to do things in retrospect.
As I've hinted before to Alex - a SELECT CASE construct would be a Godsend in Quest ASL
Happy new year all!
Al (MaDbRiT)