- Messages
- 87
- Country
-
Hello all,
After some grueling trial and error lasting several days, Wanted to share with you how I was able to use the new <inputEvents> to disconnect the built in sim code for throttle control and output user input (joystick and buttons) to an L:var instead of triggering key events directly.
The example is what I came up with for intercepting throttle input for engine 1 and outputting them to an L:Var (L:THROTTLE1_SET,number) which will take a value of 0~1 corresponding to 0~100% user input throttle.
This might not be the easiest or cleanest way , but worked for me:
in my interior.xml:
After some grueling trial and error lasting several days, Wanted to share with you how I was able to use the new <inputEvents> to disconnect the built in sim code for throttle control and output user input (joystick and buttons) to an L:var instead of triggering key events directly.
The example is what I came up with for intercepting throttle input for engine 1 and outputting them to an L:Var (L:THROTTLE1_SET,number) which will take a value of 0~1 corresponding to 0~100% user input throttle.
This might not be the easiest or cleanest way , but worked for me:
in my interior.xml:
XML:
<Component ID="loadFadec">
<UseTemplate Name="Marwan_Custom_Fadec">
<THROTTLE_ID>1</THROTTLE_ID>
</UseTemplate>
</Component>
<Template Name="Marwan_Custom_Fadec">
<Parameters Type="Default">
<INPUT_EVENT_ID_SOURCE>ENGINE1</INPUT_EVENT_ID_SOURCE>
</Parameters>
<UseTemplate Name="ASOBO_Interaction_Base_Template">
<USE_INPUT_EVENT_ID>ENGINE1</USE_INPUT_EVENT_ID>
</UseTemplate>
</Template>
<InputEvent ID="ENGINE1">
<Presets>
<Extend Target="ASOBO_GIE_Anim_Handling">
<Parameters Type="Default">
<INPUT_EVENT_ID_SOURCE>ENGINE1</INPUT_EVENT_ID_SOURCE>
</Parameters>
</Extend>
<INPUT_EVENT_ID_SOURCE>ENGINE1</INPUT_EVENT_ID_SOURCE>
<Preset ID="ENGINE1_Throttle_#THROTTLE_ID#">
<INCREMENT>0.1</INCREMENT>
<UPPER_LIMIT>16384</UPPER_LIMIT>
<LOWER_LIMIT>(A:THROTTLE LOWER LIMIT, position 16k)</LOWER_LIMIT>
<INIT_CODE>(A:GENERAL ENG THROTTLE LEVER POSITION:#THROTTLE_ID#, position 16k) 16384 / s0 (>O:ENGINE_Throttle_#THROTTLE_ID#_Position)</INIT_CODE>
<Tooltip>
<Icon>MOVE_AXIS_Y</Icon>
<Interaction>PRIMARY_DOWN+Y_AXIS</Interaction>
<InteractionLockable>Y_AXIS</InteractionLockable>
<TTDescription RPN="True">@TT_Package.ENGINE_PUSH_TOGA_ACTION</TTDescription>
<TTValue RPN="True">(A:GENERAL ENG THROTTLE LEVER POSITION:1, percent) '%.1f%%' @sprintf</TTValue>
</Tooltip>
<Value>
<Units>percent</Units>
<Code>(O:ENGINE_Throttle_#THROTTLE_ID#_Position)</Code>
<Init>(A:GENERAL ENG THROTTLE LEVER POSITION:#THROTTLE_ID#, position 16k) 16384 / (>O:ENGINE_Throttle_#THROTTLE_ID#_Position)</Init>
<WatchVars>
<Simvar ID="GENERAL ENG THROTTLE LEVER POSITION:#THROTTLE_ID#"/>
</WatchVars>
</Value>
<Inc>
<Code>(L:THROTTLE#THROTTLE_ID#_SET,number) p0 + (>B:ENGINE1_Throttle_#THROTTLE_ID#_SET)</Code>
<Parameters>
<Param Type="Float" RPN="True">p0</Param>
</Parameters>
<Bindings>
<Binding EventID="THROTTLE_INCR"><!-- event manipulating all throttles (declared for each throttle preset) -->
<Param>0.1</Param>
</Binding>
<Binding EventID="THROTTLE_INCR_SMALL"><!-- event manipulating all throttles (declared for each throttle preset) -->
<Param>0.05</Param>
</Binding>
<Binding EventID="THROTTLE#THROTTLE_ID#_INCR">
<Param>0.1</Param>
</Binding>
<Binding EventID="THROTTLE#THROTTLE_ID#_INCR_SMALL">
<Param>0.05</Param>
</Binding>
</Bindings>
</Inc>
<Dec>
<Code>(L:THROTTLE#THROTTLE_ID#_SET,number) p0 - (>B:ENGINE1_Throttle_#THROTTLE_ID#_SET)</Code>
<Parameters>
<Param Type="Float" RPN="True">p0</Param>
</Parameters>
<Bindings>
<Binding EventID="THROTTLE_DECR"><!-- event manipulating all throttles (declared for each throttle preset) -->
<Param>0.1</Param>
</Binding>
<Binding EventID="THROTTLE_DECR_SMALL"><!-- event manipulating all throttles (declared for each throttle preset) -->
<Param>0.05</Param>
</Binding>
<Binding EventID="THROTTLE#THROTTLE_ID#_DECR">
<Param>0.1</Param>
</Binding>
<Binding EventID="THROTTLE#THROTTLE_ID#_DECR_SMALL">
<Param>0.05</Param>
</Binding>
</Bindings>
</Dec>
<Set>
<Code>p0 0 max 1 min s0 (>L:THROTTLE#THROTTLE_ID#_SET,number) l0 (>O:ENGINE_Throttle_#THROTTLE_ID#_Position)</Code>
<Parameters>
<Param Type="Float" RPN="True">p0</Param>
</Parameters>
<Bindings>
<!-- Aliases -->
<Binding Alias="ENGINE1_All_Throttle_Full_Forward"><!-- event manipulating all throttles (declared for each throttle preset) -->
<Param>1</Param>
</Binding>
<Binding Alias="ENGINE1_All_Throttle_Full_Backward"><!-- event manipulating all throttles (declared for each throttle preset) -->
<Param>0</Param>
</Binding>
<Binding Alias="ENGINE1_All_Throttle_Idle"><!-- event manipulating all throttles (declared for each throttle preset) -->
<Param>0</Param>
</Binding>
<Binding Alias="ENGINE1_Throttle_#THROTTLE_ID#_Full_Forward">
<Param>1</Param>
</Binding>
<Binding Alias="ENGINE1_Throttle_#THROTTLE_ID#_Full_Backward">
<Param>#LOWER_POSITION_PCT_OVER_100#</Param>
</Binding>
<Binding Alias="ENGINE1_Throttle_#THROTTLE_ID#_Idle">
<Param>0</Param>
</Binding>
<!-- EventIDs -->
<Binding EventID="THROTTLE_FULL">
<Param>1</Param>
</Binding>
<Binding EventID="THROTTLE_CUT">
<Param>0</Param>
</Binding>
<Binding EventID="THROTTLE#THROTTLE_ID#_FULL">
<Param>1</Param>
</Binding>
<Binding EventID="THROTTLE#THROTTLE_ID#_CUT">
<Param>0</Param>
</Binding>
<Binding EventID="THROTTLE#THROTTLE_ID#_SET">
<Param Type="Float" RPN="True">p1 16384 / 1 + 0.5 *</Param>
</Binding>
<Binding EventID="THROTTLE#THROTTLE_ID#_AXIS_SET_EX1">
<Param Type="Float" RPN="True">p1 16384 / 1 + 0.5 *</Param>
</Binding>
<Binding EventID="AXIS_THROTTLE#THROTTLE_ID#_SET">
<Param Type="Float" RPN="True">p1 16384 / 1 + 0.5 *</Param>
</Binding>
<Binding EventID="THROTTLE_SET">
<Param Type="Float" RPN="True">p1 16384 / 1 + 0.5 *</Param>
</Binding>
<Binding EventID="THROTTLE_AXIS_SET_EX1">
<Param Type="Float" RPN="True">p1 16384 / 1 + 0.5 *</Param>
</Binding>
<Binding EventID="AXIS_THROTTLE_SET">
<Param Type="Float" RPN="True">p1 16384 / 1 + 0.5 *</Param>
</Binding>
</Bindings>
</Set>
</Preset>
</Presets>
</InputEvent>
Last edited: