conditional with property alias
Anonymous
17 Sept 2003, 21:03In my game, I want to make the player give several items to a NPC, and then get something else in exchange.
I require the player makes a transformation to one of those items, and then give the item an other alias.
This code doesn't work. But if I remove the
if property <branch; alias = torch>
it will work... (of course I don't want the player only give the branch, he must turn it to a torch before...)
I require the player makes a transformation to one of those items, and then give the item an other alias.
This code doesn't work. But if I remove the
if property <branch; alias = torch>
it will work... (of course I don't want the player only give the branch, he must turn it to a torch before...)
give <branch> {
if property <branch; alias = torch> then {
say <Thank you.>
flag on <torch_given>
lose <branch>
if flag <sack_given> and flag <torch_given> then do <peasant2; give_saw>
}
}
Alex
17 Sept 2003, 22:28I admit this is confusing - allowing the syntax you used is on my "to do" list - but currently there are two ways of reading properties:
1. Boolean properties (ON or OFF)
These are read using "if property". So to check if an item of clothing has a property "stylish", you would use something like:
if property <cardigan; stylish> then ...
2. Properties with a value
These are properties such as "weight" which might have a value of "50". You check these in a similar way as you would check other things which return values, and you use the #object:property# syntax to do it. Examples:
if ( #fatbloke:weight# > 50 ) then msg <Who ate all the pies?>
if ( #man:age# = 65 ) then msg <Here's information on your pension.>
if ( #(character):colour# <> green ) then msg <#character# is not an alien.>
1. Boolean properties (ON or OFF)
These are read using "if property". So to check if an item of clothing has a property "stylish", you would use something like:
if property <cardigan; stylish> then ...
2. Properties with a value
These are properties such as "weight" which might have a value of "50". You check these in a similar way as you would check other things which return values, and you use the #object:property# syntax to do it. Examples:
if ( #fatbloke:weight# > 50 ) then msg <Who ate all the pies?>
if ( #man:age# = 65 ) then msg <Here's information on your pension.>
if ( #(character):colour# <> green ) then msg <#character# is not an alien.>
paul_one
18 Sept 2003, 00:47Alex - you've added a variable within a variable??
#(character):colour# ... Character is a variable?
I DIDN'T KNOW ABOUT THIS!!!
Why wasn't I told?
_________________
Computer Whizz
==Insert Sig Here!==
Currently Listening To :
NO SONG
Using Winamp.
#(character):colour# ... Character is a variable?
I DIDN'T KNOW ABOUT THIS!!!
Why wasn't I told?
_________________
Computer Whizz
==Insert Sig Here!==
Currently Listening To :
NO SONG
Using Winamp.
Alex
18 Sept 2003, 06:55Hmm, I was going to point you to the relevant page in the documentation... but it, er, doesn't say anything about using the #(variable containing object name):property# syntax. Woops! 
GameBoy
18 Sept 2003, 07:16we learn something new everyday 
Anonymous
18 Sept 2003, 10:04C.W wrote
Uhm - actually you WERE told...
WAY back in Quest 3.1 beta (when the property reading shortcut was introduced) this function was mentioned in the 'versions.txt' info.(something I always read) and I've been using it ever since
O.K. I've never looked to find it in the docs - but this has been around so long I assumed it was there!
Al (MaDbRiT)
Alex - you've added a variable within a variable??
#(character):colour# ... Character is a variable?
I DIDN'T KNOW ABOUT THIS!!!
Why wasn't I told?
Uhm - actually you WERE told...
WAY back in Quest 3.1 beta (when the property reading shortcut was introduced) this function was mentioned in the 'versions.txt' info.(something I always read) and I've been using it ever since
O.K. I've never looked to find it in the docs - but this has been around so long I assumed it was there!
Al (MaDbRiT)
Alex
18 Sept 2003, 12:11VERSIONS.TXT is indeed something I really recommend everybody reads - although all the technical information in there should be in the main docs as well. If anybody finds anything else I've omitted please let me know 
Farvardin
19 Sept 2003, 04:47I admit this is confusing - allowing the syntax you used is on my "to do" list - but currently there are two ways of reading properties:
Thank you, it works now...
Chuck
19 Sept 2003, 17:22After a little experimenting, I discovered that "game" and its properties is also considered an object (even though "game" does not show up as an object in QDK). So you can use game properties to apply to the main character in the story.
I'm sure most, if not all of you, know this. I thought a visitor to the forum who is just starting out with Quest might benefit from my small discovery.
Chuck
define game <>
asl-version <350>
gametype singleplayer
start <forest>
game info <Created with QDK Pro 3.5 Beta 2>
properties <bozo; weather=20>
end define
define synonyms
end define
define room <forest>
command <clap hands> if property <game; bozo> then {
msg <You disappear!>
stop
}
else msg <Nothing happens.>
command <hit face> if ( #game:weather# > 10 ) then {
msg <You disappear.>
stop
}
else msg <Nothing happens.>
define object <Sign>
type <TLTreadable>
properties <readMessage=Hit face or clap hands. See what happens.>
end define
end defineI'm sure most, if not all of you, know this. I thought a visitor to the forum who is just starting out with Quest might benefit from my small discovery.
Chuck
Chuck
19 Sept 2003, 17:25I just realized I left out the beginning of the code:
I also purposefully left out the standard concluding text definitions as well.
Chuck
' Created with QDK Pro 3.5 Beta 2
!include <Typelib.qlb>I also purposefully left out the standard concluding text definitions as well.
Chuck
Alex
19 Sept 2003, 17:34My tip of the day - did you know that flags are actually just shortcuts to boolean game properties (by "boolean" I mean the "on/off" kind). So if you prefer, instead of typing this:
if property <game; bozo>
You can type this:
if flag <bozo>
if property <game; bozo>
You can type this:
if flag <bozo>
Chuck
19 Sept 2003, 18:48Alex, thanks for your "My tip of the day." Maybe you could start a thread with that topic.
Chuck
Chuck