Jump to content
The simFlight Network Forums

FSX Problem!


A320_Pilot

Recommended Posts

Hi George,

 

We have already discussed this back in January. What you are asking for is very complex code. It would take many days to write.

 

All I can do in this forum is tell you how you might go about doing this. I can't write your code for you.

 

In addition to Graham's help above, I can only repeat my advice from January:

 

 

 

You would do something like this:

 

1. Find current player position

2. Work out the Lon, Lat coordinates of a box 5NM around the player

3. Select the airports from the database that have coordinates within this box

 

You can use the FsLatLonPoint class in my DLL to help with getting the coordinates of the test box. See the UserGuide.pdf (Pages 16 & 17) for more details on this class.

 

If you get more than 1 airport back you can measure the distance to each one and find the closest. You can use FsLatLonPoint for this also.

 

 

 

 

Paul

Link to comment
Share on other sites

  • 1 month later...

Where is my error?

private void openFSUIPC()
        {
            //---------------------------------------------------------------------------------//
            try {
                //---------------------------------------------------------------------------------//
                //Ckeck parking brake
                //---------------------------------------------------------------------------------//
                if (PBrake.Value == 1)
                {
                MessageBox.Show(CLIENT_MSG18_RU,
                AUTH_ERR0_RU,
                MessageBoxButtons.OK,
                MessageBoxIcon.Exclamation);
                FSUIPCConnection.Open();
                this.startfl.Enabled = false;
                this.endfl.Enabled = true;
                this.timer1.Interval = 200;
                this.timer1.Enabled = true;
                this.connect_m.Text = (FSUIPC_MSG2_RU);
                }
                //---------------------------------------------------------------------------------//
                else
                //---------------------------------------------------------------------------------//
                {
                FSUIPCConnection.Close();
                this.startfl.Enabled = true;
                this.endfl.Enabled = false;
                this.connect_m.Text = (FSUIPC_MSG1_RU);
                }
                //---------------------------------------------------------------------------------//
            }
            //---------------------------------------------------------------------------------//
            catch
                (Exception ex) {
                MessageBox.Show(ex.Message,
                FSUIPC_ERR0_RU,
                MessageBoxButtons.OK,
                MessageBoxIcon.Error);
                }
            //---------------------------------------------------------------------------------//
        }
Link to comment
Share on other sites

What's the problem?

 

Just from looking at the code, I think you'll probably want to disable the timer1 in the 'else' block.

 

Also in the catch block I recommend you call FSUIPCConnection.Close() just to clean things up if the connection failed.

 

Other than that, you need describe the problem you are having.

 

Paul

Link to comment
Share on other sites

Sorry but this isn't making any sense to me.

 

First you say: "Why is it still does not connect with the simulator"

 

Then you say "Connection is open".

 

The code you posted is trying to open the connection. How can your connection already be open?

 

Paul

Link to comment
Share on other sites

  • 2 years later...
On 14.02.2014 at 7:33 PM, A320_Pilot said:

private Offset<short> simrate = new Offset<short>(0x0C1A);

Correct?

I do it like this...

Dim tSimrate As Offset(Of Short) = New FSUIPC.Offset(Of Short)(&HC1A)

If tSimrate.Value = 256 Then SimRate1 = True Else SimRate1 = False

But be aware that, I just wanna know if the pilot is using x1 simrate or not, I don't care if he increases or decreases the sim rate, I just care if he flies normally or not! 

Link to comment
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
×
×
  • 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.