Thanks for your help! and quick response...
It works exactly the way I wanted..


on 6/23/01 10:32 PM, Tab Julius at [EMAIL PROTECTED] wrote:

> 
> Sure, you practically said it yourself.  You just need to get the syntax
> correct.
> 
> 
> xLoc =the mouseH
> if (xLoc <=100) then
> -- mouse is in 0..100 range
> else if (xLoc <=300) then
> -- mouse is in 101..300 range
> else if (xLoc <=500) then
> -- mouse is in 301..500 range
> else
> -- mouse is greater than 500
> end if
> 
> You can get away with doing it this way, because we evaluate the lowest
> first, so we aren't testing if it's <=500 unless we've already determined
> that it's not less than 100 and not less than 300, ergo it's at least 300.
> 
> Another way, which I think you were asking for, is to test for ranges.  It
> would be done like this:
> 
> if (xLoc > 100) and (xLoc <=300) then
> -- In the range 101..300
> end if
> 
> Note my use of <=, and not just <.  This is because if you check as you
> described, the actual numbers of 100 and 300 are undefined.  By using <=
> you make it inclusive.
> 
> To do a double test, like:  if (xLoc > 100) and (xLoc <=300) then
> the trick is that each part (to the left and to the right of the 'and'
> statement) be able to evaluate to TRUE or FALSE, and then the whole thing
> is evaluated to see if (the LEFT side is true) AND (the RIGHT side is true).
> 
> Some people make the mistake of doing:
> 
> if (xLoc > 100 and < 300) then
> 
> which matches how we express things in language, but for the computer,
> something's missing.
> 
> - Tab
> 
> At 10:27 PM 6/23/01 -0400, Guy St-Jean wrote:
>> I am working on a project where an object slides from left to right on the
>> stage controlled by the mouseH.  I am trying to figure out if there s a way
>> to get the < and > symbol to evaluate at the same time.  Something like if
>> x<5 but not > 30 then something.
>> 
>> When my object on sprite 3 is < 100 then a text will appear, when it is >
>> 100 but < 300 then another text will appear, and if it is > 300 but < 500
>> then another text will appear.
>> Would anyone have a solution to my problem?
>> 
>> Thanks in advance.
> 
> 
> [To remove yourself from this list, or to change to digest mode, go to
> http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
> email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
> Lingo-L is for learning and helping with programming Lingo.  Thanks!]
> 


[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to