Jump to content
The simFlight Network Forums
vbegin7

Player altitude pause

Recommended Posts

@Pete Dowson

FSUIPC is awesome pete thanks for creating such fine development.

on a richer not im trying to create a variable in an acars system im building for the user to select a checkbox to pause at 10,000 ft this is what i have and it doesnt like it too much.

 

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

        If (tenth.Checked) Then

            tenth.Checked = False

        Else

            tenth.Checked = True
            playerAltitude = 10000 // or getaltitude() 
            pause1.Checked = True

        End If
    End Sub

Thanks for any help given

Best Regards,

Vince

Share this post


Link to post
Share on other sites

Hi Vince,

Generally, to achieve what you want, you need to be checking the altitude regularly in a timer. If the altitude is 10000 AND the checkbox is checked then you need to pause.

However, the altitude may never be exactly 10000, it might go from 9999 to 10001 so you need to test a range.

Something like this (Not real code):

TimerEvent:
	FSUIPCConnection.Process()
    alt = getCurrentAltitudeInFeet()
    if alt < 10100 AND alt > 9900 AND pauseAt10000 is checked
       pauseSim()
       pauseAt10000.checked = false
    end if

 

Paul

Share this post


Link to post
Share on other sites
41 minutes ago, Paul Henty said:

Hi Vince,

Generally, to achieve what you want, you need to be checking the altitude regularly in a timer. If the altitude is 10000 AND the checkbox is checked then you need to pause.

However, the altitude may never be exactly 10000, it might go from 9999 to 10001 so you need to test a range.

Something like this (Not real code):


TimerEvent:
	FSUIPCConnection.Process()
    alt = getCurrentAltitudeInFeet()
    if alt < 10100 AND alt > 9900 AND pauseAt10000 is checked
       pauseSim()
       pauseAt10000.checked = false
    end if

 

Paul

Thanks paul, 

for the reply i will give it a whirl

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

×

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.