• 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.

MSFS XML Event Trigger

Messages
16
Country
denmark
Hello,

I'm stuck and cannot get an event to trigger. I have a drone with multiple engines and want the drone to go into a sort of safe mode if one engine fails, safe mode being a hover at first.

This is the code I tried and nothing happens when engine 1's RPM falls below 100 RPM:

XML:
        <!-- Drone Hover -->
        <Component ID="Drone_Hover">
        <Parameter>
        <Code>
        (A:PROP RPM:1) 100 &lt; if{ 1 (>K:FREEZE_ATTITUDE_TOGGLE) } els{ 0 (>K:FREEZE_ATTITUDE_TOGGLE) }
        </Code>
        </Parameter>
        </Component>

I then thought to link the event to the taxi light as a test, so that the hover mode gets triggered when the taxi light gets turned on:

XML:
        <!-- Drone Hover -->
        <Component ID="Drone_Hover">
        <Parameter>
        <Code>
        (A:TAXI LIGHT, bool) if{ 1 (>K:FREEZE_ATTITUDE_TOGGLE) } els{ 0 (>K:FREEZE_ATTITUDE_TOGGLE) }
        </Code>
        </Parameter>
        </Component>

No luck with that either. Am I doing something fundamentally wrong with the above code?

Any help greatly appreciated.

Thanks.

Anna
 
Last edited:
Messages
16
Country
denmark
<Parameter>
<Code>
</Code>
</Parameter>

Yes thanks, all of that is correct, as in my amended post, I just messed up copy and pasting, tired eyes.

Do you have any idea why the event is not being triggered at all? Is there anything missing, should I be using some sort of Asobo XML template for all of this to work correctly?
 
Messages
135
Country
ukraine
You can use templates and it will be more convenient for you. I just do not see the full logic described in your option. It does not describe binding to animation nodes, parts, and components.

If you want a simple solution for the logic of work and dependencies of the behavior of the model, and not for animation, then it’s easier for you to make a separate device in the panel, even just in XML, and arrange everything there.

For example create a folder and file ..panel\Drone_Hover_Main\Drone_freeze.xml in the model panel

XML:
<Gauge Name="Drone_freeze" Version="1.0">
 
(A:PROP RPM:1) 100 &lt; if{ 1 (>K:FREEZE_ATTITUDE_TOGGLE) } els{ 0 (>K:FREEZE_ATTITUDE_TOGGLE) }

</Gauge>

and write it in PANEL.CFG

Code:
//--------------------------------------------------------
[VCockpit01]
size_mm=1024,768
pixel_size=1024,768
texture=$Main
background_color=0,0,255

gauge00=Drone_Hover_Main!Drone_freeze,  0,0,1024,768

And work with it. You will have the ability to easily edit, change and add parameters.
 
Last edited:
Messages
495
Country
austria
this works in P3Dv5

XML:
        (A:IS ATTITUDE FREEZE ON,bool) 0 ==
         (A:PROP RPM:1) 100 &lt;
        &amp;&amp;
        if{
          1 (&gt;K:FREEZE_ATTITUDE_SET)
          }

        (A:IS ATTITUDE FREEZE ON,bool) 1 ==
         (A:PROP RPM:1) 100 &gt;=
        &amp;&amp;
        if{
          0 (&gt;K:FREEZE_ATTITUDE_SET)
          }

I also have added
1 (&gt;K:FREEZE_LATITUDE_LONGITUDE_SET)
or
0 (&gt;K:FREEZE_LATITUDE_LONGITUDE_SET)
 
Messages
16
Country
denmark
Thanks for your input, for some reason it just won't work, not sure why, I'm baffled.

I have now tried to link the XML event logic to a switch with the following:

XML:
    <Template Name="Drone_Lights_Switch_Light_Template">
        <Parameters Type="Default">
            <INTERACTION_TYPE>SWITCH</INTERACTION_TYPE>
            <LIGHT_TYPE>TAXI</LIGHT_TYPE>
            <NODE_ID>Drone_Lights_Switch_Taxi_Light</NODE_ID>
            <ANIM_NAME>Drone_Lights_Switch_Taxi_Light</ANIM_NAME>
            <PART_ID>Drone_Lights_Switch_Taxi_Light</PART_ID>
        </Parameters>
        <UseTemplate Name="ASOBO_LIGHTING_Light_Template">
            <TOOLTIP_TITLE/>
            <TOOLTIPID>Taxi light switch</TOOLTIPID>
        </UseTemplate>
        <Component ID="Drone_Freeze_Position">
                <Parameter>
                    <Code>
            (L:Drone_Lights_Switch_Taxi_Light, Bool) if{ 1 (&gt;K:FREEZE_ATTITUDE_SET) } els{ 0 (&gt;K:FREEZE_ATTITUDE_SET) }       
                    </Code>
                </Parameter>
        </Component>       
    </Template>

Since the taxi light switch is a normal up or down position switch, it can have either a 1 or 0 value if my understanding is correct. So the up position should turn the FREEZE_ATTITUDE_SET on and moving the switch down should turn it off.

Unfortunately this doesn't seem to work either, I'm not sure why? I've also tried FREEZE_ATTITUDE_TOGGLE and that also doesn't work.

I can't believe this is so complicated and difficult! All I want is for the FREEZE_ATTITUDE_SET to be activated when the switch is up and deactivated when the switch is down, what am I doing wrong?
 
Messages
495
Country
austria
Have you got a debug file where you can check the state of some vars?

for example

XML:
      %A:IS ATTITUDE FREEZE ON,bool\t%((A:IS ATTITUDE FREEZE ON,bool))%!2.2f!\n
 
Top