Sign in to follow this  
Guest iagman

Ifs are broken and I can't fix it

Recommended Posts

FS9 xml; Below, the variable (L:Agauge_ControlValue, number) is increased/decreased in mouse click section. In the other gauge code, IF-lines 0 through 9 store the correct values in the three variables Left, Ctr, and Right as the ControlValue variable is changed. However, when the IF-line comparing (l1 10 ==) is added to code, stored values suddenly become incorrect. Left becomes a zero, Ctr stays 1000, and Right becomes 21. They retain these values no matter what value the ControlValue variable is changed to. What happens when the additional line is added to cause this and how do I overcome the problem because I need comparisons through (l1 25 ==). (L:Agauge_ControlValue, number) s1l1 0 == if{ 2 (>L:Agauge_Left, number) 1000 (>L:Agauge_Ctr, number) 1 (>L:Agauge_Right, number) }l1 1 == if{ 4 (>L:Agauge_Left, number) 1000 (>L:Agauge_Ctr, number) 3 (>L:Agauge_Right, number) }l1 2 == if{ 6 (>L:Agauge_Left, number) 1000 (>L:Agauge_Ctr, number) 5 (>L:Agauge_Right, number) }l1 3 == if{ 8 (>L:Agauge_Left, number) 1000 (>L:Agauge_Ctr, number) 7 (>L:Agauge_Right, number) }l1 4 == if{ 10 (>L:Agauge_Left, number) 1000 (>L:Agauge_Ctr, number) 9 (>L:Agauge_Right, number) }l1 5 == if{ 12 (>L:Agauge_Left, number) 1000 (>L:Agauge_Ctr, number) 11 (>L:Agauge_Right, number) }l1 6 == if{ 14 (>L:Agauge_Left, number) 1000 (>L:Agauge_Ctr, number) 13 (>L:Agauge_Right, number) }l1 7 == if{ 16 (>L:Agauge_Left, number) 1000 (>L:Agauge_Ctr, number) 15 (>L:Agauge_Right, number) }l1 8 == if{ 18 (>L:Agauge_Left, number) 1000 (>L:Agauge_Ctr, number) 17 (>L:Agauge_Right, number) }l1 9 == if{ 20 (>L:Agauge_Left, number) 1000 (>L:Agauge_Ctr, number) 19 (>L:Agauge_Right, number) }l1 10 == if{22 (>L:Agauge_Left, number) 1000 (>L:Agauge_Ctr, number) 21 (>L:Agauge_Right, number) }Thanks,Glenn

Share this post


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

The problem was no space in this line between bracket and 22 digits.l1 10 == if{22 (>L:Agauge_Left, number) 1000(>L:Agauge_Ctr, number) 21 (>L:Agauge_Right, number) }Glenn

Share this post


Link to post
Share on other sites

Or, if all those ifs drive you crazy:22 20 18 16 14 12 10 8 6 4 2 11(L:Agauge_ControlValue, number) case d (>L:Agauge_Left, number) 1 - (>L:Agauge_Right, number)1000 (>L:Agauge_Ctr, number) :)--Jon

Share this post


Link to post
Share on other sites

Perfect,I was hoping someone would suggest a better way to write all that code. I'll paste that into my little book.Thanks,Glenn

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this