INTERACTION CONFIGURATIONS
Once the cockpit interactions have been setup, you will want to properly configure the maximum amount of instruments before making use of Interaction Procedures for more demanding or complex (interdependent) configurations.
The configuration of an instrument corresponds to the "behind the scenes" of what happens when you move switch, or push a button, etc... and configurations fall broadly into three categories:
- the button (with a state)
- the discrete state configuration
- the event (without any state)
All parameters set in an interaction can also be set in the return field of the configuration being created, allowing you to create custom mouserect code snippets easily (see Advanced Interactions for more information).
Watching Variables
An important part of configurations - and templates in general - is the ability to watch variables. A watched variable is one that is being polled constantly for data. To make use of watch vars for any given input event you can use some included Parameter Function helpers to add one - or several - SimVars or LocalVars (XMLVars) to track:
| Template Name | Description |
|---|---|
ASOBO_Watch_Simvar_Helper |
Take a single SIMVAR to watch, for example:
|
ASOBO_Watch_Simvars_Helper |
Take a list of SIMVARs to watch, for example:
Note that you must use the |
ASOBO_Watch_LocalVar_Helper |
Take a single LOCAL_VAR to watch, for example:
|
ASOBO_Watch_LocalVars_Helper |
Take a list of LOCAL_VARs to watch, for example:
Note that you must use the |
Generic Helper Functions
Here is an additional list of generic ParameterFN that can also be used to help you setup an input event:
| Template Name | Description |
|---|---|
ASOBO_Append_Init_Code_Helper |
Take an <INIT_CODE> to append to <IE_VALUE_INIT_CODE>, for example:
|
ASOBO_Append_Value_Code_Helper |
Take an
|
ASOBO_Append_Inc_Code_Helper |
Take an <INC_CODE> to append to <IE_INC_CODE>, for example:
|
ASOBO_Append_Dec_Code_Helper |
Take an
|
ASOBO_Append_Set_Code_Helper |
Take an
|
Note that all of these functions use the same base function and will also accept the following parameter:
<APPEND_BEFORE>- If "true", the provided content will appended before any already existing content.
Discrete State Configurations
To give an example of a simple configuration, we'll look at a simple switch and see what we can do to configure the switch to toggle the autopilot yaw damper mode. Here is the basic switch XML:
<UseTemplate Name="ASOBO_IT_Switch_Template">
<IN_BASE_NAME>OVHD_FLT_CONTROL_SWITCH_YAW_DAMPER_1</IN_BASE_NAME>
<IE_NAME>YAW_DAMPER</IE_NAME>
<GET_SETTINGS>ON_OFF_Settings</GET_SETTINGS>
<SOUND_EVENT_TYPE_ID>1</SOUND_EVENT_TYPE_ID>
</UseTemplate>
<!-- Config xml -->
<ParametersFn Name="ON_OFF_Settings ">
<ReturnParameters>
<UseParametersFn Name="ASOBO_Auto_Define_Positions_And_Tooltips_Helper">
<!-- Each Pos defined here needs a POS_#_CHECK and a POS_#_CODE in your Setting_Config -->
<POS_0>ON</POS_0>
<POS_1>OFF</POS_1>
</UseParametersFn>
</ReturnParameters>
</ParametersFn>
To create a configuration for this switch the first thing to do is create a new Parameter Function. Since we want to configure the switch to toggle the autopilot yaw damper mode, we'll call our function YAW_DAMPER_Settings_Config. The basics of this parameter function will be the following:
<ParametersFn Name="YAW_DAMPER_Settings_Config">
<ReturnParameters>
<UseParametersFn Name="ASOBO_Auto_Define_XStates_Variant_Helper"/>
<!-- Check position -->
<POS_OFF_CHECK></POS_OFF_CHECK>
<POS_ON_CHECK></POS_ON_CHECK>
<!-- Set position -->
<POS_OFF_CODE></POS_OFF_CODE>
<POS_ON_CODE></POS_ON_CODE>
</ReturnParameters>
</ParametersFn>
NOTE: We make use of ASOBO_Auto_Define_XStates_Variant_Helper to ensure that the interaction parameters will be handled by the correct parser.
Now we need to fill in the POS fields. To do so we can use another helper function provided by the Model Behaviors Templates giving a simple interface to all SimVars. In this case we’ll be using the ASOBO_Yaw_Damper_Parameters helper, which is defined as follows:
<ParametersFn Name="ASOBO_Yaw_Damper_Parameters">
<Parameters Type="Default">
<SIMVAR_YAW_DAMPER>AUTOPILOT YAW DAMPER</SIMVAR_YAW_DAMPER>
</Parameters>
<Parameters Type="Default">
<GET_YAW_DAMPER>(A:#SIMVAR_YAW_DAMPER#, Bool)</GET_YAW_DAMPER>
<SET_YAW_DAMPER>(>K:YAW_DAMPER_SET)</SET_YAW_DAMPER>
<TOGGLE_YAW_DAMPER>(>K:YAW_DAMPER_TOGGLE)</TOGGLE_YAW_DAMPER>
</Parameters>
<ReturnParameters>
<SIMVAR_YAW_DAMPER>#SIMVAR_YAW_DAMPER#</SIMVAR_YAW_DAMPER>
<GET_YAW_DAMPER>#GET_YAW_DAMPER#</GET_YAW_DAMPER>
<SET_YAW_DAMPER>#SET_YAW_DAMPER#</SET_YAW_DAMPER>
<TOGGLE_YAW_DAMPER>#TOGGLE_YAW_DAMPER#</TOGGLE_YAW_DAMPER>
</ReturnParameters>
</ParametersFn>
To make use of it, we add a <Parameters> element with a <UseParametersFn> sub-element where the yaw damper function is the target:
<Parameters Type="Override">
<UseParametersFn Name="ASOBO_Yaw_Damper_Parameters"/>
</Parameters>
Now we can use the interface to check and set the SimVar as needed:
<!-- Check position -->
<POS_OFF_CHECK>#GET_YAW_DAMPER# !</POS_OFF_CHECK>
<POS_ON_CHECK>#GET_YAW_DAMPER#</POS_ON_CHECK>
<!-- Set position -->
<POS_OFF_CODE>0 #SET_YAW_DAMPER#</POS_OFF_CODE>
<POS_ON_CODE>1 #SET_YAW_DAMPER#</POS_ON_CODE>
With that we're almost finished creating the switch configuration, with the final thing to do being synchronise the SimVar state to the switch state, ie: we want the switch to automatically move if the SimVar is changed externally (from a user keybind or any other source). To sync a SimVar to an input event we will use the ASOBO_Watch_Simvar_Helper function, along with the SimVar AUTOPILOT YAW DAMPER provided for us by the helper function in the #SIMVAR_YAW_DAMPER# parameter. The function ensures that our input event will be notified when the SimVar value changes so that the value field is recalculated. All we need to do now is add the following statement to our configuration to include this SimVar:
<UseParametersFn Name="ASOBO_Watch_Simvar_Helper">
<SIMVAR>#SIMVAR_YAW_DAMPER#</SIMVAR>
</UseParametersFn>
The final step is to add the configuration "getter" to override the default interaction by adding the following statement in the initial <UseTemplate> element:
<GET_SETTINGS_CONFIG>YAW_DAMPER_Settings_Config</GET_SETTINGS_CONFIG>
With that last statement the switch is done and is ready to be tested in the simulation. Here is the full code we have at this point:
<!-- Interior xml -->
<UseTemplate Name="ASOBO_IT_Switch_Template">
<IN_BASE_NAME>OVHD_FLT_CONTROL_SWITCH_YAW_DAMPER_1</IN_BASE_NAME>
<IE_NAME>YAW_DAMPER</IE_NAME>
<GET_SETTINGS>ON_OFF_Settings</GET_SETTINGS>
<GET_SETTINGS_CONFIG>YAW_DAMPER_Settings_Config</GET_SETTINGS_CONFIG>
<SOUND_EVENT_TYPE_ID>1</SOUND_EVENT_TYPE_ID>
</UseTemplate>
<!-- Config xml -->
<ParametersFn Name="ON_OFF_Settings ">
<ReturnParameters>
<UseParametersFn Name="ASOBO_Auto_Define_Positions_And_Tooltips_Helper">
<!-- Each Pos defined here needs a POS_#_CHECK and a POS_#_CODE in your Setting_Config -->
<POS_0>ON</POS_0>
<POS_1>OFF</POS_1>
</UseParametersFn>
</ReturnParameters>
</ParametersFn>
<ParametersFn Name="YAW_DAMPER_Settings_Config">
<Parameters Type="Default">
<UseParametersFn Name="ASOBO_Yaw_Damper_Parameters"/>
</Parameters>
<ReturnParameters>
<UseParametersFn Name="ASOBO_Auto_Define_XStates_Variant_Helper"/>
<UseParametersFn Name="ASOBO_Watch_Simvar_Helper">
<SIMVAR>#SIMVAR_YAW_DAMPER#</SIMVAR>
</UseParametersFn>
<!-- Check position -->
<POS_OFF_CHECK>#GET_YAW_DAMPER# !</POS_OFF_CHECK>
<POS_ON_CHECK>#GET_YAW_DAMPER#</POS_ON_CHECK>
<!-- Set position -->
<POS_OFF_CODE>0 #SET_YAW_DAMPER#</POS_OFF_CODE>
<POS_ON_CODE>1 #SET_YAW_DAMPER#</POS_ON_CODE>
</ReturnParameters>
</ParametersFn>
Additional Parameters
By default when a discrete state configuration has only 2 possible states the interaction will be simplified to a simple toggle-on-click. However, if you wish to enforce a drag interaction you can use the following additional parameter:
<USE_SIMPLE_TOGGLE_INTERACTION>False</USE_SIMPLE_TOGGLE_INTERACTION>
For example:
<UseTemplate Name="ASOBO_IT_Switch_Template">
<IN_BASE_NAME>BOX_SKI_SWITCH</IN_BASE_NAME>
<IE_NAME>SKIS</IE_NAME>
<GET_SETTINGS>LandingGearOfSkis_Down_Up_Settings</GET_SETTINGS>
<GET_SETTINGS_CONFIG>ASOBO_Gears_Settings_Config</GET_SETTINGS_CONFIG>
<USE_SIMPLE_TOGGLE_INTERACTION>False</USE_SIMPLE_TOGGLE_INTERACTION>
<SOUND_EVENT_TYPE_ID>1</SOUND_EVENT_TYPE_ID>
</UseTemplate>
When using a lever, by default the animation will show the in-between position when dragging with a mouse or controller. This may not be desirable if the lever can be locked by another source (for example some gears levers are mechanically locked). To prevent this behavior you can use the SHOW_INTERMEDIARY_POS_CONDITION parameter and specify an additional condition, for example:
<SHOW_INTERMEDIARY_POS_CONDITION>(L:1:XMLVAR_Gears_lever_Locked) ! and</SHOW_INTERMEDIARY_POS_CONDITION>
Enum Based Configurations
Sometimes some switches are tied to several SimVars at a time. For example, if we have a light switch that can handle several light states depending on switch the position, we'll probably want to go this route. Let's look at an example and then we'll take it apart and examine the details:
<ParametersFn Name="ASOBO_Position_Light_Settings_Config">
<Parameters Type="Override">
<UseParametersFn Name="ASOBO_Get_Enum_Parameters_Helper">
<SaveParameters ID="Enum_Values">
<POS_BOTH>0</POS_BOTH>
<POS_OFF>1</POS_OFF>
<POS_STEADY>2</POS_STEADY>
</SaveParameters>
</UseParametersFn>
<UseParametersFn Name="ASOBO_Light_Navigation_Parameters">
<OUT_PARAM_ID>POSITION</OUT_PARAM_ID>
</UseParametersFn>
<UseParametersFn Name="ASOBO_Light_Strobe_Parameters">
<OUT_PARAM_ID>STROBE</OUT_PARAM_ID>
</UseParametersFn>
</Parameters>
<ReturnParameters>
<UseParametersFn Name="ASOBO_Auto_Define_XStates_Variant_Helper"/>
<UseParametersFn Name="ASOBO_Append_Init_Code_Helper">
<INIT_CODE>
#IS_POS_BOTH# if{ 1 sp1 1 sp2 }
#IS_POS_OFF# if{ 0 sp1 0 sp2 }
#IS_POS_STEADY# if{ 1 sp1 0 sp2 }
#GET_LIGHT_POSITION# l1 != if{ l1 #SET_LIGHT_POSITION# }
#GET_LIGHT_STROBE# l2 != if{ l2 #SET_LIGHT_STROBE# }
</INIT_CODE>
</UseParametersFn>
<UseParametersFn Name="ASOBO_Watch_Simvars_Helper">
<SaveParameters ID="Temp_Simvars_To_Watch">
<SIMVAR_POSITION>#SIMVAR_LIGHT_POSITION_SWITCH#</SIMVAR_POSITION>
<SIMVAR_STROBE>#SIMVAR_LIGHT_STROBE_SWITCH#</SIMVAR_STROBE>
</SaveParameters>
</UseParametersFn>
<!-- Check position -->
<POS_STROBE_STEADY_CHECK>#IS_POS_BOTH#</POS_STROBE_STEADY_CHECK>
<POS_OFF_CHECK>#IS_POS_OFF#</POS_OFF_CHECK>
<POS_STEADY_CHECK>#IS_POS_STEADY#</POS_STEADY_CHECK>
<!-- Set position -->
<POS_STROBE_STEADY_CODE>#SET_POS_BOTH#</POS_STROBE_STEADY_CODE>
<POS_OFF_CODE>#SET_POS_OFF#</POS_OFF_CODE>
<POS_STEADY_CODE>#SET_POS_STEADY#</POS_STEADY_CODE>
</ReturnParameters>
</ParametersFn>
The first thing to notice about this example is the enum declaration - it takes a set of enum values where each ID is given a number and saved in a <SaveParameters> collection:
<UseParametersFn Name="ASOBO_Get_Enum_Parameters_Helper">
<VAR_SCOPE>L</VAR_SCOPE>
<SaveParameters ID="Enum_Values">
<POS_BOTH>0</POS_BOTH>
<POS_OFF>1</POS_OFF>
<POS_STEADY>2</POS_STEADY>
</SaveParameters>
</UseParametersFn>
This function will create an interface to get and set an enum value. For each position you’ll get the following two parameters you can use:
SET_POS_#- Set the enum var to the # value.GET_POS_#- Check if the enum var is equal to the # value.
We make use of these parameters to define the position to check, and also to set the position of our switch:
<!-- Check position -->
<POS_STROBE_STEADY_CHECK>#IS_POS_BOTH#</POS_STROBE_STEADY_CHECK>
<POS_OFF_CHECK>#IS_POS_OFF#</POS_OFF_CHECK>
<POS_STEADY_CHECK>#IS_POS_STEADY#</POS_STEADY_CHECK>
<!-- Set position -->
<POS_STROBE_STEADY_CODE>#SET_POS_BOTH#</POS_STROBE_STEADY_CODE>
<POS_OFF_CODE>#SET_POS_OFF#</POS_OFF_CODE>
<POS_STEADY_CODE>#SET_POS_STEADY#</POS_STEADY_CODE>
To correctly set the SimVars we make use of the init code, which is an RPN sample executed at the start, and then again at any time a watched value changes (see <Init> for more information):
<!-- Sync simvar state with enum value -->
<UseParametersFn Name="ASOBO_Append_Init_Code_Helper">
<INIT_CODE>
#IS_POS_BOTH# if{ 1 sp1 1 sp2 } (* turn both lights on *)
#IS_POS_OFF# if{ 0 sp1 0 sp2 } (* turn both lights off *)
#IS_POS_STEADY# if{ 1 sp1 0 sp2 } (* turn position light on *)
#GET_LIGHT_POSITION# l1 != if{ l1 #SET_LIGHT_POSITION# }
#GET_LIGHT_STROBE# l2 != if{ l2 #SET_LIGHT_STROBE# }
</INIT_CODE>
</UseParametersFn>
<!-- Watch both lights's simvars -->
<UseParametersFn Name="ASOBO_Watch_Simvars_Helper">
<SaveParameters ID="Temp_Simvars_To_Watch">
<SIMVAR_POSITION>#SIMVAR_LIGHT_POSITION_SWITCH#</SIMVAR_POSITION>
<SIMVAR_STROBE>#SIMVAR_LIGHT_STROBE_SWITCH#</SIMVAR_STROBE>
</SaveParameters>
</UseParametersFn>
Continuous State Configurations
By default all input events are of the type continuous state which is why we don't need to do anything specific when we want to use this type of configuration (unlike for discrete state configurations). This type of configuration is fairly simple and takes very few parameters:
IE_GET_STATE- Return the current valueIE_SET_STATE- Set the current valueVALUE_TYPE- The type of value, can be any of the following:
Name Range TT Format Type U16K0 → 16K %.1f%% position 16k S16K-16K → 16K %.1f%% position 16k M16K-N → 16K %.1f%% position 16k PERCENT0 → 100% %.1f%% percent NUMBER-A → B %.1f number
When in doubt useNUMBERand configureMIN_VALUEandMAX_VALUE.
As an example of how a continuous state configuration looks, we'll make one for a throttle lever, starting from this XML:
<UseTemplate Name="ASOBO_IT_Lever_Template">
<IE_NAME>THROTTLE</IE_NAME>
<IN_BASE_NAME>ENGINE_LEVER_THROTTLE</IN_BASE_NAME>
</UseTemplate>
To create a configuration for this lever, the first thing to do is create a Parameter Function. Here we want to configure the lever to drive the throttle lever SimVar, so we'll simply call our function THROTTLE_Settings_Config. To make our life easier we can use a helper function provided with the model behaviors to get an interface to help configure our lever. In this case we'll be using ASOBO_Throttle_Parameters as defined below:
<ParametersFn Name="ASOBO_Throttle_Parameters">
<Parameters Type="Override">
<UseParametersFn Name="ASOBO_Get_Param_Suffix_Helper"/>
</Parameters>
<Parameters Type="Default">
<ENG_ID>1</ENG_ID>
<THROTTLE_MIN_VALUE_16K Process="Int">(A:THROTTLE LOWER LIMIT, position 16k)</THROTTLE_MIN_VALUE_16K>
<THROTTLE_MAX_VALUE_16K>@16K</THROTTLE_MAX_VALUE_16K>
</Parameters>
<Parameters Type="Default">
<SIMVAR_THROTTLE>GENERAL ENG THROTTLE LEVER POSITION:#ENG_ID#</SIMVAR_THROTTLE>
<SIMVAR_THROTTLE_UNITS>position</SIMVAR_THROTTLE_UNITS>
</Parameters>
<Parameters Type="Default">
<GET_THROTTLE>(A:#SIMVAR_THROTTLE#, #SIMVAR_THROTTLE_UNITS#)</GET_THROTTLE>
<SET_THROTTLE>@16K / (>K:THROTTLE#ENG_ID#_SET)</SET_THROTTLE>
<GET_THROTTLE_16K>(A:#SIMVAR_THROTTLE#, position 16k)</GET_THROTTLE_16K>
<SET_THROTTLE_16K>(>K:THROTTLE#ENG_ID#_SET)</SET_THROTTLE_16K>
</Parameters>
<ReturnParameters>
<SIMVAR_THROTTLE#OUT_PARAM_SUFFIX#>#SIMVAR_THROTTLE#</SIMVAR_THROTTLE#OUT_PARAM_SUFFIX#>
<THROTTLE_MIN_VALUE_16K>#THROTTLE_MIN_VALUE_16K#</THROTTLE_MIN_VALUE_16K>
<THROTTLE_MAX_VALUE_16K>#THROTTLE_MAX_VALUE_16K#</THROTTLE_MAX_VALUE_16K>
<GET_THROTTLE#OUT_PARAM_SUFFIX#>#GET_THROTTLE#</GET_THROTTLE#OUT_PARAM_SUFFIX#>
<SET_THROTTLE#OUT_PARAM_SUFFIX#>#SET_THROTTLE#</SET_THROTTLE#OUT_PARAM_SUFFIX#>
<GET_THROTTLE_16K#OUT_PARAM_SUFFIX#>#GET_THROTTLE_16K#</GET_THROTTLE_16K#OUT_PARAM_SUFFIX#>
<SET_THROTTLE_16K#OUT_PARAM_SUFFIX#>#SET_THROTTLE_16K#</SET_THROTTLE_16K#OUT_PARAM_SUFFIX#>
</ReturnParameters>
</ParametersFn>
Here we are going to make this a simple throttle with no reverser capabilities, and for that we will need to override the THROTTLE_MIN_VALUE_16K, setting it to 0 to clamp the value. For that we can do this:
<UseParametersFn Name="ASOBO_Throttle_Parameters">
<THROTTLE_MIN_VALUE_16K>0</THROTTLE_MIN_VALUE_16K>
</UseParametersFn>
We can now define our SET_STATE, GET_STATE, and out VALUE_TYPE:
<VALUE_TYPE>U16K</VALUE_TYPE>
<IE_GET_STATE>#GET_THROTTLE_16K#</IE_GET_STATE>
<IE_SET_STATE>#SET_THROTTLE_16K#</IE_SET_STATE>
We then watch the #SIMVAR_THROTTLE# for changes:
<UseParametersFn Name="ASOBO_Watch_Simvar_Helper">
<SIMVAR>#SIMVAR_THROTTLE#</SIMVAR>
</UseParametersFn>
Finally we need to add the configuration "getter" to override the default interaction by adding the following statement in the initial <UseTemplate> element:
<GET_SETTINGS_CONFIG>ASOBO_THROTTLE_Settings_Config</GET_SETTINGS_CONFIG>
Putting all this together, we have the following lever code that can be tested in the simulation:
<!-- Interior XML -->
<UseTemplate Name="ASOBO_IT_Lever_Template">
<IE_NAME>THROTTLE</IE_NAME>
<IN_BASE_NAME>ENGINE_LEVER_THROTTLE</IN_BASE_NAME>
<GET_SETTINGS_CONFIG>THROTTLE_Settings_Config</GET_SETTINGS_CONFIG>
</UseTemplate>
<!-- Config XML -->
<ParametersFn Name="Throttle_Settings_Config">
<Parameters Type="Override">
<UseParametersFn Name="ASOBO_Throttle_Parameters">
<THROTTLE_MIN_VALUE_16K>0</THROTTLE_MIN_VALUE_16K>
</UseParametersFn>
</Parameters>
<ReturnParameters>
<VALUE_TYPE>U16K</VALUE_TYPE>
<IE_GET_STATE>#GET_THROTTLE_16K#</IE_GET_STATE>
<IE_SET_STATE>#SET_THROTTLE_16K#</IE_SET_STATE>
<UseParametersFn Name="ASOBO_Watch_Simvar_Helper">
<SIMVAR>#SIMVAR_THROTTLE#</SIMVAR>
</UseParametersFn>
</ReturnParameters>
</ParametersFn>
Curve (Trajectory drag only)
A curve is a reinterpolation of the input event position for a given animation position. The configuration of the curve is stored in 2 different <SaveParameters>:
PLOAD_AXIS_CURVE- List of points (POINT_#starting a 0) defining the curve. Each point value will be it's identifier while evaluating the curve configuration.PLOAD_AXIS_CURVE_CONFIG- Configuration of every point in the list.
Let’s take the throttle example from above and remove the reverser limitation, as well as add a gate for the idle position. First we define the names of our saved parameters:
<PLOAD_AXIS_CURVE>Throttle_Gates</PLOAD_AXIS_CURVE>
<PLOAD_AXIS_CURVE_CONFIG>Throttle_Gates_Config</PLOAD_AXIS_CURVE_CONFIG>
Then we define 1 point for the Idle gate:
<SaveParameters ID="Throttle_Gates" Append="Default">
<POINT_0>Idle</POINT_0>
</SaveParameters>
And finally we configure this point so that when the animation is at 50% we set the value 0 into the input event set event:
<SaveParameters ID="Throttle_Gates_Config" Append="Default">
<IDLE_IE_PERCENT_SET>0</IDLE_IE_PERCENT_SET>
<IDLE_ANIM_PERCENT>50</IDLE_ANIM_PERCENT>
<IDLE_GATE_DIRECTION>Both</IDLE_GATE_DIRECTION>
</SaveParameters>
Here is the final configuration of the throttle with an idle gate (notice that since we have an asymmetric 16K value we use M16K as the value type and not S16K):
<ParametersFn Name="ASOBO_Throttle_With_Reverser_Settings_Config_Parameters">
<Parameters Type="Override">
<UseParametersFn Name="ASOBO_Throttle_Parameters"/>
</Parameters>
<Parameters Type="Default">
<IDLE_IE_PERCENT_SET>0</IDLE_IE_PERCENT_SET>
<IDLE_ANIM_PERCENT>50</IDLE_ANIM_PERCENT>
<IDLE_GATE_DIRECTION>Both</IDLE_GATE_DIRECTION>
</Parameters>
<ReturnParameters>
<VALUE_TYPE>M16K</VALUE_TYPE>
<IE_GET_STATE>#GET_THROTTLE_16K#</IE_GET_STATE>
<IE_SET_STATE>#SET_THROTTLE_16K#</IE_SET_STATE>
<UseParametersFn Name="ASOBO_Watch_Simvar_Helper">
<SIMVAR>#SIMVAR_THROTTLE#</SIMVAR>
</UseParametersFn>
<PLOAD_AXIS_CURVE>Throttle_Gates</PLOAD_AXIS_CURVE>
<PLOAD_AXIS_CURVE_CONFIG>Throttle_Gates_Config</PLOAD_AXIS_CURVE_CONFIG>
<SaveParameters ID="Throttle_Gates" Append="Default">
<POINT_0>Idle</POINT_0>
</SaveParameters>
<SaveParameters ID="Throttle_Gates_Config" Append="Default">
<IDLE_IE_PERCENT_SET>#IDLE_IE_PERCENT_SET#</IDLE_IE_PERCENT_SET>
<IDLE_ANIM_PERCENT>#IDLE_ANIM_PERCENT#</IDLE_ANIM_PERCENT>
<IDLE_GATE_DIRECTION>#IDLE_GATE_DIRECTION#</IDLE_GATE_DIRECTION>
</SaveParameters>
</ReturnParameters>
</ParametersFn>
Drag Sensitivity
Drag sensitivity doesn’t affect mouse use for trajectory drag, but it will affect every other kind of drag interaction. For this, a threshold is defined by 2 values:
THRESHOLD_RELATIVE- Threshold for devices using relative coordinates (controller)THRESHOLD_ASBOLUTE- Threshold for devices using absolute coordinates (mouse)
Generally we rely on some presets for these values depending on how much/how fast the value needs to change. These presets are defined in Parameter Functions and specified by the parameter PFN_DELTA_THRESHOLD_VALUES. By default every interaction uses the ASOBO_Drag_Threshold_Small parameter function. The table below shows a list of all the default threshold for the different drag presets you can use:
NOTE: The smaller a threshold value is, the more reactive the input will feel.
| Function Name | Relative Threshold | Absolute Threshold |
|---|---|---|
ASOBO_Drag_Threshold_Extremely_Small |
0.00025 | 0.0001 |
ASOBO_Drag_Threshold_Very_Small |
0.001 | 0.00025 |
ASOBO_Drag_Threshold_Small |
0.0025 | 0.001 |
ASOBO_Drag_Threshold_Medium |
0.00625 | 0.004 |
ASOBO_Drag_Threshold_Large |
0.015625 | 0.016 |
ASOBO_Drag_Threshold_Very_Large |
0.039 | 0.032 |
ASOBO_Drag_Threshold_States |
0.01 | 0.005 |
ASOBO_Drag_Threshold_States_No_Gates |
0.025 | 0.025 |
Additionally you can set the parameter THRESHOLD_TRANSFORM_VALUE, which takes the number of times the threshold has been crossed, and - by default - returns it. Discrete states use the ASOBO_Drag_Threshold_States and ASOBO_Drag_Threshold_States_No_Gates depending of if there are any gates defined.
Value
The displayed value can be formatted using the TOOLTIP_VALUE_FORMAT parameter:
<!-- here we're formatting an altitude in feet -->
<TOOLTIP_VALUE_FORMAT >'%d ft'</TOOLTIP_VALUE_FORMAT>
If you are using a NUMBER value type, the limits can also be specified either using of the following:
MIN_VALUE- Minimum reachable valueMAX_VALUE- Maximum reachable valueCLAMP_VALUE- User defined clamp (for example, usingdnor)
The type of the value can be specified using the parameter IE_VALUE_UNITS. For example, to configure an input event to use degrees for the value we would use:
<IE_VALUE_UNITS>Degrees</IE_VALUE_UNITS>
Note that if IE_VALUE_UNITS is defined, the TOOLTIP_VALUE_FORMAT will be pre-filled for some units. See the ASOBO_Format_Tooltip_Value_Units_Helper parameter helper for a list of all units handled by default.
The way the value is incremented or decremented can be controlled using the following parameters:
IE_INCREMENT- Increment added (see<Inc>) or removed (see<Dec>) when using the Increment and Decrement keysINCREMENT_PER_THRESHOLD- Increment added every time a threshold is crossed (see the section on Drag Sensitivity to see how to configure the threshold sensitivity).INFINITE_ANIM_SCALE_FACTOR- This is for Infinite interactions only and lets you configure how fast the rotation variable moves in comparison to the input event value.
Event Configuration
For event configuration we will be using the ASOBO_Auto_Define_Event_Param_Helper parameter function to define what happens on 2 events (optional):
ON_EVENT_SET- Event triggered when entering the interaction (on click)ON_EVENT_RELEASE- Event triggered when leaving the interaction (on release)
To illustrate this, well make the barometric toggle button, so that it toggles the standard mode for the selected barometer when clicked:
<UseTemplate Name="ASOBO_IT_Button_Template">
<IE_NAME>BARO_STD</IE_NAME>
<ANIM_NAME>GLSHD_EFIS_PUSH_BARO_STD</ANIM_NAME>
<SOUND_EVENT_TYPE_ID>7</SOUND_EVENT_TYPE_ID>
</UseTemplate>
To make our life easier we can use a helper function provided by the model behavior templates to get an interface to help configure our button. In this case we’ll be using ASOBO_Baro_Parameters, and with that the only important thing we need to do is configure our ON_EVENT_SET to toggle the barometer standard mode:
<UseParametersFn Name="ASOBO_Auto_Define_Event_Param_Helper">
<ON_EVENT_SET>#GET_BARO_STD# ! #SET_BARO_STD#</ON_EVENT_SET>
</UseParametersFn>
With this helper we'll also need to configure the tooltips as they are not included as part of the helper, using something like the following:
<TOOLTIP_NOT_STD>(R:1:@TT_Package.STATE.OFF)</TOOLTIP_NOT_STD>
<TOOLTIP_STD>(R:1:@TT_Package.STATE.STANDARD)</TOOLTIP_STD>
<!-- ... -->
<IE_TOOLTIP_VALUE>#GET_BARO_STD# if{ #TOOLTIP_STD# } els{ #TOOLTIP_NOT_STD# }</IE_TOOLTIP_VALUE>
We also shouldn't forget to add the configuration getter to override the default interaction by adding the following statement in the initial <UseTemplate> element:
<GET_SETTINGS_CONFIG>ASOBO_Baro_STD_Settings_Config</GET_SETTINGS_CONFIG>
With that last statement our button is done and can be tested in game. The full code looks something like that shown below:
<!-- Interior XML -->
<UseTemplate Name="ASOBO_IT_Button_Template">
<IE_NAME>BARO_STD</IE_NAME>
<ANIM_NAME>GLSHD_EFIS_PUSH_BARO_STD</ANIM_NAME>
<SOUND_EVENT_TYPE_ID>7</SOUND_EVENT_TYPE_ID>
<GET_SETTINGS_CONFIG>ASOBO_Baro_STD_Settings_Config</GET_SETTINGS_CONFIG>
</UseTemplate>
<!-- Config XML -->
<ParametersFn Name="ASOBO_Baro_STD_Settings_Config_Parameters">
<Parameters Type="Default">
<TOOLTIP_NOT_STD>(R:1:@TT_Package.STATE.OFF)</TOOLTIP_NOT_STD>
<TOOLTIP_STD>(R:1:@TT_Package.STATE.STANDARD)</TOOLTIP_STD>
</Parameters>
<Parameters Type="Override">
<UseParametersFn Name="ASOBO_Baro_Parameters"/>
</Parameters>
<ReturnParameters>
<IE_TOOLTIP_VALUE>#GET_BARO_STD# if{ #TOOLTIP_STD# } els{ #TOOLTIP_NOT_STD# }</IE_TOOLTIP_VALUE>
<UseParametersFn Name="ASOBO_Auto_Define_Event_Param_Helper">
<ON_EVENT_SET>#GET_BARO_STD# ! #SET_BARO_STD#</ON_EVENT_SET>
</UseParametersFn>
<UseParametersFn Name="ASOBO_Watch_Simvar_Helper">
<SIMVAR>#SIMVAR_BARO_STD#</SIMVAR>
</UseParametersFn>
</ReturnParameters>
</ParametersFn>
There are a couple of additional templates that can be useful for doing event configuration:
ASOBO_Add_Button_Long_Press_Event_Helper- this is used to add a handler to the input event to trigger an RPN snippetON_LONG_PRESS_EVENTwhen the button has been pressed for a given duration (defined usingLONG_PRESS_DURATION- in seconds). A code snippet will also be added to theON_EVENT_SETparameter. If you wish to change this target parameter you can overrideOUT_EVENT_PARAM_NAMEwith the desired parameter name:<Condition NotEmpty="ON_LONG_PRESS_EVENT"> <UseParametersFn Name="ASOBO_Add_Button_Long_Press_Event_Helper"> <OUT_EVENT_PARAM_NAME>ON_EVENT</OUT_EVENT_PARAM_NAME> </UseParametersFn> </Condition>Afterward you need to call
ASOBO_Auto_Define_Event_Param_Helperto append your event trigger.
ASOBO_Add_Button_Down_Event_Helper- this is used to add a handler to the input event to trigger an RPN snippetON_BUTTON_DOWNevery frame while the button is down. A code snippet will also be added to theON_EVENT_SETparameter. If you wish to change this target parameter you can overrideOUT_EVENT_PARAM_NAMEwith the desired parameter name:<Condition NotEmpty="ON_BUTTON_DOWN"> <UseParametersFn Name="ASOBO_Add_Button_Down_Event_Helper"> <OUT_EVENT_PARAM_NAME>ON_EVENT</OUT_EVENT_PARAM_NAME> </UseParametersFn> </Condition>Afterward you need to call
ASOBO_Auto_Define_Event_Param_Helperto append your event trigger.
Binding Configurations
When it comes to using configurations, they can be exceptionally helpful when used along with input bindings. Bindings are explained in the detail on the Input Bindings page, however that explains the low-level concept and creation of bindings directly within the input events, something that you generally don't have to do when using the model behavior templates and configurations. Instead it's usually done using one of the following helpers:
- ASOBO_Add_Inc_Binding_Helper - Create a binding for the
<Inc>event. - ASOBO_Add_Dec_Binding_Helper - Create a binding for the
<Dec>event - ASOBO_Add_Set_Binding_Helper - Create a binding for the
<Set>event
A binding is identified using and alias or an event ID:
ALIAS_ID- the name of the bindingEVENT_ID- name of the event ID (key event)
The binding can then define what to do with each parameter by specifying a list of PARAM_# starting at 0. If a parameter does not need to be evaluated as RPN (ie: it's a literal value), you can set PARAM_#_IS_DYNAMIC to "False" to save on computation time. For example:
<ParametersFn Name="ASOBO_Liquid_Dropping_Lever_Settings_Config">
<Parameters Type="Override">
<UseParametersFn Name="ASOBO_Liquid_Dropping_Door_Parameters"/>
</Parameters>
<ReturnParameters>
<VALUE_TYPE>U16K</VALUE_TYPE>
<MIN_VALUE>0</MIN_VALUE>
<MAX_VALUE>@16K</MAX_VALUE>
<IE_GET_STATE>#GET_LIQUID_DROPPING_DOOR_TARGET_POSITION_16K#</IE_GET_STATE>
<IE_SET_STATE>#SET_LIQUID_DROPPING_DOOR_TARGET_POSITION_16K#</IE_SET_STATE>
<UseParametersFn Name="ASOBO_Watch_Simvar_Helper">
<SIMVAR>#SIMVAR_LIQUID_DROPPING_DOOR_TARGET_POSITION#</SIMVAR>
</UseParametersFn>
<UseParametersFn Name="ASOBO_Add_Set_Binding_Helper">
<ALIAS_ID>TOGGLE</ALIAS_ID>
<PARAM_0>#GET_LIQUID_DROPPING_DOOR_TARGET_POSITION_16K# 0 > if{ 0 } els{ @16K }</PARAM_0>
<PARAM_0_IS_DYNAMIC>True</PARAM_0_IS_DYNAMIC>
</UseParametersFn>
</ReturnParameters>
</ParametersFn>