# Newbie logic problem

## Recommended Posts

I am trying to write a guage that displays a different bitmap depending on certain combinations of spoiler and flap handle positions. I think I am using the If statement incorrectly but cannot find a good example of a nested if statement. Perhaps there is a better way.Any insight would help.- Chris (A:SPOILERS LEFT POSITION, percent) 1 >=; (A:FLAPS HANDLE INDEX, enum) 4 > && if{ 3 (>L:SpeedBrakeCond, number) } (A:SPOILERS LEFT POSITION, percent) 1 >=; (A:FLAPS HANDLE INDEX, enum) 4 <=; && if{ 2 (>L:SpeedBrakeCond, number) } (A:SPOILERS LEFT POSITION, percent) 1 >=; (A:FLAPS HANDLE INDEX, enum) 2 <=; && if{ 1 (>L:SpeedBrakeCond, number) } (A:SPOILERS LEFT POSITION, percent) 1 < (A:FLAPS HANDLE INDEX, enum) 0 == && if{ 0 (>L:SpeedBrakeCond, number) } (L:SpeedBrakeCond, number)

##### Share on other sites
 Help AVSIM continue to serve you!Please donate today!

Hi,It seems to be a logical issue here, because(A:FLAPS HANDLE INDEX, enum) 4 <=; and(A:FLAPS HANDLE INDEX, enum) 2 <=; Both return the same bool value when result is 2 or less , but you are assigning different (SpeedBrake) valuesI guess you actually want to do (A:FLAPS HANDLE INDEX, enum) 2 > 4 <= so you might replace the sentence with (A:FLAPS HANDLE INDEX, enum) 4 <=; for something like (not tested):(A:SPOILERS LEFT POSITION, percent) 1 >=; (A:FLAPS HANDLE INDEX, enum) d 2 > 0 max 4 <= * && if{ 2 (>L:SpeedBrakeCond, number) } Some better and faster approaches can be achieved if you know how to deal with registers (s0,s1, etc-l0,l1 etc)Regards,Tom Edit: Lately I recalled of semicolon after ">=", you should erase it from the code to work ok.

## Create an account

Register a new account

• Tom Allensworth,
Founder of AVSIM Online

• ### Hot Spots

• Flight Simulation's Premier Resource!

AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!