Typelib .qlb bug ?

Farvardin
I've created a actor with typelib, and I want to give it an object, and in exchange a message.

Without typelib it work. And if i define the person with <TLTobject> alone and include typelib it works too.
But I want this person to be actor too. Then it no longer works (with or without <TLTcontainer>). TLTactor alone also doesn't work.

I tried also to put the script in the peasant (with "give") instead of the object but it's the same pb.

Is it a bug ? Or have I done something wrong ?

define object <peasant3>
alias <young peasant>
alt <peasant; young>
look <This man is rather young>
speak <"What do you want ?">
detail <young>
type <TLTobject>
type <TLTcontainer>
type <TLTactor>
properties <noSpeak="What do you want ?">
action <wander> if ( $rand(1;10)$ > 4 ) then {
move <peasant3; chateau>
msg <Someone has just left.>
}
else {
move <peasant3; village>
}
end define


define object <sword>
take
give to <peasant3> {
say <Thank you my Lord>
lose <sword>
}
type <TLTobject>
end define

MaDbRiT
Hi Farvardin

Two things here. One is that yes you have found a bug in typelib.qlb, it doesn't deal properly with aliases for the indirect object - I've fixed this (hopefully without adding any further bugs) and if I can find your e-mail, I'll send you a revised 'typelib.qlb' file.

Second is that even without the bug, the code above wouldn't work. When you define an objects as an 'actor who can carry things' you are effectively making the object a container, therefore if you want to give things to (or put things into) that object, those things must be 'containables'.

So, in this case if 'Peasant3' is a container, the sword must be a 'containable' for it to work. Something like this...


define object <peasant3>
alias <young peasant>
alt <peasant; young>
look <This man is rather young>
speak <"What do you want ?">
detail <young>
type <TLTobject>
type <TLTcontainer>
type <TLTactor>
properties <noSpeak="What do you want ?">
action <wander> if ( $rand(1;10)$ > 4 ) then {
move <peasant3; chateau>
msg <Someone has just left.>
}
else {
move <peasant3; village>
}
end define

define object <sword>
take
type <TLTobject>
type <TLTcontainable>
action <contained> say <Thank you my Lord.>
end define


Note that you have to use the 'action when contained' option in QDK to print a message (or do anything else for that matter) - the inbuilt GIVE options are completely ignored if you use typelib.qlb. They have to be, because rather than 'disappearing' the sword into limbo land it now gets tucked away where it can still be retrieved.

Try examining the young peasant after you've given him the sword and you'll see something like...

The man is rather young
He is carrying a sword.

You'll find that;

Take the sword from the young peasant (or just take sword) works too :-)

This sort of thing is what typelib is all about really, but it does require a bit more work than usual to get the benefit.

Al

Farvardin
Thanks you for your precisions.
At the moment I don't know yet all the subtilities of Typelib, but so far I hadn't any pb with it and it worked as expected. I'll change my code according to what you said anyway.
My email (used on forum only because of spam bots) is [email protected], I'd be glad to get the modified library, thank you in advance.

A related question, is it better, or compulsory, to use the
type <TLTobject> even if other TLT type are used (such as type <TLTactor> for ex.) ?

> the inbuilt GIVE options are completely ignored if you use typelib.qlb

the same code with only type <TLTobject> worked as expected (I got the correct reply I mean)


It's not related to typelib only, but is it the same to write a code in the define of an object given to an other with "give to", or with an object which get the object with "give" ? It seems the result is the same.

Anonymous


My email (used on forum only because of spam bots) is [email protected], I'd be glad to get the modified library, thank you in advance.

A related question, is it better, or compulsory, to use the
type <TLTobject> even if other TLT type are used (such as type <TLTactor> for ex.) ?

> the inbuilt GIVE options are completely ignored if you use typelib.qlb

the same code with only type <TLTobject> worked as expected (I got the correct reply I mean)


It's not related to typelib only, but is it the same to write a code in the define of an object given to an other with "give to", or with an object which get the object with "give" ? It seems the result is the same.



Revised lib wil be on its way when I get back to my own PC :-)

You don't have to use TLTobject if you use TLTactor, because TLTactor is built on the TLTobject anyway. (If you like to think of it that way the base object is TLTobject.)

I probably didn't explain the 'give' bit very well. TLTcontainers and TLTcontainables replace the inbuilt 'give' options completely, TLTobjects don't do that, a regular give will actually work for these, but I don't recommend mixing the two in this way.

If you want 'givables' using typelib, make them containables and make the recipients 'containers' - that way you get listable inventories and the abilty to re-take stuff etc.

As regards the use of the regular give otions in either direct or receiving objects, there is an order or precedence as to which is given priority, which may rarely be significant, but otherwise it makes no difference which way you use.

Al

Farvardin
Thank you, it's working now.
A new problem raises : it's ok if I want to get the same action and reply for every people I give an object. But if I want for ex. to give a specific object to a specific actor, and get an other object in exchange, I don't know how to do this with your library. With the default use it was rather easy :


define object <backpack>
alias <sack>
alt <pack; sack>
take msg <This sack is an useful tool for your adventures.>
give to <peasant2> {
say <Thank you very much.|nHere is the saw.>
property <saw; takeable>
reveal <saw>
give <saw>
}
end define


With typelib I guess it's possible to make a conditional, but I don't know how is called


action <contained> {
if ( #TLSiObj# = #@peasant2# ) {
say <Thank you very much.|nHere is the saw.>
property <saw; takeable>
reveal <saw>
move <saw; village>
show <saw>
give <saw>
} else say <Thank you, I think I'll find some use for this.>
}




I tried also with if ( #quest.function.parameter.1# = #@peasant2# ), and with TLTcontainer but it doesn't work better : my item disappear, but I don't get any message ("Thank you very much.|nHere is the saw" or the other object in exchange).

codingmasters
Is there any chance of me getting the library as well?

[email protected] is the address

Matthew G.

This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums