All objects in rrom become Unavailable
witch wyzwurd
15 Sept 2006, 16:37I have a room that when the lights go out, I want all objects (either inherent or placed in) to become unavailable. How do I code this. I tried using "if #quest.objects# in current room then #quest.objects# unavailable" conditional, but if there's more than one item in the room no items turn off; although, if there's only one item in the room, then that item will switch off.
-W.W.
-W.W.
Alex
15 Sept 2006, 17:00You can use "for each object in <#quest.currentroom#>" e.g.
for each object in <#quest.currentroom#> {
hide <#quest.thing#>
}
witch wyzwurd
15 Sept 2006, 17:43Alex wrote:You can use "for each object in <#quest.currentroom#>" e.g.
for each object in <#quest.currentroom#> {
hide <#quest.thing#>
}
You're going to have to speak in QDK-Editor language to me for this one. How do I use the editor to accomplish this task? I'm ultimately going to have to reverse the code when the lights go on, so explaining in Editor-language will allow me to extrapolate for further, similar tasks.
Thank you very much,
-Witch
Alex
15 Sept 2006, 17:56- In the Script Editor, click Add Command
- Select Game Control, then "Run a script for each object in a room"
- For the Room parameter, click # and select "quest.currentroom" from the list. Click Insert.
- Click Edit Script
You're now editing the script that will be run for each object that exists in the player's current room. This script will run multiple times, and each time it runs, the string variable #quest.thing# will contain the name of an object. So, to hide each object, add the following script:
- Click Add Command
- Select Objects, then "Hide an object"
- For the Object parameter, enter #quest.thing#
- Keep clicking OK to close the various Script Editor windows.
Your script should appear like this:
- Select Game Control, then "Run a script for each object in a room"
- For the Room parameter, click # and select "quest.currentroom" from the list. Click Insert.
- Click Edit Script
You're now editing the script that will be run for each object that exists in the player's current room. This script will run multiple times, and each time it runs, the string variable #quest.thing# will contain the name of an object. So, to hide each object, add the following script:
- Click Add Command
- Select Objects, then "Hide an object"
- For the Object parameter, enter #quest.thing#
- Keep clicking OK to close the various Script Editor windows.
Your script should appear like this:
For each object in "#quest.currentroom#" (Hide "#quest.thing#")
witch wyzwurd
15 Sept 2006, 18:14For the Object parameter, enter #quest.thing#
While searching thru the Help guide, I did glance over a mention of the #quest.thing# variable, but figured it was an older Quest-ASL term since I don't see it in the QDK's drop-down menu. I was using #quest.objects# because the Help-guide stated that this variable concerns objects in a current room. Could you explain to me the difference between the two variables and how one would use #quest.objects#?
-Witch
Alex
15 Sept 2006, 22:26#quest.objects# contains the full list of objects in the current room. So if the room contains a banana, a fish and a watermelon, the contents of #quest.objects# will be "banana, fish, watermelon". This is used if you're creating your own room descriptions (although you'd actually usually be better off with #quest.formatobjects# in that case).
Instead of containing the whole list at once, #quest.thing# contains only one thing at a time. When the "for each..." command runs, it puts a different value in each time.
So if your code is this:
then the "msg" command ("Print a message" in QDK) will run three times, one for each object in the room. So your output is:
Instead of containing the whole list at once, #quest.thing# contains only one thing at a time. When the "for each..." command runs, it puts a different value in each time.
So if your code is this:
for each object in <#quest.currentroom#> {
msg <Oh look, a #quest.thing#>
}
then the "msg" command ("Print a message" in QDK) will run three times, one for each object in the room. So your output is:
Oh look, a banana
Oh look, a fish
Oh look, a watermelon
witch wyzwurd
19 Sept 2006, 18:52The #quest.objects# and #quest.formatobjects# explanation you've provided hasn't cleared my confusion. Let's say I script:
1.Clear Game-window
2.Msg <You are in room...There's a banana and watermelon... You can go: north.|n>
3.I create two objects in room: a banana, a watermelon.
I read above statement as: use #quest.objects#... well maybe... use #quest.formatobjects# instead, which is rather vague.
Ok, so if I'm creating my own room descriptions, why am I using #quest.thing# instead of #quest.objects#?
#quest.thing#, #quest.objects# and #quest.formatobjects#, in my mind, are stored as a coagulated mass of interchangeableness. I can't decipher their distinctness, leaving me unable to understand their preprogrammed utilization. If you provide me with a simple, definite example for each variable, I will be able to extrapolate how to use them in my future ASL commands.
Thank You,
...Witch
P.s.: I did follow your instructions using #quest.thing# and was successful.
1.Clear Game-window
2.Msg <You are in room...There's a banana and watermelon... You can go: north.|n>
3.I create two objects in room: a banana, a watermelon.
This is used if you're creating your own room descriptions (although you'd actually usually be better off with #quest.formatobjects# in that case).
I read above statement as: use #quest.objects#... well maybe... use #quest.formatobjects# instead, which is rather vague.
Ok, so if I'm creating my own room descriptions, why am I using #quest.thing# instead of #quest.objects#?
#quest.thing#, #quest.objects# and #quest.formatobjects#, in my mind, are stored as a coagulated mass of interchangeableness. I can't decipher their distinctness, leaving me unable to understand their preprogrammed utilization. If you provide me with a simple, definite example for each variable, I will be able to extrapolate how to use them in my future ASL commands.
Thank You,
...Witch
P.s.: I did follow your instructions using #quest.thing# and was successful.
paul_one
19 Sept 2006, 19:31#quest.thing# only holds one object.. It's usually used inside "for" loops, although it's also used inside other things too - can't remember exactly.
#quest.objects# is ALL the objects in the current room - one after the other.
#quest.formatobjects# is the above variable, with quest formatting tags (those |b and |xb things) which funnily enough, format it!
Funnily enough, I've just said what Alex has said.. And it's all we'll ever say because that IS what's different about them.
Also, you're using #quest.thing# because you're going through each object, one by one, changing a property.
#quest.objects# is ALL the objects in the current room - one after the other.
#quest.formatobjects# is the above variable, with quest formatting tags (those |b and |xb things) which funnily enough, format it!
Funnily enough, I've just said what Alex has said.. And it's all we'll ever say because that IS what's different about them.
Also, you're using #quest.thing# because you're going through each object, one by one, changing a property.
witch wyzwurd
19 Sept 2006, 20:09Ok...so...
If I have 3 objects in a room, and I intend to make all 3 unavailable when the lights go out....
#quest.thing# does:
...then
Object 1: unavailable
Object 2: unavailable
Object 3: unavailable
...(loop stops)
and
#quest.objects# does:
...then
Object 1, Object 2, Object 3: unavailable
...which is why no objects become unavailable?
therefore #quest.objects# is used to list objects in a room description...?
There is Object 1, Object 2, and Object 3 in room.
and #quest.formatobjects is used to list objects in room including formats...?
There is |bObject 1, Object 2, Object 3 in room.|bx
What IS to you is not being explained to ME. And it's all we'll ever say... zzzzzzzzzzzzzzzzzzzzz... zzzzzzzzz... zzz... they hold such secrets... bah, ha, ha!
Thanks,
-Witch W.
If I have 3 objects in a room, and I intend to make all 3 unavailable when the lights go out....
#quest.thing# does:
...then
Object 1: unavailable
Object 2: unavailable
Object 3: unavailable
...(loop stops)
and
#quest.objects# does:
...then
Object 1, Object 2, Object 3: unavailable
...which is why no objects become unavailable?
therefore #quest.objects# is used to list objects in a room description...?
There is Object 1, Object 2, and Object 3 in room.
and #quest.formatobjects is used to list objects in room including formats...?
There is |bObject 1, Object 2, Object 3 in room.|bx
Funnily enough, I've just said what Alex has said.. And it's all we'll ever say because that IS what's different about them.
What IS to you is not being explained to ME. And it's all we'll ever say... zzzzzzzzzzzzzzzzzzzzz... zzzzzzzzz... zzz... they hold such secrets... bah, ha, ha!
Thanks,
-Witch W.