Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hi,

I'm writing an app that using the G5.csv file create by makerunways would move the aicraft in a specific position of the airports.

Due to some limits of VB I'm not able to do that with a single write of the offsets 560 and 568 and I'm facing some issues.

If it seems that I correctly write the value of the high part (ie the offset 564 long 4) checking the value before and after the writing (the formula lat_degrees/90*10001750), I'm not able to find the right formula to write the offset 560 long 4.

The same issue is to change the longitude (good value written at offset 572 long 4), but nothing to do with the low part at 568.

Hope in same help

Thanks and best regards

Joe

Posted

Due to some limits of VB I'm not able to do that with a single write of the offsets 560 and 568 and I'm facing some issues.

I don't believe that VB prevents you making an array sufficient to hold two values like that! If VB cannot support arrays it isn't a proper programming language!

If it seems that I correctly write the value of the high part (ie the offset 564 long 4) checking the value before and after the writing (the formula lat_degrees/90*10001750), I'm not able to find the right formula to write the offset 560 long 4.

Use a 64-bit variable instead. It is much much easier. How it is addressed in your version of VB I don't know, but see http://www.aivosto.com/vbtips/datatypes.html

Regards

Pete

Posted

Hi,

I have used all the variable types in VB, but I get aleays an overflow error tring to write at the same time the 64 bits

It is possible to define arrays in VB, but honestly I do not understand how this could solve the issue transforming from lat and lon in degrees to kt and lon in FSX format

Best regards

Joe

Posted

Longitude and Latitude need to be written as 64 bit integers. While VB6 doesn't actually have them, there is a 'currency' type which stores decimal numbers as 64 bit integers scaled by 10000.

You can use this to fake a 64 bit integer. Below is some code that writes the latitude. You can do the same for longitude and reverse the process for reading.


Dim latitude As Double
Dim FakeLat As Currency

latitude = 51.45
latitude = latitude * 90# / (10001750# * 65536# * 65536#)
FakeLat = latitude / 10000#

FSUIPC_Write(&H560, 8, VarPtr(FakeLat), dwResult)
FSUIPC_Process(dwResult)


[/CODE]

Paul

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
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.