# Next Waypoint Distance

## Recommended Posts

Hi,- - - %((A:GPS WP Distance,nMiles) 0 max 9999.9 min)%!3d!- - GPS_WP_DISTANCE,NMilesThis is a "Next waypoint Distance" gauge I'm working actually.Problems are:1)At the panel opening appears only 0. I would like 00.0 and always numbers have to be shown by 2 figures plus a decimal one.2)if I put as unit "nMiles" the value will be rounded to the nearest mile value.If I put as unit "DecinMiles" the value appears ,I think it's right, showing the total decinMiles.Example: If I load a flight plan where the first waypoint distance is 41.9NM if the unit in the gauge is "NMiles" I'll have shown on the panel 42(value rounded to the nearest one),if the unit is "decinMiles" on the panel appears 419.How can I manage to have on the panel as value 41.9 and always three figures as written above?Thanks in advanceG.Franco

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

I'm posting a correction of my previous post.At the panel opening and always I would like four digits:000.0 not as I wrote wrongly only three.Sorry for the new message but the time was expired.Regards G.Franco

##### Share on other sites

Hi,Try:%((A:GPS WP Distance,Nmiles))%!3.1f! Hope it helps,Jan"Beatus ille qui procul negotiis..."

##### Share on other sites

Hi,If you actually need leading zeroes, like "043.2", I will dare to amend Jan's line :-) because I think "f" doesn't support that.So, if you really need the leading 0's, and !3.1f! doesn't work, just try (not tested)%((A:GPS WP Distance,Nmiles) s0 int)%!03d!.%(l0 1 %)%!d! Tom

##### Share on other sites

hi Tom,thanks for the help.I tryied your string and now the leading zeros appear but the decimal is missing.The right expected distance to be shown is 041.9 with your string appears only 041 Looking at Microsoft SDK I found an example to have the altimeters showing thousand of feet: it's suggested to divide by 1000.Don't you think that using as unit "DecinMiles" and dividing by 10 it should be a good idea?I tryied it but the gauge stops working maybe I made an other error.Regards G.Franco

##### Share on other sites

Hi Gianfranco,THis is the correct line:%((A:GPS WP Distance,Nmiles) s0 int)%!03d!.%(l0 1 % 10 * int)%!d! Mind the "." after the "!03d!" and before the "%" that indicates the decimal point's position.Also watch the longitude of the because if it is too short, the value won't show complete. Tom

##### Share on other sites

Hi Tom,an other step has been made.Now the distance value appears 000.0 but the decimal is stuck to zero.Decimal shows always zero.Thanks again G.Franco

##### Share on other sites

As Tom has mentioned, "leading zeros" will not be added to any floating point format specification. From Susan Ashlock's blog* (Lead Gauge Programmer at ACES) :%( 12.34 )%!04.3f!12.340 (Leading

##### Share on other sites

Hi,I have DME with leading 0's and decimals (eg: 003.2) using rolling numbers.Jan"Beatus ille qui procul negotiis..."

##### Share on other sites

hi to all,now the gauge works properly!My error was due to lower case L.I typed "|" instead of "l" and this was the reason why the decimal was stuck to zero.I'm a beginner and for this issue I do have to consider how difficult is to make gauges.Thanks to all of you for the help and lesson.Regards G.Franco

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