Wear and Unwear - defaults?
steve the gaming guy
23 Nov 2004, 16:00I have a cloak that needs to be worn once it's obtained. No matter what I choose in the cloak description under clothing (long coat checked or unchecked). I get one of two default responses from the typelib library.
"On second thoughts you decide that the cloak won't suit a man like you at all." if long coat is checked
OR
"You cannot wear the cloak!" if nothing is checked under clothing.
How do I set the properties of the player to allow him to wear the cloak? It seems that the message response that I entered for wearing the cloak is being ignored.
There is another object or two later on that will need to be worn so I need to go ahead and try to solve this problem.
' "King's Quest V - text adventure"
' Created with QDK 3.52 - UNREGISTERED VERSION
!include <Typelib.qlb>
define game <King's Quest V - text adventure>
asl-version <350>
gametype singleplayer
start <Crispin's house -out front>
game author <Steve Lingle>
game info <Created with QDK 3.52 - UNREGISTERED EVALUATION VERSION.>
startscript move <cloak; Tailor's Shop>
define variable <Score>
type numeric
value <0>
display <Score: ! of 230>
end define
end define
define synonyms
take = get
end define
define room <Crispin's house -out front>
look <To the south you can almost make out a small town. To the west is a dark path that winds into the forest beyond.>
indescription <You are at>
south <town>
end define
define room <town>
prefix <the>
look <As you walk on the cobblestone street, townspeople walk up and down minding their own business and walking in and out of the town's quaint little shops.>
north <Crispin's house -out front>
place <the; Tailor's Shop>
end define
define room <Tailor's Shop>
prefix <the>
look <Inside the shop, you first notice the sales clerk behind the counter measuring pieces of fabric. There's a nice cloak on display near the front.>
out <the; town>
script {
msg <The sales clerk notices you,>
say <|clHello there, how fare you today?|cb>
}
description msg <#quest.lookdesc#>
define object <sales clerk>
alt <clerk>
look <The sales clerk stands behind the counter measuring fabric and looks up when Graham enters the shop.>
speak {
if flag <tailor1> then do <tailor>
else {
msg <Graham approaches the tailor,>
wait <press any key>
say <|crGood day, I am wondering about this cloak you have on display. How much does it cost?|cb>
wait <press any key>
say <|clAh yes, an excellent cloak. Very warm for cold weather. I would take one gold piece for such a garment.|cb>
wait <press any key>
say <|crThank you, sir. I will come back when I have a gold piece.|cb>
flag on <tailor1>
}
}
prefix <the>
gender <he>
give <golden needle> do <tailor>
type <TLTactor>
properties <displaytype=sales clerk>
action <speak> if flag <tailor1> then do <tailor>
else {
msg <Graham approaches the tailor,>
wait <press any key>
say <|crGood day, I am wondering about this cloak you have on display. How much does it cost?|cb>
wait <press any key>
say <|clAh yes, an excellent cloak. Very warm for cold weather. I would take one gold piece for such a garment.|cb>
wait <press any key>
say <|crThank you, sir. I will come back when I have a gold piece.|cb>
flag on <tailor1>
}
end define
end define
define room <inven room>
define object <cloak>
look <A high-quality blue cloak is on display near the front of the Tailor's shop.>
examine <This blue cloak looks like it would keep its owner very warm in a cold place.>
prefix <a>
article <it>
gender <it>
drop nowhere <There's no need to drop the cloak.>
properties <wearmessage=Graham puts on the blue cloak.; unwearmessage=Graham takes off the cloak.; sex=male>
end define
end define
define procedure <tailor>
msg <Graham approaches the sales clerk.>
wait <press any key>
say <|crGood day, sir. I don't have any money but can I have that cloak anyway?|cb>
wait <press any key>
msg <|cl"I'm feeling generous today. Sure!"|cb>
wait <press any key>
msg <The sales clerk walks to the blue cloak on display and hands it to you. |cl"I hope this bides you well on your quest."|cb>
wait <press any key>
msg <|crThank you, sir. I'm sure it will indeed.|cb>
give <cloak>
end define
define text <intro>
end define
define text <win>
end define
define text <lose>
end define
Thanks
I think Im Dead
23 Nov 2004, 18:12My guess knowing nothing of typelib, is that somewhere along the lines, the long coat wear function in typelib is checking wether you are a male or female, as I vaguely remember there being sex-specific items like panties and bras, to output the correct messaging. Since you have no sex, it's splitting out the first response it can, which is, that you don't have a property sex=female, so it's messaging that it's an item for females.
Try giving your player a property of sex=male is my guess.
Again, knowing nothing of typelib.
steve the gaming guy
23 Nov 2004, 19:02Anonymous
23 Nov 2004, 20:39The 'sex' property of clothing is indeed there so that a man won't be allowed to put on (say) a dress designated as 'female' - you seem to have a mismatch between the player's sex and that of the cloak.
The reason this is happening is that you need to specify sex=1 not sex=male in your properties - I haven't modernised this code yet! ( Male = 1, Female = 2, Unisex = 0 )
Al (MaDbRiT)
Anonymous
23 Nov 2004, 20:45The typelib defaults are that all clothing is set with 'sex=1' and the player is also 'sex=1' - so in theory you can ignore the possible sex restrictions completely and code nothing at all if you don't need to use them
Al (MaDbRiT)
Anonymous
23 Nov 2004, 20:48The player is (by default) given the property ‘sex=1’ as are all the clothing items. If you set ‘sex=2’ for the player, attempting to put on an article of clothing that has property sex=1 will result in a message to the effect that the clothes won’t suit a woman like you. The reverse is also true, setting player sex=1 and an article of clothing to sex=2 will produce “won’t suit a man like you.†If the player sex property is equal to the individual clothing’s sex property, the library makes no restrictions, so although sex=1 is nominally male if you want a female player character and only provide suitable female clothes, you need not bother to alter the sex properties at all.
steve the gaming guy
23 Nov 2004, 21:01I just found it. It was included with the typelib .zip file!!
steve the gaming guy
07 Dec 2004, 18:31Let's say that it's cold weather and if the player doesn't put on the cloak after a certain amount of time, he dies of frostbite. I've noticed that it's not as simple as saying "If cloak is NOT worn, then die of frostbite"
I looked at the library to see how the code reads but it's above my head. I also looked at the manual but I either can't find it or I'm not looking for the right word!
Do you know a good way to create this?
Anonymous
07 Dec 2004, 22:58Easy answer to this one, you just use a variable as a counter or "fuse"/"daemon".
Set a numeric called (say) 'freeze' to 3 when the player enters the cold area (or at the start of the game).
Perform a test (local afterturn of the cold location) to see if the player is wearing the cloak - if he isn't count down (decrement) the freeze variable.
Perform another test (local afterturn again) to see if the freeze variable is zero - if it is, kill the player.
This will give the player 3 'turns' to put on the cloak if he doesn't have it already - before the cold gets him. Here's an example, cut n paste and run this. If you just look a few times while staying in the freezer (there's nought else to do) the cold will kill you if you aren't wearing the cloak.
' Quest 3.5 ASL Template
!include <Typelib.qlb>
define game <Game Name>
asl-version <350>
gametype singleplayer
game version <0.1a>
game author <MaDbRiT>
game copyright <© 2004 ...>
game info <This is a daemon demo.>
start <Start>
startscript set numeric <freeze;3>
end define
define room <Start>
look <Description Goes Here>
prefix <the>
south <freezer>
define object <cloak>
look <very thick with a thermal lining.>
type <TLTobject>
type <TLTcoat>
end define
end define
define room <freezer>
look <It's icy - nothing else to see.
north <Start>
prefix <the>
script {
if not property <cloak;worn> then {
msg <It is FREEZING in here!>
dec <freeze>
}
}
afterturn {
if not property <cloak;worn> then {
msg <It is FREEZING in here!>
dec <freeze>
}
if (%freeze%<1) then {
msg <You've frozen to death!>
playerlose
}
}
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 defineYou'd probably want to reset the counter if the cloak is put on, I've not bothered with that here.
Al (MaDbRiT)
Anonymous
07 Dec 2004, 23:01Somehow the LOOK tag of the freezer has lost its closing > in my cut and paste above - please repair the code before trying to run it!
Al (MaDbRiT)
steve the gaming guy
08 Dec 2004, 16:43I saw where 'worn' is actually a property so I made the script to say if the properties of the amulet is worn then you don't die.
When testing this, I receive the following error and the game shuts down after typing "wear amulet":
Run-time error ‘-2147417848 (80010108)’:
Automation error
If you need to see the code, I can post it later on.
LATER ON:
Ok, here is the code for the amulet itself. I've tried assigning it as an article of clothing and I also tried leaving the clothing tab alone. I also tried checking and unchecking the block to assign it as a regular object. For some reason, that error keeps popping up.
Although, I should mention that when I do not assign it as an article of clothing and I try to 'wear amulet', it tells me the default "On second thoughts, it wouldn't suit a man like you"
So I'm going nuts here...
define object <amulet>
look <This amulet is a gold necklace with a jewel fitting that hangs at the base. Its purpose is to deflect certain magic spells but it is only effective if worn.>
take
prefix <the>
article <it>
gender <it>
type <TLTvest>
action <wear> {
exec <wear amulet>
flag on <amulet>
msg <Graham puts on the amulet and the jewel begins to glow so he tucks it away in his tunic.>
}
end defineAnonymous
08 Dec 2004, 20:13Try declaring your amulet like this:
define object <amulet>
look <This amulet is a gold necklace with a jewel fitting that hangs at the base. Its purpose is to deflect certain magic spells but it is only effective if worn.>
take
prefix <the>
article <it>
gender <it>
type <TLTobject>
type <TLTvest>
properties <wearmessage =Graham puts on the amulet and the jewel begins to glow so he tucks it away in his tunic.>
end defineand you'll find it ought to work a treat.
If you are getting the 'won't suit a man/woman like you' message refer back to the discussion on the default 'sex' property of clothing, it would seem you have the player and the amulet set as different sexes.
I think the automation error is due to an accidental oozulum loop - you have code 'exec <wear amulet>, what happens here is this
1: Player types 'wear amulet'
2: Typelib causes Quest to run the action 'wear' of the object 'amulet'
3: That action causes the command 'wear amulet' to be executed as if it were typed by the player...
result is the step sequence 1-2-3-1-2-3-1-2-3-1-2-3-1-2-3-1-2-3-1-2-3-1-2-3... i.e you've programmed a never ending loop!
Al (MaDbRiT)
steve the gaming guy
08 Dec 2004, 21:13I want to mention though that I did not manually enter the 'exec' command. I did it all in QDK. I don't know if that's something that appears when you assign a type of clothing or whatever.
I would have never guessed to change it to 'properties <wearmessage>'
I did recall our other conversation about the default sex of clothing. That was going to be my last resort to start fiddling with the male vs. female etc.
Anyway, it works now. Thanks a million!
Anonymous
09 Dec 2004, 08:41Glad it helped
The 'properties <wearmessage=blah>' was in fact generated by QDK, just go to the Clothing_2" tab and enter it in the 'msg when put on:' box.
Typelib provides a default if you leave this box empty, but it is there so that you can write your own 'put on the object' response easily.
Al (MaDbRiT)