• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

MSFS20 switch Battery and contact key

Messages
85
Country
france
Hi
I would like to create a battery switch that can only power up the aircraft when an "contacte key" (anti-theft device) is turned on.
The battery switch works fine, but I can't seem to prevent it from operating when the contacte key isn't turned. Since I'm not an XML expert, a little help would be appreciated.
Below is a screenshot in Blender as well as the lines from my interior.xml file.
Thanks in advance.
blender.png

<UseTemplate Name="ASOBO_ELECTRICAL_Battery_Template">
<NODE_ID>ELECTRICAL_SWITCH_Battery_Master_1</NODE_ID>
<ANIM_NAME>ELECTRICAL_SWITCH_Battery_Master_1</ANIM_NAME>
<MIN_VALUE>0</MIN_VALUE>
<MAX_VALUE>16</MAX_VALUE>
</UseTemplate>

<!-- contact ON and OFF -->
<Animation guid="9f69e02b-ec38-45b0-b0c0-09ce0d77f01c" length="50" name="contact" type="Sim" typeparam="AutoPlay" typeparam2="contact"/>
<PartInfo>
<Name>contact</Name>
<AnimLength>50</AnimLength>
<Animation>
<Parameter>
<Code>
(L:contact, bool) 50 *
</Code>
<Lag>400</Lag>
</Parameter>
</Animation>
<MouseRect>
<Cursor>Hand</Cursor>
<TooltipText>CLEF DE CONTACT</TooltipText>
<CallbackCode>
(L:contact, bool) 0 ==
if{ 1 (&gt;L:contact, bool) }
els{ 0 (&gt;L:contact, bool) }
</CallbackCode>
</MouseRect>
</PartInfo>
 
HI
To simplify my question, is it possible to have two independent switches for a single battery, but the second only works if the first is on?
For example, a battery disconnect switch and a power switch?
 
Hello! I will try to help you by offering one of the many solutions.
XML:
<UseTemplate Name="ASOBO_ELECTRICAL_Battery_Template">
<NODE_ID>ELECTRICAL_SWITCH_Battery_Master_1</NODE_ID>
<ANIM_NAME>ELECTRICAL_SWITCH_Battery_Master_1</ANIM_NAME>
<MIN_VALUE>0</MIN_VALUE>
<MAX_VALUE>16</MAX_VALUE>
</UseTemplate>
New logic according to the template proposed by the studio. In this case, you can work with it, but you will have to change the parameters and collect exceptions in the component itself to change the outgoing parameters in the Asobo template, a lot of code and the InputEvent ID.
XML:
<!-- contact ON and OFF -->
<Animation guid="9f69e02b-ec38-45b0-b0c0-09ce0d77f01c" length="50" name="contact" type="Sim" typeparam="AutoPlay" typeparam2="contact"/>
<PartInfo>
<Name>contact</Name>
<AnimLength>50</AnimLength>
<Animation>
<Parameter>
<Code>
(L:contact, bool) 50 *
</Code>
<Lag>400</Lag>
</Parameter>
</Animation>
<MouseRect>
<Cursor>Hand</Cursor>
<TooltipText>CLEF DE CONTACT</TooltipText>
<CallbackCode>
(L:contact, bool) 0 ==
if{ 1 (&gt;L:contact, bool) }
els{ 0 (&gt;L:contact, bool) }
</CallbackCode>
</MouseRect>
</PartInfo>
XML:
(L:contact, bool) 0 ==
if{ 1 (&gt;L:contact, bool) }
els{ 0 (&gt;L:contact, bool) }
Bad logic. Maybe you meant
XML:
(L:contact, bool) ! (&gt;L:contact, bool)
For example, it is possible to make custom logic as the Asobo studio offers in the SDK.

