Jump to content
Sign in to follow this  
Guest jfarrer@telus.net

Conditioned Printing

Recommended Posts

Guest rkruijer

Hi,%((A:INDICATED ALTITUDE,feet)(L:Var,feet) < )%{if} ALTITUDE %{end} This works but ....%((A:PLANE LATITUDE,feet)(L:Var,feet) < )%{if} (A:INDICATED ALTITUDE,feet) %{end} does not work! So printing the word "ALTITUDE" works alright but printing a Variable does not.Am I doing something wrong or is there a work around?Thanks for your timeRoerlof

Share this post


Link to post
Share on other sites

Hi,Try to add: %!d!%((A:PLANE ALTITUDE,feet)(L:Var,feet) <)%{if}%((A:INDICATED ALTITUDE,feet))%!d!%{end}Jan"Beatus ille qui procul negotiis..."

Share this post


Link to post
Share on other sites

You need to 'printf' the variable. With literal strings like 'ALTITUDE' you just type the characters and they appear:%ALTITUDEWith numeric variables, you need to define the format that they're to 'print' with:%((A:INDICATED ALTITUDE,feet))%!d!%!d! will print an integer.!6.3f! will print 2 places in front of the decimal and 3 behind. The first value (before the decimal) is the total number of places (integer + the decimal point itself + the decimals. The second value is the number of decimals. Confusing you yet?For example if your altitude is 36089.535 feet and you want to ignore the decimal feet, you'd use %((A:INDICATED ALTITUDE,feet))%!d!% the result will be '36089'If you wanted to print 2 positions after the decimal you'd use:%((A:INDICATED ALTITUDE,feet))%!8.2f!%The result would be 36089.53So your code would look like this (assuming you want to ignore the decimals).%((A:PLANE LATITUDE,feet) (L:Var,feet) <)%{if}%((A:INDICATED ALTITUDE,feet))%!d!%{end}--Jon

Share this post


Link to post
Share on other sites
Guest rkruijer

Thank you gentlemem. It was just a matter of syntax. I thought I had it covered {if}%((A:INDICATED ALTITUDE,feet))%!3d!%{end}but had forgotten the last % and never saw it.Thanx againRoelof

Share this post


Link to post
Share on other sites
Guest jfarrer@telus.net

Thanks Jon.:) Now could you explain the letter variables?I've been more or shooting in the dark since the SDK doesn't explain these values although I know what works in certain circumstances. You used both 'd' and 'f' in the above example. I knew 'd' displayed an integer but I thought 'f' was a frequency tag. I've also seen an 's' although the one time I saw it while perusing some code it was used with an actual text entry.Rgds: Jeff

Share this post


Link to post
Share on other sites
Guest rkruijer

Jeff'f' is for floating point's' for string'd' for integerLeading Zeros and spaces between digits.For zeros. 0 and de length of the number to display in front of d or f determens the number of leading zeros. Remember the period also counts in the length%Local QNH %((A:BAROMETER PRESSURE,millibar))%!4.2f!Will Show: QNH 1013.25 %MagnHeadRwy1 %((L:RALS RWMagHead1, degrees))%!03d!Will Show: 006 if degrees is 6%MagnHeadRwy2 %((L:RALS RWMagHead2, degrees) 100 / int)%!d!% %((L:RALS RWMagHead2, degrees) 100 % 10 /)%!d!% %((L:RALS RWMagHead2, degrees) 10 %)%!d! Will Show: 1 9 6 if degrees is 196 %MagnHeadRwy2 %((L:RALS RWMagHead2, degrees) 100 / int)%!01d!% %((L:RALS RWMagHead2, degrees) 100 % 10 /)%!01d!% %((L:RALS RWMagHead2, degrees) 10 %)%!01d!Will Show 0 0 6 if degrees is 6%!003d!° Will show the degree symbol as wellHope this tells you what you want to konwRoelof>Thanks Jon.>:) Now could you explain the letter variables?>I've been more or shooting in the dark since the SDK doesn't>explain these values although I know what works in certain>circumstances. You used both 'd' and 'f' in the above example.>I knew 'd' displayed an integer but I thought 'f' was a>frequency tag. I've also seen an 's' although the one time I>saw it while perusing some code it was used with an actual>text entry.>>Rgds: Jeff

Share this post


Link to post
Share on other sites
Guest jfarrer@telus.net

Thanks Roelof.That cleared up a few misconceptions I had!Always useful to know 'when' something works, but even more useful to know 'why' it works.Merry Christmas.Rgds: Jeff

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  

  • Tom Allensworth,
    Founder of AVSIM Online


  • 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!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...