Most of the commonly reported issues and questions are answered in the Frequently Asked Questions (FAQ) option under the Support menu of this website.
*** PLEASE NOTE ***
Your forum account is not the same as the account used in the shop. They are completely separate accounts.
1st December: A new version of the GoFlight Interface Tool for MSFS is now available.
12th November: A new version of the GoFlight Interface Tool for X-Plane is now available.
6th June: A new version of Virtual Flight Sim Hardware is now available (huge update)
21st November: A new version of the GoFlight Interface Tool for FSX/FSXSE/P3D is now available.

Looping

Hi Steve,

  First time playing around with the Bespoke events, dumb qustion but how do you create a loop? I am trying create a Bespoke event for opening the PMDG 747F Cargo door, the Lvar is var_pmdg_nose.  The values go from 0 (fully closed) to 300 (fully open).

Here is the xml

<BespokeEvents> <Aircraft Data="<?xml version="1.0" encoding="utf-16"?><Events><Event Name="Open_Nose" ID="1"><Task ID="0" Type="Set" Var="var_pmdg_door_nose" Data="300" /></Event><Event Name="close_Nose" ID="2"><Task ID="3" Type="Label" Name="beg" /><Task ID="1" Type="If" Var="var_pmdg_door_nose" Operator="GREATER_THAN" Value="0" /><Task ID="6" Type="SetDec" Var="var_pmdg_door_nose" Data="10" /><Task ID="4" Type="Goto" LabelID="3" /></Event></Events>" Name="PMDG747-400F"/>

I get nothing.  I can simply set the Lvar to 0 to 300 to operate the door but I would rather it open smoothly.

Also is the sleep in ms?


Thanks

Kevin

 

Comments

  • edited March 2013

    Hi Kevin,

    The following bespoke events will do it, however it will tie the interface up for a couple of seconds. I do have the code nearly ready for background Bespoke Events that can run on a different thread and not tie up the interface. In the meantime these will do:

    Nose Up:

    :Start

    If var_pmdg_door_nose > 300 Next Else NextSkip

    Goto End

    var_pmdg_door_nose += 50

    Sleep 500

    Goto Start

    :End

     

    Nose Down:

    :Start

    If var_pmdg_door_nose < 1 Next Else NextSkip

    Goto End

    var_pmdg_door_nose -= 50

    Sleep 500

    Goto Start

    :End

     

    Best wishes

    Steve

  • edited November -1

    FYI - The Bespoke Event Time on the settings tab indicates how many commands will be exceuted before the event is cancelled. This stops things like infinite loops locking up the system.

    Thus if you want a slower opening door (ie. increment the lvar by 25 instead of 50) you will need to increase this value from 25 to something around the 50 mark.

    Best wishes

    Steve

     

  • edited November -1

    Thanks Steve.

      I am still trying to learn this.  Very powerful and usefull tool you have created!

     

    Kevin

     

  • edited March 2013

    Hi Kevin,

    I have added the facility to run Bespoke Events in the background. You can now increment var_pmdg_door_nose by 2 and use sleep 100 instead of 500. Ensure you tick "Run event in Background" so it won't tie up the interface.

    Note that all background events must execute within 60 seconds. The interface supports upto 20 concurrent background tasks.

    Best wishes

    Steve

  • edited November -1

    Thanks Steve.  I was able to get this appear a bit more smoothly using a smaller sleep value and smaller change the the lvar value.

    Kevin

     

     

     

Sign In or Register to comment.