A few questions.

Christopher
04 Feb 2005, 09:33
Just a few simple questions for one very confused individual.

1. How can I create a procedure that moves all the objects in your inventory (except one specific one) into a specific room
2. How do I ask a question to the player that whatever is typed for that turn only is recorded as a variable?
3. How can I add an intro to the start of the game if you are starting a new game (text appearing at intervals and a few of the previously mentioned questions, kind of like the Devil's Bargain game in the archives).

Thanks in advance.

007bond
05 Feb 2005, 04:10
I can answer number 2 for you: If you look through the commands in the dialog box, in the category "other", or something like that, you'll find what your looking for.

paul_one
05 Feb 2005, 17:24
To get every object in the inventory you select "for every object" and input "inventory", then edit the script and put in a conditional.
Check for a certain object like so:
#quest.thing# = objectnamehere

Don't worry, this is the "for each object in the room" window:
Pic1
This is the script window:
Pic2

Question 2 is:
You print a message to the screen asking your question, and then get what the player types and put it into a variable (kinda like 007bond said)... Like so:
Pic3

Question 3:
In the startscript:
Pic4
You add the messages, and then a "wait until the player presses a key" like so:
Pic5

You can get the file I used, here:
File
Take it and have a look for yourself!

Hope this helps you...

Christopher
06 Feb 2005, 05:52
Wow, explanations, screenshots and even an example .asl :shock: Thanks a lot Computer Whizz! I'm pretty sure I understand all that now. :D

Shadowalker
07 Feb 2005, 09:05
Wow CW, that's one of the most detailed answers I've seen on here! Cool! Anyway, I was thinking, I don't know if Christopher wants to create a custom command to move all the objects, or JUST a procedure, but if he was talking about a custom command, I thought what if there's an object that isn't able to be taken, or something like that. Then, if you say 'for each object in the room,' it will disregard if it's 'takeable' or not.

Also, what if you want to drop all items, but there are certain ones that have the 'can't be dropped' ticked? Now, there might be a different way to solve these problems, but I came up with a solution using good old properties. I'll post the code in case you can use it, christopher.

Also, judging from your post, it sounds like you are new to this, so here's how you make the code I post into a working "game." Just copy the whole code, and paste it into a word program, like notepad. Then, save it as .asl, and just click on it to run it. Simple! Hope this helps!

(In the demo, I made a few objects....1 can't be picked up, and one can't be dropped...to test it out, just type in 'take all,' and 'drop all.')
' "Test Inventory Check/quest.thing"
' Created with QDK 3.53 - UNREGISTERED VERSION

define game <Test Inventory Check/quest.thing>
asl-version <350>
gametype singleplayer
start <Start Room>
game author <>
game version <1.0>
game copyright <© Artistic Productions 2005>
game info <Created with QDK 3.53 - UNREGISTERED EVALUATION VERSION.>
background <black>
foreground <green>
startscript {
msg <|jc|n|n|n|n>
exec <about>
msg <|b|cr>
wait <Hit a key to try out this demo...>
msg <|c|n|n|n|n|n|cb|s23Try typing in |cy"Take all,"|cb and |cy"Drop all."|cb|s00|n>
wait <|bHit any key to start...|xb>
msg <|cb|c|xb>
background <white>
foreground <black>
}
description {
msg <You are in |cr#quest.formatroom#|cb.|n|n#quest.lookdesc#|n>
do <Print Directions>
}
command <drop all> for each object in <inventory> if property <#quest.thing#; un drop> then {
msg <|jlYou try to drop the |b|i#quest.thing#|i|xb but fail, because:|b|cl |n|jc>
exec <drop #quest.thing#>
msg <|cb|xb>
}
else {
lose <#quest.thing#>
msg <|jl|b|i*-*#quest.thing#|xb|xi dropped.|n|jc>
}
command <take all> for each object in <#quest.currentroom#> if property <#quest.thing#; un take> then msg <|jlYou can't take the |b|i#quest.thing#.|xb|xi|n|jc> else {
if exists <#quest.thing#> then {
give <#quest.thing#>
msg <|jl|b|i*-*#quest.thing#|xb|xi taken.|n|jc>
}
}
end define

define synonyms
end define

define room <Start Room>
prefix <|cbthe|cr>
look <This is the room that you start off in.>
north <second room>
properties <dir>

define object <Ball>
alt <toy>
look <A ball.>
take
examine <It's red.>
prefix <a>
detail <The ball>
article <it>
gender <it>
end define

define object <Toy truck>
alt <truck; toy>
look <A toy truck.>
take
examine <It's a Tonka truck.>
prefix <a>
detail <The truck>
article <it>
gender <it>
end define

define object <Apple>
look <An apple.>
take
examine <It's a green one.>
prefix <an>
article <it>
gender <it>
drop nowhere <You may want to hang on to the apple in case you get hungry later.>
properties <un drop>
end define

define object <Statue>
look <It's a statue.>
examine <It's in the shape of a hero.>
prefix <a heavy>
article <it>
gender <it>
properties <un take>
end define

end define

define room <second room>
prefix <|cra|cr>
look <This is the second room.>
south <Start Room>
properties <dir>
end define

define procedure <Print Directions>
if property <#quest.currentroom#; dir> then msg <You can go: |cl#quest.doorways.dirs#|cb|n>
end define

define text <intro>

end define

define text <win>

end define

define text <lose>

end define



paul_one
07 Feb 2005, 09:55
Yeah....

I think I may write a small starter tutorial... But it is alot harder than alot of other languages - especially for beginners. As it doesn't follow a "flow" per-say. It is build in "modules" which create "blocks" and you have to know when they execute etc, so really I wouldn't know where to start...

I think I'll just make little demo's of questions people ask and put them up.

I also thought the detail, and QDK pic's were essential for the beginner as he was probably using QDK.