Axe Software Forums
  Quest Developer Forum
  Trouble with "has "


Author Topic:   Trouble with "has "
passerby posted 18-08-2001 21:44 GMT     
Could anyone help me, please?

i'm using quest 2.0 (and can't change), and the line:

if has <alarm;+0>

is not working for me. I'm trying to check that alarm is greater than 0, which is what that line is for, but even though i have checked thoroughly that alarm is 4, it just won't work. Any hints would be appreciated.

thanks,
passerby.

MaDbRiT posted 18-08-2001 22:17 GMT          
Do you have 'alarm' defined as a collectable? The 'has' test only works for collectables, not regular numeric variables.

(Always found that irritatiing myself, but you can live with it.)

Al

Computer Whizz posted 18-08-2001 23:40 GMT          
Isn't there an "if is <%var%;+0>" or something like that?
or couldn't you just use "if <%var%;+0>"....
I'm not too sure about that since I've upgraded to Q3.0.

Computer Whizz

Alex posted 19-08-2001 12:37 GMT          
quote:

Isn't there an "if is <%var%;+0>" or something like that?
or couldn't you just use "if <%var%;+0>"....

You're caught between a rock and a hard place on this one because Quest 2.x limits you to just "if is <something; something else>" - you would have to surroung the collectable name with ~tildes~ but then you've got no way of doing a comparison (other than an "equals") with "is".

In Quest 3.0 all is much nicer because you'd just have a numeric variable and you can use:

if ( %alarm% > 0 ) then ...

passerby posted 19-08-2001 15:12 GMT          
hang on alex, i just checked the "Quest 2.0" programmers reference that came with it, and using "has <(collectable); {+|-|=|!=}{(collectable)|(number)}>" is specifically mentioned twice, with examples given. Althought "is" tests equality only, yes.

More mysteriously, when i went back to look at a previous version of what i am doing it also used this construct in a different place, and it works!

and MaDbRiT, yes it is a collectable, but since this distinction has been giving me so much trouble, what is the difference between a collectable and a numeric variable?

thanks,
passerby

Alex posted 19-08-2001 16:32 GMT          
quote:

what is the difference between a collectable and a numeric variable?

A collectable is like a numeric variable, but is displayed on the inventory pane. It is intended for "status" type variables, e.g. health, money etc.

Collectables are replaced by a particular type of numeric variable in Quest 3.0 - "Status Variables". So you can use the same commands on both.

passerby posted 19-08-2001 19:24 GMT          
hi again.

have worked through my previous files again, and found that, yes, the greater than comparisons were not working after all. Luckily, i have been able to work around it though using "if not is".

but i have a new Q2.0 question. Please - it is possible to add and subtract from numerics and collectables isn't it??


thanks,
passerby.

MaDbRiT posted 19-08-2001 19:55 GMT          
quote:

have worked through my previous files again, and found that, yes, the greater than comparisons were not working after all. Luckily, i have been able to work around it though using "if not is".

but i have a new Q2.0 question. Please - it is possible to add and subtract from numerics and collectables isn't it??


Yes it is possible to add subtract from either a collectable of a numeric variable in Q2 - although the syntax is different for each.

An example, assuming alarm is a collectable with a value of 2;

set <alarm; +2>

Will add 2 to the value of the 'alarm' collectable, but if 'alarm' were a numeric variable to add 2 you have to code:

setvar <alarm; %alarm% +2>

Quite why Alex made Q2 work this way and not support 'greater than/less than' for numerics is a question only he can answer, but it really isn't a big deal, if you need to have a variable that requires those sort of comparisons you just have to use a collectable (and probably set it not to display.)

Al

passerby posted 21-08-2001 17:34 GMT          
thank you everybody, especially you, MaDbRiT.

your code works, and is now a part of my designers notes!


passerby