The GIVE command as defined in QDK
Anonymous
09 Sept 2004, 21:08 define object <crazy man>
alt <crazy; man>
look <A very crazy man is dancing in front of you pulling his hair out. Other than that, you see nothing peculiar.>
take msg <You'd prefer not to carry around a crazy man.>
examine <Upon closer examination of the crazy man, you notice he has a pierced ear and a tanline on his finger.>
prefix <a>
gender <he>
give <earring> {
msg <You give the crazy man the earring and he pops it in his ear.>
lose <earring>
hide <earring>
give <success item1>
if got <success item1> and got <success item2> then playerwin
}
give <wedding band> {
msg <You give the wedding band to the crazy man and he puts it on.>
lose <wedding band>
hide <wedding band>
give <success item2>
if got <success item1> and got <success item2> then playerwin
}
end defineThe success items are of course invisible to the player and he doesn't know he gets them. So in short, I am saying if the player gives the earring to the man, he receives the success item1. He gives the wedding band to the man, he receives the success item2. Once both success items are in his inventory (invisible), he wins the game. This is, naturally, a goofy example but it fits the purpose of my question.
If someone knows a better and more simple way to accomplish my purpose here, please help!! I do know how to open up the game in the text editors so if you post a simple code, I can paste it in and adjust as necessary. Not to mention, I would be grateful!!
007bond
10 Sept 2004, 10:49
define object <crazy man>
alt <crazy; man>Problem: If someone types "go crazy" while trying to find out what to do, Quest will say that there is no action called "go" assigned to crazy man. This is because you have set synonyms for his name to be 'crazy' & 'man'. You should probably delete crazy so that there is only man there.
alt <man>
look <A very crazy man is dancing in front of you pulling his hair out. Other than that, you see nothing peculiar.>
take msg <You'd prefer not to carry around a crazy man.>
examine <Upon closer examination of the crazy man, you notice he has a pierced ear and a tanline on his finger.>
prefix <a>If there is more then one crazy man in this game, then the prefix 'a' is fine. Seeing as there is only 1, it becomes 'the'.
prefix <the>
gender <he>
give <earring> {
msg <You give the crazy man the earring and he pops it in his ear.>
lose <earring>
hide <earring>
give <success item1>
if got <success item1> and got <success item2> then playerwin
}
give <wedding band> {
msg <You give the wedding band to the crazy man and he puts it on.>
lose <wedding band>
hide <wedding band>
give <success item2>
if got <success item1> and got <success item2> then playerwin
}
end defineHere is the big problem: you should not use items to see whether or not something has happened. Flags are designed especially for this purpose.
gender <he>
give <earring> {
msg <You give the crazy man the earring and he pops it in his ear.>
lose <earring>
hide <earring>
flag on <successItem1>
if (flag <successItem1> = True) and (flag <successItem2> = True) then playerwin
}
give <wedding band> {
msg <You give the wedding band to the crazy man and he puts it on.>
lose <wedding band>
hide <wedding band>
flag on <successItem2>
if (flag <successItem1> = True) and (flag <successItem2> = True) then playerwin
}
end defineNow, I don't usually code in Text Editors, so my knowledge of ASL is limited (I looked in the manual for the flags), so this may not work right away, but it certaintly the method that you would use.
As for not knowing how to open an ASL file in a text editor. Ask a lot of the experienced users and they will reccomend TextPad (so do I). It is free from http://www.textpad.com, as well as a heap of extensions, like Libraries (reference menus), syntax highlighting, dictionaries, macros, and many plug-ins. Once you've downloaded, installed and configured TextPad and any extensions you may have downloaded, goto http://www.axeuk.com/quest/support.htm and click on Syntax Highlighting. On that page is a download link to a synatx file Alex wrote for TextPad. Download it and install it like all the others. Now run TextPad, and go File, Open. In the File Type Drop DownBox, select All Files. Now browse to the folder that has the ASL file and open it. You've got the ASl file open, but how do you apply the Syntax Highlighting? Press Alt+Enter (View, Document Properties), then select the Syntax tab. Enabled Syntax Highlighting, then select ASL.SYN. Click Apply, OK, and there you have it. Your ASL file in a text editor, with Syntax Highlighting! Glad I could be of help, good luck with your game.
Alex
10 Sept 2004, 12:48Prefix "a" or "the": it's just a matter of style. If the crazy man is significant and has been referred to before then "the" as the prefix makes more sense. If he's just a bit of scenery then I think using "a" as the prefix is better, however many crazy men are in the game.
Flags: Yes, flags would be better for this, but the inventory approach should work just as well really, the only pain being that you have to remember to set all these objects as hidden.
Anonymous
10 Sept 2004, 13:31Alex wrote: Flags: Yes, flags would be better for this, but the inventory approach should work just as well really, the only pain being that you have to remember to set all these objects as hidden.
I thank Alex and 007 for this advice. I was trying to stay away from commands in QDK that I was unsure about. FLAGS being one of them. I now know what they are for. I will try the flag idea but as you said, Alex, the inventory approach has worked on a simpler project I had attempted. It was basically, if someone tried to interact with a certain "item 1", it would unlock a door. There were many ways to do this but I decided to make it so where they could see the door was there but they could not go through it unless they had an invisible object "item 2" in their inventory which they picked up unknowingly by interacting with the certain "item 1".
I will definitely practice using flags to see if it will be easier. In the crazy man example, if I typed "give earring" without saying "to crazy man" then the game would produce an error and shut down. Error
Run Time Error '5': Invalid procedure call or argument There is still an unanswered question I have regarding the "giving" part of it. When I say "give earring to man", it says "Hard as you try, you find that you cannot do that". If you say use "earring on man", it says "You can't use that here."
Alex
10 Sept 2004, 14:09As for the "Hard as you try..." message, that's from Q3EXT so nothing to do with me guv!
Anonymous
10 Sept 2004, 15:04Alex wrote:Thanks for reporting the run-time error - I'll take a look into it.
As for the "Hard as you try..." message, that's from Q3EXT so nothing to do with me guv!
Aw, so it must be a MaDbRiT thing. Although, I was using QDK and when I label (for example) "crazy man" as a non-takeable item and on the last tab where you choose what can be used or given to this object, I clicked the earring and the wedding band as the two giveable objects. That's not Q3ext, is it? Or were you referring to the error message itself was from Q3ext?
Al, do you know what the problem is with the "giving" scenario? I can't seem to give an item to an NPC(object). Any suggestions? Please refer to the original post for the code.
thanks,
steve
Alex
10 Sept 2004, 17:35Anonymous
10 Sept 2004, 18:30I clicked the earring and the wedding band as the two giveable objects. That's not Q3ext, is it? Or were you referring to the error message itself was from Q3ext?
Actually it IS Q3EXT that's causing the issue, it overrides the built in 'give' commands completely (because it has to) and the error message is as a result generated by the 'Q3EXT library code.
Using Q3EXT requires a bit more 'planning' than is perhaps immediately obvious. I would seriously recommend you use Typelib.qlb instead anyway - it is better and much easier to use from QDK.
Al MaDbRiT
Anonymous
10 Sept 2004, 18:41Anonymous
10 Sept 2004, 18:46Al (MaDbRiT)
steve the gaming guy
10 Sept 2004, 18:52I thought I had registered before but I didn't see any of the usernames I would have used. So now, I'm no longer a guest! Whoo hoo!
steve
steve the gaming guy
05 Oct 2004, 20:35I re-read this string to re-familiarize myself with the problem I dealt with before. I still for the life of me cannot get the 'give' command to work!
I know this is now a typelib thing, because the message I receive is now 'You don't need to put the #object# on anything'. This would be in response to the command "give #object# to girl"
I don't get it. I've tried many variations and am stumped. Even the game that I finished uses a part near the end where you must give an item to a person and I've discovered the same error occurring as it did a month ago (that was with q3ext).
Anyway, using typelib, is there a good approach to making a giveable object? Is it something that must be dealt with inside the object or is it dealt with the person to whom it will be given to?
Thanks!
steve the gaming guy
Anonymous
06 Oct 2004, 07:34Anyway, using typelib, is there a good approach to making a giveable object? Is it something that must be dealt with inside the object or is it dealt with the person to whom it will be given to?
it's easier than that
Then you'll be able to give the object to the person and when examined that person will be shown to be holding the given object...
You could then take it back from them if you wanted - but that's another story
Al (MaDbRiT)
steve the gaming guy
06 Oct 2004, 13:19Steve the gaming guy 8)
steve the gaming guy
06 Oct 2004, 13:42The actor is a female. How do I make it respond as one?
I give the girl a sweater and when I examine her, I get the description that I gave for her “This looks like a wee girl of age 19†plus an additional line that says “He is carrying a sweaterâ€
I could not find an option to change that response to ‘she’
A more complicated question would be what if I want the girl to put it on as soon as I give it to her? Is there a way to change the reply to “She is wearing a sweater?†If not, that’s ok. It just gets more complicated if I want her to wear something and carry something else. “She is wearing a sweater and carrying a frog.â€
The latter question is not as important so if it’s too difficult to worry about, that’s fine.
Steve the gaming guy
Anonymous
06 Oct 2004, 19:18Strike that! I figured it out on my own. That rocks! However, another question arises. I tried to figure it out on my own but to no avail.
The actor is a female. How do I make it respond as one?
I give the girl a sweater and when I examine her, I get the description that I gave for her “This looks like a wee girl of age 19†plus an additional line that says “He is carrying a sweaterâ€
I could not find an option to change that response to ‘she’
It is there, ( sneakily hidden apparently
A more complicated question would be what if I want the girl to put it on as soon as I give it to her? Is there a way to change the reply to “She is wearing a sweater?†If not, that’s ok. It just gets more complicated if I want her to wear something and carry something else. “She is wearing a sweater and carrying a frog.â€
The latter question is not as important so if it’s too difficult to worry about, that’s fine.
It isn't actually that hard. All you need to do is use the 'contained' action of the sweater to print a message that she puts the sweater on, then change the 'header for listing' of the girl slightly to lead with that info.
I can't get QDK to work while I am online (memory conflict) so I'll sign off now and code a quick example...
Al (MaDbRiT)
Anonymous
06 Oct 2004, 19:42Here's a quick girl, frog and sweater demo - although you can't use the clothing types for non player characters in the current version of typelib (can in the next) you can still get the effect you wanted easily enough.
Note that if you want to be able to take the sweater back, you need to do some much more awkward code wrangling.
' "sweater"
' Created with QDK Pro 3.52
!include <Typelib.qlb>
define game <sweater>
asl-version <350>
gametype singleplayer
start <demo room>
game author <MaDbRiT>
game info <Created with QDK Pro 3.52>
end define
define synonyms
end define
define room <demo room>
define object <jenny>
look <Jenny is a very attractive young lady.>
displaytype <person>
type <TLTcontainer>
type <TLTactor>
properties <listHeader=She is carrying>
action <speak> say <does my bum look big in this?>
end define
define object <frog>
displaytype <amphibian>
gender <it>
type <TLTobject>
type <TLTcontainable>
end define
define object <sweater>
type <TLTobject>
type <TLTcontainable>
action <contained> {
if (#sweater:isIn#=jenny) then {
msg <"Thanks a lot its lovely" |n(Jenny immediately puts the sweater on.)>
move <sweater;limbo>
property <jenny;listHeader=She is wearing a sweater and carrying>
}
else msg <O.K.>
}
end define
end define
define text <intro>
end define
define text <win>
end define
define text <lose>
end defineAl (MaDbRiT)
steve the gaming guy
07 Oct 2004, 17:57steve the gaming guy