Sign in to follow this  
Guest iagman

What's wrong?

Recommended Posts

Is not the L:LAT1 variable being assigned the contents of the A:PLANE LATITUDE variable? I only get a zero to print. What's wrong with my code? For LAT1 I've tried radians, number, degrees latitude with no success for any. (A:PLANE LATITUDE, degrees latitude) (>L:LAT1, radians)%((L:LAT1, radians))%!s!All help appreciated,Glenn

Share this post


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

>Is not the L:LAT1 variable being assigned the contents of the>A:PLANE LATITUDE variable? I only get a zero to print. What's>wrong with my code? For LAT1 I've tried radians, number,>degrees latitude with no success for any.>> >>(A:PLANE LATITUDE, degrees latitude) (>L:LAT1,>radians)>>Color="White" BackgroundColor="Black" >Adjust="Center" VerticalAdjust="Center"> >%((L:LAT1, radians))%!s!>>>All help appreciated,>Glenn Try changing "(A:PLANE LATITUDE, degrees latitude)" to "(A:PLANE LATITUDE, degrees)". I think you can set ",number" in the L:Variables. Or, leave ',degrees' if you need ',radians' later. Ron

Share this post


Link to post
Share on other sites

As Ron pointed out, "degrees latitude" is not correct. There is a file in the SDK that specifies the available "units" for variables. You cannot simply make up your own... ;)My question is, what is your intention for assigning the A:var to an L:var to begin with? Are you planning to use it for some as yet to be determined calculation?

Share this post


Link to post
Share on other sites

The SDK units .doc shows degree latitude as well as degree longitude. But it also has just degree which I'll try.I want to capture a lat1/lon1, store these values, then, after a delay of perhaps a few seconds or so, capture lat2/lon2. Using these, I want to calc. the course between the two sets of coordinates.Glenn

Share this post


Link to post
Share on other sites

Degree does not work either.In the code below, the "Print A variable" section does print out latitude (47.936) when tested in FS. But the "Print L variable" section still outputs only a zero. I do not understand why in the second section that the A variable is not being assigned to the L variable. As I said, I've tried every unit available for latitude and a few that weren't. They all produce the same result.A:Lat%((A:PLANE LATITUDE, degree latitude))%!s!Lat1(A:PLANE LATITUDE, degree latitude) (>L:LAT1, degree latitude)%((L:Lat1, degree latitude))%!s!

Share this post


Link to post
Share on other sites

Hi,You might try this:Make (A:PLANE LATITUDE, radians) (>L:Lat1, radians)Then use %((L:Lat1,degrees))%!3.5f!LVars can't accept string values, so I am not sure if format operator "!s! will make the convertion.This may be a problem of unit compatibility. Tom

Share this post


Link to post
Share on other sites

Hi,Not exactly knowing what you want.If you only need to show Lat and Lon you can use:%((A:PLANE LATITUDE, degrees) d 0 >= )%{if}%N%{else}%S%{end}%( abs d flr )%!02d!

Share this post


Link to post
Share on other sites

"This may be a problem of unit compatibility."I have tried the code below to get around your suggestion.(A:PLANE LATITUDE, degree) (>G:Var1)Even the G Variable contains a zero.There is something I'm missing here when I try to store the A:PLANE LATITUDE variable into either an L variable or a G variable. Neither seems to accept any value regardless of what unit I use for the A variable or what unit I use inside the String print function. Glenn

Share this post


Link to post
Share on other sites

Iagman,It is not "degree", it's "degrees" :-)Besides, I just tested these variations and ALL work perfect:(A:Plane Latitude, degree latitude) (>L:Lat1, degree latitude)%((L:Lat1, degree latitude))%!s! (A:Plane Latitude, degrees) (>L:Lat1, degrees)%((L:Lat1, degrees))%!3.4f!(A:Plane Latitude, radians) (>L:Lat1, radians)%((L:Lat1, degrees))%!3.4f!(A:Plane Latitude, radians) (>L:Lat1, radians)%((L:Lat1, radians))%!3.4f!Tom

Share this post


Link to post
Share on other sites

Hi,Just an idea.May be you can use s0 and after a few seconds s1 etc. to store the planes positions.Then using the great circle formula you can calculate the course.Jan"Beatus Ille Procul Negotiis"

Share this post


Link to post
Share on other sites

The SDK Units I D/L from MS says degree (singular). The list is below.Angle

Share this post


Link to post
Share on other sites

>I'll try plural and see what happens. How did you know to use>degrees?>GlennIt isn't the first time that the SDK's have contained errors...Looking at the example gauges that were provided with the sim are great resources for seeing what actually does work... ;)

Share this post


Link to post
Share on other sites

There must be something wrong other than code. If you get the code to work and I can't then there is some other problem. The code below works fine and String prints the latitude as 47.936 in my test gauge.(A:PLANE LATITUDE, degrees) (>L:LAT1, degrees)%((A:PLANE LATITUDE, degrees))%!s!The next code below is identical to the above except for the String to be printed. Using this code, I can only get a zero to print. For some unknown reason the L:LAT1 variable will not accept the value from the A:PLANE LATITUDE variable.(A:PLANE LATITUDE, degrees) (>L:LAT1, degrees)%((L:LAT1, degrees))%!s!I do not think it is a "units" problem I've tried all combinations of radian, radians, degree, degrees, degree latitude, degrees latitude, number, etc and none of these allow the L-variable to print anything other than 0.As posted previously, I've tried this:(A:PLANE LATITUDE, degrees) (>G:Var1). Printing out the G variable also produces a zero. Glenn

Share this post


Link to post
Share on other sites

>How did you know to use degrees?I use units.txt as a reference. It's a text file extracted from Arne Bartel's XMLGAU01.ZIP (available on Avsim File Library).Tom

Share this post


Link to post
Share on other sites

>There must be something wrong other than code. If you get the>code to work and I can't then there is some other problem. >>The code below works fine and String prints the latitude as>47.936 in my test gauge.>Color="White" BackgroundColor="Black" >Adjust="Center" VerticalAdjust="Center">>%((A:PLANE LATITUDE, degrees))%!s!>......>The next code below is identical to the above except for the>String to be printed. Using this code, I can only get a zero>Color="White" BackgroundColor="Black" >Adjust="Center" VerticalAdjust="Center">>%((L:LAT1, degrees))%!s!...>I do not think it is a "units" problem I've tried all>combinations of radian, radians, degree, degrees, degree>latitude, degrees latitude, number, etc and none of these>allow the L-variable to print anything other than 0.>>Glenn Why are you using the "%!s!" format? Even though you show it for the working and non-working example, most other's used something like "%!5.2f%" to display a numerical value.Ron

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