Sign in to follow this  
Varmint007

How does inline "case" work?

Recommended Posts

I'm trying to set the value of a G:var based on the value of another, as in:18 (>G:Var1)1 2 8 10 11 12 15 16 18 19 20 11 (G:Var2) case 0 (>G:Var2)181 183 184 185 193 197 0 7 (G:Var2) case 18 (>G:Var2)But this obviously doesn't work:(. I'm trying to set the value of G:Var2 to either 0, if G:var1 = the one of the first set of values, or 18 if it's one of the second sets of values.Can anyone show me how the syntax would work for this?Thanks,--Jon

Share this post


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

Hi,Probably this works too:(G:Var1) 20 <= if{ 0 (>G:Var2) } els{ 18 (>G:Var2) }Jan"Procul Negotiis"

Share this post


Link to post
Share on other sites

If you look in xmlgau01.zip you'll find the case syntax a bit explained.It is first the values you want to get out of the case, then the numbers of entries, then the value the case depends on, then "case":e.g. setting G:Var2 depending on G:Var11 2 8 10 11 12 15 16 18 19 20 11 (G:Var1) case (>G:Var2)"1 2 8 10 11 12 15 16 18 19 20" are the values to set, these are 11 items, it depends on G:Var1, after the case you have the "cased" values, which can be written to G:Var2. Note the output can be quite reversed, I assume if G:Var1 is 0 the returned value is 20, 1->19,...,10->1. If you want it reversed, reverse the values.Arne Bartels

Share this post


Link to post
Share on other sites

Ah yes thanks, it was the output values that were stumping me. I was able to adjust the thing accordingly.Thanks again!--Jon

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