Jump to content
Sign in to follow this  
Guest Eugen

String for Radio Height

Recommended Posts

Guest harry3

%((P:Units of measure, enum) 2 == if{ (A:Radio height, meters) } els{ (A:Radio height, feet) } d 4500 <= )%{if}%(1 /)%!04d!0%{end}Hi!Look at the string above. It's to show the alt above the ground on an EADI. I've took the source code for this string from an other gauge and just edited the string a bit. This was long time ago. At this time I thought not even looking at the string-code would be the best!!! Since then, I (nearly)never had to work with strings again.But there always was one little problem(and one question), which I thought is not that important. It really isn't, but I want to know it:1.)Why is (P:Units of measure, enum) used here. Isn't this the sim-rate??? What does this do in the code?2.) As defined, the string should be int and should have 4 digits. But if there's just "350feet" shown, it shows up 0350. How to cut the "0" away??? Maybe with abs??? I didn't want to try it, because I'm an absolute full at string-codes!Is there anywhere a good discription about strings? Regards,Harry :-)

Share this post


Link to post
Share on other sites
Guest Eugen

Hi Harry,About P:Units of measure, enum I think that is connected to which settings you use fs 2002 I had a problem with an altimeter not "showing correct" which was dependant upon international settings settings ie showing meters insted of feet..I am not very good at strings but I think that you can try to remove the zeros in your code. Try %!4d! In the Arne Bartel's xml guide zip file there are some hmtl pages describing printing I thinkhave a look at them...BrgdsEugen

Share this post


Link to post
Share on other sites
Guest bartels

Strange shouldn't it be "10 /" instead of "1 /"?In difference to the SDK there are more than one variable available under the P: prefix, one of them is "Units of measure" to show the unit system you have selected at the moment. 0 for US-System with alts in feet and temperatures in Farenheit, 1 for metric sytem with alt in feet and temps in Celsius and 2 for alts in meters and temperature in Celsius. You find a complete list of P: vars in my p_vars.txt file.The format !04d!0 means, that there is always a trailing zero, that's why I'm asking if it should be divided by ten instead of one.!04d! means for digits and fill up to the left with 0 if necessary, if you don't want leading zeros write !4d!. Arne Bartels

Share this post


Link to post
Share on other sites
Guest Eugen

Hi,for example !3.1f! means 3 number in total included the one after the point or 3 before the point and one after?RgdsEugen

Share this post


Link to post
Share on other sites
Guest bartels

Three chars in total, one before the decimal, the decimal point itself and one digit after the decimal. So 1.09123456789 is displayed as "1.1". If the value is too high (>=10) it is often displayed corrrectly with one digit after the decimal point, this seems to depend on the Length parameter.Arne Bartels

Share this post


Link to post
Share on other sites
Guest Eugen

I see, I think I understand the logic :-)Eugen

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...