plane icon Welcome to Microsoft Flight Simulator’s SDK Q&A Platform!

You have questions regarding the SDK? DevMode Tools? SimConnect? You would like to submit an idea for future improvements, seek help or exchange knowledge? You’re in the right place.


Please take a moment to read the platform’s guidelines before you get started!


question

lyonhaart001 avatar image
lyonhaart001 asked lyonhaart001 answered

3 Position Switch Sample

Hello everyone,

Does anyone have a 3-position Asobo GT switch that is L:Var based and clicks 0 thru 2 Enums?
I can see the basic 'shell' in Asobo Behaviors, not the guts of how to write the switch. I need a sample to go by. I have looked through the Asobo open planes for such a switch and didnt find one.
Many thanks for any help,

Bill
LHC

samples
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

lyonhaart001 avatar image
lyonhaart001 answered

I was able to get the one working that I had been messing with for a few days. Changing the top line and making the Node name the same as the Component name got it working. Add this to the stack of samples.


<Component ID="SKIRTS_SELECTOR_KNOB" Node="SKIRTS_SELECTOR_KNOB">

<UseTemplate Name="ASOBO_GT_Switch_3States">

<ANIM_NAME>SKIRTS_SELECTOR_KNOB</ANIM_NAME>

<PART_ID>SKIRTS_SELECTOR_KNOB</PART_ID>

<SWITCH_POSITION_TYPE>L</SWITCH_POSITION_TYPE>

<SWITCH_POSITION_VAR>SWITCH_SKIRTS_ANIM</SWITCH_POSITION_VAR>

<SWITCH_DIRECTION>Horizontal</SWITCH_DIRECTION>

<ARROW_TYPE>Curved</ARROW_TYPE>

<CODE_POS_0>1 (&gt;L:SKIRTS_MODERN, bool)

0 (&gt;L:SKIRTS_CLASSIC, bool)

0 (&gt;L:SKIRTS_NONE, bool)</CODE_POS_0>

<CODE_POS_1>0 (&gt;L:SKIRTS_MODERN, bool)

1 (&gt;L:SKIRTS_CLASSIC, bool)

0 (&gt;L:SKIRTS_NONE, bool)</CODE_POS_1>

<CODE_POS_2>0 (&gt;L:SKIRTS_MODERN, bool)

0 (&gt;L:SKIRTS_CLASSIC, bool)

1 (&gt;L:SKIRTS_NONE, bool)</CODE_POS_2>

<!-- <STATE0_TEST>(L:SWITCH_SKIRTS_ANIM:1, enum) 0 == </STATE0_TEST>

<STATE1_TEST>(L:SWITCH_SKIRTS_ANIM:1, enum) 1 == </STATE1_TEST>

<STATE2_TEST>(L:SWITCH_SKIRTS_ANIM:1, enum) 2 == </STATE2_TEST> -->

<ANIMTIP_0>MODERN WHEEL SKIRTS</ANIMTIP_0>

<ANIMTIP_1>CLASSIC WHEEL SKIRTS</ANIMTIP_1>

<ANIMTIP_2>OPEN WHEELS</ANIMTIP_2>

<WWISE_EVENT_1>battery_switch_on</WWISE_EVENT_1>

<WWISE_EVENT_2>battery_switch_on</WWISE_EVENT_2>

<WWISE_EVENT_3>battery_switch_on</WWISE_EVENT_3>

</UseTemplate>

</Component>

Thanks WombiiActual for the input.

Bill
LHC

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

WombiiActual avatar image
WombiiActual answered

I have an example of knobs with 3 fixed positions selected with a scrollwheel, setting L:vars, if that helps. If I remember correctly, these two pretty much do the same thing. One uses the ASOBO_GT_Switch_Dummy and one uses ASOBO_GT_Switch_3States. In reality the Switch_Dummy uses the Switch_3States template when 3 states are selected. Hopefully this gets you in the right direction.

<UseTemplate Name="ASOBO_GT_Switch_Dummy">
                <NODE_ID>Striker_knobA_003</NODE_ID>
                <ANIM_NAME>Striker_knobA_003</ANIM_NAME>
                <SWITCH_DIRECTION>Horizontal</SWITCH_DIRECTION>
                <NUM_STATES>3</NUM_STATES>
        <INIT_VALUE>2</INIT_VALUE>
                <ANIMREF_ID>0</ANIMREF_ID>
                <ANIMCURSOR_DIR>1</ANIMCURSOR_DIR>
                <ARROW_TYPE>Curved</ARROW_TYPE>
                <ANIMTIP_0>Headlights</ANIMTIP_0>
                <ANIMTIP_1>Headlights</ANIMTIP_1>
                <ANIMTIP_2>Headlights</ANIMTIP_2>
                <SWITCH_POSITION_TYPE>L</SWITCH_POSITION_TYPE>
                <SWITCH_POSITION_VAR>XMLVAR_LightsHeadlights</SWITCH_POSITION_VAR>
            </UseTemplate>


<Component ID="Striker_knobA_005" Node="Striker_knobA_005">
                    <Update Once="True">
                        0 (&gt;L:XMLVAR_diffswitch)
                    </Update>
                    <UseTemplate Name = "ASOBO_GT_Switch_3States">
                        
                        <NODE_ID>Striker_knobA_005</NODE_ID>
                        <ANIM_NAME>Striker_knobA_005</ANIM_NAME>
                        <SWITCH_DIRECTION>Horizontal</SWITCH_DIRECTION>
                        <NUM_STATES>3</NUM_STATES>
                        <INIT_VALUE>0</INIT_VALUE>
                        <ANIMREF_ID>0</ANIMREF_ID>
                        <ANIMCURSOR_DIR>1</ANIMCURSOR_DIR>
                        <ARROW_TYPE>Curved</ARROW_TYPE>
                        <ANIMTIP_0>INOP Driveline selector OPEN</ANIMTIP_0>
                        <ANIMTIP_1>INOP Driveline selector TCASE</ANIMTIP_1>
                        <ANIMTIP_2>INOP Driveline selector DIFF</ANIMTIP_2>

                        <CODE_POS_0>
                            0 (&gt;L:XMLVAR_diffswitch)
                        </CODE_POS_0>
                        <CODE_POS_1>
                            1 (&gt;L:XMLVAR_diffswitch)
                        </CODE_POS_1>
                        <CODE_POS_2>
                            2 (&gt;L:XMLVAR_diffswitch)
                        </CODE_POS_2>
                    </UseTemplate>
                </Component>


And here is what the 3States template looks like, with the minimum necessary parameters.


1667678630631.png


1667678630631.png (21.2 KiB)
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

lyonhaart001 avatar image
lyonhaart001 answered

Many thanks, WombiiActual, massively appreciated.
I had seen the basic Behavior template, but didnt know how to fill in the details for coding it to work with L:Vars. Off to check this out. Thanks again!

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 5 attachments (including images) can be used with a maximum of 19.1 MiB each and 23.8 MiB total.