!!! Before proceeding, save your development materials or make copies.
Delete the old logic <!-- contact ON and OFF <Animation ..... --> and <UseTemplate Name="ASOBO_ELECTRICAL_Battery_Template"> .... template for the option below.
Create Temp_code.xml and place the code suggested below in it.
XML:
<ModelBehaviors>

    <Template Name="Generic_Battery_contact">
        <Parameters Type="Default">
        <ANIM_NAME>#ANIM_NAME#</ANIM_NAME>
        </Parameters>
    <UseTemplate Name="ASOBO_GT_Anim">
        <NODE_ID>#ANIM_NAME#</NODE_ID>
        <ANIM_NAME>#ANIM_NAME#</ANIM_NAME>
        <NODE_ID>#ANIM_NAME#</NODE_ID>
        <ANIM_CODE>(L:#ANIM_NAME#, bool) 50 *</ANIM_CODE>         <!-- 50* you anmation time/frame -->
        <ANIM_LENGTH>50</ANIM_LENGTH>          <!-- 50 you anmation time/frame -->
        <ANIM_LAG>500</ANIM_LAG>
    </UseTemplate>
    <UseTemplate Name="ASOBO_GT_MouseRect">
<HIGHLIGHT_NODE_ID>__NO_HIGHLIGHT__</HIGHLIGHT_NODE_ID>
                <MOUSEFLAGS>LeftSingle</MOUSEFLAGS>
        <CURSOR>Hand</CURSOR>
        <TOOLTIPID>%((L:#NODE_ID#, number))%{if}On%{else}Off%{end}</TOOLTIPID>
                <CALLBACKCODE>
                    (M:Event) 'LeftSingle' scmi 0 == if{
                          (L:#ANIM_NAME#) ! (&gt;L:#ANIM_NAME#) }
                </CALLBACKCODE>
    </UseTemplate>
</Template>
</ModelBehaviors>
Place Temp_code.xml in the model folder where your main interior.xml code and model are located.
In the main interior.xml file, add the lines from the code below that you don't have.

XML:
<?xml version="1.0" encoding="utf-8"?>
<ModelInfo version="1.1" guid="{<!-- you guid  -->}">
    <LODS autoGenerate="false">
        <!-- you LOD  -->
    </LODS>
    <Behaviors>
        <!--<Include ModelBehaviorFile="Asobo\Common.xml"/> you Include .... -->

        <!-- Modification -->
        <Include RelativeFile="..\model\Temp_code.xml"/>


        <Component ID="ELECTRICAL_SWITCH_Battery_Master_1" Node="ELECTRICAL_SWITCH_Battery_Master_1">
            <UseTemplate Name="Generic_Battery_contact">
                               <ANIM_NAME>ELECTRICAL_SWITCH_Battery_Master_1</ANIM_NAME>
            </UseTemplate>
        </Component>

        <Component ID="contact" Node="contact">
            <UseTemplate Name="Generic_Battery_contact">
                               <ANIM_NAME>contact</ANIM_NAME>
            </UseTemplate>
        </Component>

  <Component ID="Trigger">
    <UseTemplate Name="ASOBO_GT_Update">
      <FREQUENCY>1</FREQUENCY>
        <UPDATE_CODE>
          (L:ELECTRICAL_SWITCH_Battery_Master_1, bool) 1 ==
          (L:contact, bool) 1 == and
          (A:ELECTRICAL MASTER BATTERY, bool) 0 == and
          if{ 1 (&gt;A:ELECTRICAL MASTER BATTERY, bool) }
          (L:ELECTRICAL_SWITCH_Battery_Master_1, bool) 0 ==
          (L:contact, bool) 0 == ||
          if{ 0 (&gt;A:ELECTRICAL MASTER BATTERY, bool) }
        </UPDATE_CODE>
    </UseTemplate>
  </Component>

        <!-- you  Component .... -->

    </Behaviors>

        <!-- you old  Component Animation name= ....-->




</ModelInfo>

Assemble the solution in the simulator and I hope everything will be as it should be.
There are also options that can be done, such as starting the car, etc., according to your conditions.
 
Last edited:
Hello! I will try to help you by offering one of the many solutions.
XML:
<UseTemplate Name="ASOBO_ELECTRICAL_Battery_Template">
<NODE_ID>ELECTRICAL_SWITCH_Battery_Master_1</NODE_ID>
<ANIM_NAME>ELECTRICAL_SWITCH_Battery_Master_1</ANIM_NAME>
<MIN_VALUE>0</MIN_VALUE>
<MAX_VALUE>16</MAX_VALUE>
</UseTemplate>
New logic according to the template proposed by the studio. In this case, you can work with it, but you will have to change the parameters and collect exceptions in the component itself to change the outgoing parameters in the Asobo template, a lot of code and the InputEvent ID.
XML:
<!-- contact ON and OFF -->
<Animation guid="9f69e02b-ec38-45b0-b0c0-09ce0d77f01c" length="50" name="contact" type="Sim" typeparam="AutoPlay" typeparam2="contact"/>
<PartInfo>
<Name>contact</Name>
<AnimLength>50</AnimLength>
<Animation>
<Parameter>
<Code>
(L:contact, bool) 50 *
</Code>
<Lag>400</Lag>
</Parameter>
</Animation>
<MouseRect>
<Cursor>Hand</Cursor>
<TooltipText>CLEF DE CONTACT</TooltipText>
<CallbackCode>
(L:contact, bool) 0 ==
if{ 1 (&gt;L:contact, bool) }
els{ 0 (&gt;L:contact, bool) }
</CallbackCode>
</MouseRect>
</PartInfo>
XML:
(L:contact, bool) 0 ==
if{ 1 (&gt;L:contact, bool) }
els{ 0 (&gt;L:contact, bool) }
Bad logic. Maybe you meant
XML:
(L:contact, bool) ! (&gt;L:contact, bool)
For example, it is possible to make custom logic as the Asobo studio offers in the SDK.

!!! Before proceeding, save your development materials or make copies.
Delete the old logic <!-- contact ON and OFF <Animation ..... --> and <UseTemplate Name="ASOBO_ELECTRICAL_Battery_Template"> .... template for the option below.
Create Temp_code.xml and place the code suggested below in it.
XML:
<ModelBehaviors>

    <Template Name="Generic_Battery_contact">
        <Parameters Type="Default">
        <ANIM_NAME>#ANIM_NAME#</ANIM_NAME>
        </Parameters>
    <UseTemplate Name="ASOBO_GT_Anim">
        <NODE_ID>#ANIM_NAME#</NODE_ID>
        <ANIM_NAME>#ANIM_NAME#</ANIM_NAME>
        <NODE_ID>#ANIM_NAME#</NODE_ID>
        <ANIM_CODE>(L:#ANIM_NAME#, bool) 50 *</ANIM_CODE>         <!-- 50* you anmation time/frame -->
        <ANIM_LENGTH>50</ANIM_LENGTH>          <!-- 50 you anmation time/frame -->
        <ANIM_LAG>500</ANIM_LAG>
    </UseTemplate>
    <UseTemplate Name="ASOBO_GT_MouseRect">
<HIGHLIGHT_NODE_ID>__NO_HIGHLIGHT__</HIGHLIGHT_NODE_ID>
                <MOUSEFLAGS>LeftSingle</MOUSEFLAGS>
        <CURSOR>Hand</CURSOR>
        <TOOLTIPID>%((L:#NODE_ID#, number))%{if}On%{else}Off%{end}</TOOLTIPID>
                <CALLBACKCODE>
                    (M:Event) 'LeftSingle' scmi 0 == if{
                          (L:#ANIM_NAME#) ! (&gt;L:#ANIM_NAME#) }
                </CALLBACKCODE>
    </UseTemplate>
</Template>
</ModelBehaviors>
Place Temp_code.xml in the model folder where your main interior.xml code and model are located.
In the main interior.xml file, add the lines from the code below that you don't have.

XML:
<?xml version="1.0" encoding="utf-8"?>
<ModelInfo version="1.1" guid="{<!-- you guid  -->}">
    <LODS autoGenerate="false">
        <!-- you LOD  -->
    </LODS>
    <Behaviors>
        <!--<Include ModelBehaviorFile="Asobo\Common.xml"/> you Include .... -->

        <!-- Modification -->
        <Include RelativeFile="..\model\Temp_code.xml"/>


        <Component ID="ELECTRICAL_SWITCH_Battery_Master_1" Node="ELECTRICAL_SWITCH_Battery_Master_1">
            <UseTemplate Name="Generic_Battery_contact">
                               <ANIM_NAME>ELECTRICAL_SWITCH_Battery_Master_1</ANIM_NAME>
            </UseTemplate>
        </Component>

        <Component ID="contact" Node="contact">
            <UseTemplate Name="Generic_Battery_contact">
                               <ANIM_NAME>contact</ANIM_NAME>
            </UseTemplate>
        </Component>

  <Component ID="Trigger">
    <UseTemplate Name="ASOBO_GT_Update">
      <FREQUENCY>1</FREQUENCY>
        <UPDATE_CODE>
          (L:ELECTRICAL_SWITCH_Battery_Master_1, bool) 1 ==
          (L:contact, bool) 1 == and
          (A:ELECTRICAL MASTER BATTERY, bool) 0 == and
          if{ 1 (&gt;A:ELECTRICAL MASTER BATTERY, bool) }
          (L:ELECTRICAL_SWITCH_Battery_Master_1, bool) 0 ==
          (L:contact, bool) 0 == ||
          if{ 0 (&gt;A:ELECTRICAL MASTER BATTERY, bool) }
        </UPDATE_CODE>
    </UseTemplate>
  </Component>

        <!-- you  Component .... -->

    </Behaviors>

        <!-- you old  Component Animation name= ....-->




</ModelInfo>

Assemble the solution in the simulator and I hope everything will be as it should be.
There are also options that can be done, such as starting the car, etc., according to your conditions.
Hi
Thank you very much for your help.
I'll try your code tonight and let you know.
Слава Україні
 
Героям Слава!
I checked myself, everything worked. I hope everything will work out for you. Let's see the test results together.
 
Героям Слава!
I checked myself, everything worked. I hope everything will work out for you. Let's see the test results together.
Hi Lyonya
Thank you for your patience and help.
Here's what I get: (vidéo)
The key works fine but the switch does not move and does not power on the plane. I would like the battery switch to only work if the ignition key is ON
I must have forgotten something!!
Here is my Temp_code.xml file put in the model folder:
<ModelBehaviors>
<Template Name="Generic_Battery_contact">
<Parameters Type="Default">
<ANIM_NAME>contact</ANIM_NAME>
</Parameters>
<UseTemplate Name="ASOBO_GT_Anim">
<NODE_ID>contact</NODE_ID>
I Is this ok or should I put ELECTRICAL_SWITCH_Battery_Master_1?
<ANIM_NAME>contact</ANIM_NAME> I
<NODE_ID>contact</NODE_ID>
<ANIM_CODE>(L:contact, bool) 50 *</ANIM_CODE> <!-- 50* you anmation time/frame -->
<ANIM_LENGTH>50</ANIM_LENGTH> <!-- 50 you anmation time/frame -->
<ANIM_LAG>500</ANIM_LAG>
</UseTemplate>
<UseTemplate Name="ASOBO_GT_MouseRect">
<HIGHLIGHT_NODE_ID>__NO_HIGHLIGHT__</HIGHLIGHT_NODE_ID>
<MOUSEFLAGS>LeftSingle</MOUSEFLAGS>
<CURSOR>Hand</CURSOR>
<TOOLTIPID>%((L:contact, bool))%{if}On%{else}Off%{end}</TOOLTIPID>
<CALLBACKCODE>
(M:Event) 'LeftSingle' scmi 0 == if{
(L:contact) ! (&gt;L:contact) }
</CALLBACKCODE>
</UseTemplate>
</Template>
</ModelBehaviors>


Here is my file interior.xml:
<ModelInfo version="1.1" guid="{40b3bd26-e060-4d70-8441-42a6f16f7f8c}">
<LODS autoGenerate="false">
<LOD minSize="150" ModelFile="kiebitz_int_LOD00.gltf"/>
<LOD minSize="150" ModelFile="kiebitz_int_LOD01.gltf"/>
</LODS>

<!--INCLUDED BEHAIVORS ###################### -->
<Behaviors>
<!-- ########################################## -->
<Include ModelBehaviorFile="Asobo\Common.xml" />
<Include ModelBehaviorFile="Asobo\Generic.xml" />
<Include ModelBehaviorFile="Asobo\Exterior.xml" />
<Include ModelBehaviorFile="Asobo\Inputs\Helpers.xml" />
<Include ModelBehaviorFile="Asobo\GPS\Aera.xml"/>
<Include ModelBehaviorFile="Asobo\NAVCOM\NavComSystem.xml" />
<Include ModelBehaviorFile="Asobo\NAVCOM\AS92.xml" />
<Include ModelBehaviorFile="Asobo\Transponder\AS21.xml" />
<Include ModelBehaviorFile="Asobo\Transponder\AS330.xml" />
<Include ModelBehaviorFile="Asobo\GlassCockpit\AS5.xml" />
<Include ModelBehaviorFile="Asobo\Generic\FX.xml" />
<Include RelativeFile="..\model\Temp_code.xml"/>



<!-- contact ON and OFF -->
<Component ID="ELECTRICAL_SWITCH_Battery_Master_1" Node="ELECTRICAL_SWITCH_Battery_Master_1">
<UseTemplate Name="Generic_Battery_contact">
<ANIM_NAME>ELECTRICAL_SWITCH_Battery_Master_1</ANIM_NAME>
</UseTemplate>
</Component>

<Component ID="contact" Node="contact">
<UseTemplate Name="Generic_Battery_contact">
<ANIM_NAME>contact</ANIM_NAME>
</UseTemplate>
</Component>

<Component ID="Trigger">
<UseTemplate Name="ASOBO_GT_Update">
<FREQUENCY>1</FREQUENCY>
<UPDATE_CODE>
(L:ELECTRICAL_SWITCH_Battery_Master_1, bool) 1 ==
(L:contact, bool) 1 == and
(A:ELECTRICAL MASTER BATTERY, bool) 0 == and
if{ 1 (&gt;A:ELECTRICAL MASTER BATTERY, bool) }
(L:ELECTRICAL_SWITCH_Battery_Master_1, bool) 0 ==
(L:contact, bool) 0 == ||
if{ 0 (&gt;A:ELECTRICAL MASTER BATTERY, bool) }
</UPDATE_CODE>
</UseTemplate>
</Component>
</Behaviors>

Слава Україні
 
<ModelBehaviors>
<Template Name="Generic_Battery_contact">
<Parameters Type="Default">
<ANIM_NAME>contact</ANIM_NAME>
</Parameters>
<UseTemplate Name="ASOBO_GT_Anim">
<NODE_ID>contact</NODE_ID>
I Is this ok or should I put ELECTRICAL_SWITCH_Battery_Master_1?
<ANIM_NAME>contact</ANIM_NAME> I
<NODE_ID>contact</NODE_ID>
<ANIM_CODE>(L:contact, bool) 50 *</ANIM_CODE> <!-- 50* you anmation time/frame -->
<ANIM_LENGTH>50</ANIM_LENGTH> <!-- 50 you anmation time/frame -->
<ANIM_LAG>500</ANIM_LAG>
</UseTemplate>
<UseTemplate Name="ASOBO_GT_MouseRect">
<HIGHLIGHT_NODE_ID>__NO_HIGHLIGHT__</HIGHLIGHT_NODE_ID>
<MOUSEFLAGS>LeftSingle</MOUSEFLAGS>
<CURSOR>Hand</CURSOR>
<TOOLTIPID>%((L:contact, bool))%{if}On%{else}Off%{end}</TOOLTIPID>
<CALLBACKCODE>
(M:Event) 'LeftSingle' scmi 0 == if{
(L:contact) ! (&gt;L:contact) }
</CALLBACKCODE>
</UseTemplate>
</Template>
</ModelBehaviors>
Героям Слава!
Hi! You don't need to change the template from the Temp_code.xml file. In the template code, you formulate the functions and then use the head code in the model, and then you put in your ideas and name them.
You don't need to change the template in the Temp_code.xml files. In the template code <Parameters Type="Default"> <ANIM_NAME>#ANIM_NAME#</ANIM_NAME> you form functions that you then use in the main model code by only providing your variables and their names. In the Component ... UseTemplate blocks
XML:
<!-- contact ON and OFF -->
<Component ID="ELECTRICAL_SWITCH_Battery_Master_1" Node="ELECTRICAL_SWITCH_Battery_Master_1">
<UseTemplate Name="Generic_Battery_contact">
<ANIM_NAME>ELECTRICAL_SWITCH_Battery_Master_1</ANIM_NAME>
</UseTemplate>
</Component>

<Component ID="contact" Node="contact">
<UseTemplate Name="Generic_Battery_contact">
<ANIM_NAME>contact</ANIM_NAME>
</UseTemplate>
</Component>

<UseTemplate Name="ASOBO_GT_Anim">
<NODE_ID>#ANIM_NAME#</NODE_ID> ... the variables already defined in "Default" are used. That is, you have the opportunity to add or change variables like C++ functions void Generic_Battery_contact ( doudle& ANIM_NAME, ...etc.) { NAME = ANIM_NAME ...; ...etc. };
https://docs.flightsimulator.com/ht...Templates.htm?rhhlterm=custom&rhsearch=custom Description in SDK.
Here is what your Temp_code.xml should look like.
 

Attachments

Last edited:
доброго ранку
Thanks for your help.
Basic animations don't bother me, but as soon as things get complicated, I get lost. Luckily, there are some nice people to help me.
So, if I understand correctly, I don't need to change the node IDs in the TempCode.xml file.
I'll try it this evening and come back to tell you, hopefully, that everything is OK!
Ще раз дякую і слава Україні
 
HI LYONYA
Sorry, but it's not working properly!!
The battery switch immediately pops back on, and the ignition key has no effect on the battery switch.

And here are my files as written: Temp_code.xml in the model folder:

<ModelBehaviors>

<Template Name="Generic_Battery_contact">
<Parameters Type="Default">
<ANIM_NAME>#ANIM_NAME#</ANIM_NAME>
</Parameters>
<UseTemplate Name="ASOBO_GT_Anim">
<NODE_ID>#ANIM_NAME#</NODE_ID>
<ANIM_NAME>#ANIM_NAME#</ANIM_NAME>
<NODE_ID>#ANIM_NAME#</NODE_ID>
<ANIM_CODE>(L:#ANIM_NAME#, bool) 50 *</ANIM_CODE> <!-- 50* you anmation time/frame -->
<ANIM_LENGTH>50</ANIM_LENGTH> <!-- 50 you anmation time/frame -->
<ANIM_LAG>500</ANIM_LAG>
</UseTemplate>
<UseTemplate Name="ASOBO_GT_MouseRect">
<HIGHLIGHT_NODE_ID>__NO_HIGHLIGHT__</HIGHLIGHT_NODE_ID>
<MOUSEFLAGS>LeftSingle</MOUSEFLAGS>
<CURSOR>Hand</CURSOR>
<TOOLTIPID>%((L:#NODE_ID#, bool))%{if}On%{else}Off%{end}</TOOLTIPID>
<CALLBACKCODE>
(M:Event) 'LeftSingle' scmi 0 == if{
(L:#ANIM_NAME#, bool) ! (&gt;L:#ANIM_NAME#, bool) }
</CALLBACKCODE>
</UseTemplate>
</Template>
</ModelBehaviors>


And the part in the interior.xml file:
<!-- contact ON and OFF -->

<Component ID="ELECTRICAL_SWITCH_Battery_Master_1" Node="ELECTRICAL_SWITCH_Battery_Master_1">
<UseTemplate Name="ASOBO_ELECTRICAL_Switch_Battery_Master_Template">
<NODE_ID>ELECTRICAL_Switch_Battery_Master_1</NODE_ID>
<ANIM_NAME>ELECTRICAL_Switch_Battery_Master_1</ANIM_NAME>
</UseTemplate>
<UseTemplate Name="Generic_Battery_contact">
<ANIM_NAME>ELECTRICAL_Switch_Battery_Master_1</ANIM_NAME>
</UseTemplate>
</Component>

<Component ID="contact" Node="contact">
<UseTemplate Name="Generic_Battery_contact">
<ANIM_NAME>contact</ANIM_NAME>
</UseTemplate>
</Component>

<Component ID="Trigger">
<UseTemplate Name="ASOBO_GT_Update">
<FREQUENCY>1</FREQUENCY>
<UPDATE_CODE>
(L:ELECTRICAL_SWITCH_Battery_Master_1, bool) 1 ==
(L:contact, bool) 1 == and
(A:ELECTRICAL MASTER BATTERY, bool) 0 == and
if{ 1 (&gt;A:ELECTRICAL MASTER BATTERY, bool) }
(L:ELECTRICAL_SWITCH_Battery_Master_1, bool) 0 ==
(L:contact, bool) 0 == ||
if{ 0 (&gt;A:ELECTRICAL MASTER BATTERY, bool) }
</UPDATE_CODE>
</UseTemplate>
</Component>
</Behaviors>

Thanks for your help, I'll try searching in the SDK documentation.
 
And the part in the interior.xml file:
<!-- contact ON and OFF -->

<Component ID="ELECTRICAL_SWITCH_Battery_Master_1" Node="ELECTRICAL_SWITCH_Battery_Master_1">
<UseTemplate Name="ASOBO_ELECTRICAL_Switch_Battery_Master_Template">
<NODE_ID>ELECTRICAL_Switch_Battery_Master_1</NODE_ID>
<ANIM_NAME>ELECTRICAL_Switch_Battery_Master_1</ANIM_NAME>
</UseTemplate>
<UseTemplate Name="Generic_Battery_contact">
<ANIM_NAME>ELECTRICAL_Switch_Battery_Master_1</ANIM_NAME>
</UseTemplate>
</Component>

<Component ID="contact" Node="contact">
<UseTemplate Name="Generic_Battery_contact">
<ANIM_NAME>contact</ANIM_NAME>
</UseTemplate>
</Component>

<Component ID="Trigger">
<UseTemplate Name="ASOBO_GT_Update">
<FREQUENCY>1</FREQUENCY>
<UPDATE_CODE>
(L:ELECTRICAL_SWITCH_Battery_Master_1, bool) 1 ==
(L:contact, bool) 1 == and
(A:ELECTRICAL MASTER BATTERY, bool) 0 == and
if{ 1 (&gt;A:ELECTRICAL MASTER BATTERY, bool) }
(L:ELECTRICAL_SWITCH_Battery_Master_1, bool) 0 ==
(L:contact, bool) 0 == ||
if{ 0 (&gt;A:ELECTRICAL MASTER BATTERY, bool) }
</UPDATE_CODE>
</UseTemplate>
</Component>
</Behaviors>
Hi!
<UseTemplate Name="ASOBO_ELECTRICAL_Switch_Battery_Master_Template"> ----------- You are using an inappropriate template.

Below I give you the correct code to use. Just copy and paste it in place of yours.
XML:
<!-- contact ON and OFF -->
<Component ID="ELECTRICAL_SWITCH_Battery_Master_1" Node="ELECTRICAL_SWITCH_Battery_Master_1">
<UseTemplate Name="Generic_Battery_contact">
<ANIM_NAME>ELECTRICAL_SWITCH_Battery_Master_1</ANIM_NAME>
</UseTemplate>
</Component>

<Component ID="contact" Node="contact">
<UseTemplate Name="Generic_Battery_contact">
<ANIM_NAME>contact</ANIM_NAME>
</UseTemplate>
</Component>

<Component ID="Trigger">
<UseTemplate Name="ASOBO_GT_Update">
<FREQUENCY>1</FREQUENCY>
<UPDATE_CODE>
(L:ELECTRICAL_SWITCH_Battery_Master_1, bool) 1 ==
(L:contact, bool) 1 == and
(A:ELECTRICAL MASTER BATTERY, bool) 0 == and
if{ 1 (&gt;A:ELECTRICAL MASTER BATTERY, bool) }
(L:ELECTRICAL_SWITCH_Battery_Master_1, bool) 0 ==
(L:contact, bool) 0 == ||
if{ 0 (&gt;A:ELECTRICAL MASTER BATTERY, bool) }
</UPDATE_CODE>
</UseTemplate>
</Component>
</Behaviors>
 
Last edited:
HI Lyonya
Thank you very much, it works perfectly.
I must say that I'm not a coding expert; I often just copy existing examples.
But now, thanks to you, I have a new example that I can use in other projects.
This is my project page for MSFS 2020, it is an ultra light biplane, the Keibitz 405:
Kiebitz for MSFS 2020
I will soon be able to publish it, thanks in part to your help.
Ще раз дякую і слава Україні.
 
Back
Top