Axe Software Forums
  Quest Developer Forum
  Problem with properties..


Author Topic:   Problem with properties..
Thraka posted 23-07-2002 03:32 BST     
Ok in the conditions of a script, how do i specify IF a property = a value THEN using the GUI of the editor? all i have to pick from is:
An object (or room) has a property

shouldn't there be An objects (or room's) property value

gamer1962 posted 23-07-2002 15:18 BST          
Here is sample code from my game:

action <getit> if
( $objectproperty(#takeobj#;bought)$ = 0 ) then {if ask <The #@takeobj# costs $objectproperty(#takeobj#;cost)$.00, do you want to buy it?> then doaction <#takeobj#; buyme> } else do <pickup>

Use this $objectproperty(#takeobj#;bought)$ when referring to a string variable (#takeobj#) that has the object or room name or this #objectorroomname:property name# if you are going to use the real name of the object/room

Thraka posted 23-07-2002 23:37 BST          
So is it basically to really make a game you have to do most of it by hand?
MaDbRiT posted 24-07-2002 02:17 BST          
quote:

So is it basically to really make a game you have to do most of it by hand?

Not at all, it depends on what you are trying to achieve. If you want to test the value of a property (not whether it exists) you need to use the compare two strings or values option, not the object (or room) has a property option.

Use #object:property# in 'String 1' to read the value of the property, then set the 'equal to' box to whatever test you require and pop the test value into 'String 2'. This allows you to build the test you need within Q.D.K.

If your object is contained in a variable you need to tweak the syntax a little,
#(variable-name):property#, but otherwise it is quite straighforward.

Al


Al

MaDbRiT posted 24-07-2002 02:23 BST          
p.s.

Just a thought, the expression

$objectproperty(#takeobj#;bought)$

can be rewritten like so...

#(takeobj):bought#

In latest versions of Quest ASL, this is a shorter and neater way to get the same answer :-)

Al

Computer Whizz posted 24-07-2002 04:31 BST          
So the variables need the ()'s around then while the actual object names stay as just names....

Or are the ()'s just there for show?

Computer Whizz

MaDbRiT posted 24-07-2002 05:32 BST          
Computer Whizz wrote...

quote:

So the variables need the ()'s around then while the actual object names stay as just names....

Exactly so C.W. where you use the objects actual name you don't need the parentheses, when you need to read it from a string variable you do need them. :-)

Al

Alex posted 24-07-2002 05:34 BST          
You need the brackets if the object name is actually a variable which contains the object name. The following do the same thing:

if ( #potato:price# > 50 ) then msg <Expensive for a vegetable.>

and

set string <thing; potato>
if ( #(thing):price# > 50 ) then msg <Expensive for a vegetable.>

Alex posted 24-07-2002 05:36 BST          
By the way, is anybody else concerned about how often I use vegetables in my ASL examples? I think I am.
Computer Whizz posted 24-07-2002 10:14 BST          
LOL....

I really don't think about it that often but I guess you do use vegetables alot...

I use an example of what I've just been thinking of.

Computer Whizz

MaDbRiT posted 24-07-2002 13:42 BST          
Hi (again) All

quote:

By the way, is anybody else concerned about how often I use vegetables in my ASL examples? I think I am.

I think it betrays a subconcious obsession with potato chips... the vegetable seems to be potatoes in so many examples!

Personally I use 'widgets' as example objects, along with pseudo 'action' code of 'foo & bar' (a time honoured variation on F.U.B.A.R. - which is military slang for F... ahem! F/Messed Up Beyond All Recognition)

For those who don't know about 'widgets' and are wondering, GET A LIFE! Seriously, 'widgets' are the fictional products beloved of examples used when learning to be an Accountant. Fictional factories make 'widgets', you buy and sell 'widgets' etc. I trained as an Accountant many years ago so that explains my 'widget' fixation.

Here endeth the lesson :-)

Al

Thraka posted 25-07-2002 03:33 BST          
Thanks for the help guys.. I did it all and now i get this error when trying to run the game.

Too many } - unable to open file

gamer1962 posted 25-07-2002 12:16 BST          
if your nesting if then's using QDK it can cause errors like that
MaDbRiT posted 25-07-2002 16:09 BST          
Thraka reported the error...

quote:

Too many } - unable to open file

I think there was a bug in earlier versions QDK that caused this, but that Alex had fixed it now. (Am I right Alex?)

Do you have the latest QDK?

Al

Alex posted 25-07-2002 18:09 BST          
There was a bug fixed in QDK 3.02 that was for a missing brace - but not for too many of them.

I do recall fixing something else in the shared ASL loading code that was to do with braces, although I can't find myself mentioning it in any of the versions text files, so Thraka if you could please confirm what version you're using...?

If it's Quest/QDK 3.1 then please send me a copy of your ASL file and I'll take a look into it.

Thraka posted 25-07-2002 19:44 BST          
Yes it's 3.1 I'll send it in email
Thraka posted 30-07-2002 20:52 BST          
Sent email awhile ago.. Havn't gotten to it yet?
Thraka posted 30-07-2002 22:15 BST          
It seems to happen whenever I add a second conditional statement to a rooms custom player command.