• 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 RPN Woes

connomar

Resource contributor
Messages
267
Country
us-minnesota
My objective, which I thought was going to be easy, is to change the conditions under which an animated hangar door opens and closes. The working version used "Time of Day" and XML_YokeHidden2 to close at night, but still be able to open if the users wishes to enter.

The next idea was to add a feature to close the door if the weather turned nasty. The hidden agenda is that I haven't managed to stop it raining and snowing inside despite many occlusion attempts. When I tried to work out the logic, I realized my College classes 40+ years ago were but a distant memory, but as usual I was saved by the web.

So, my variables are:


A
(A:AMBIENT PRECIP RATE, millimeters of water)​
B(L:XMLVAR_YokeHidden2)
C(E:Time of Day,enum)

From these variables I derived the truth table

ABCRESULT
0000
0011
1010
1101
1111

Red text = NOT

From this, the boolean equation becomes ABC+AB

I thought I was home dry now. However, I have been confused as to why Asobo say the PartInfo function should no longer be used in new code, but then reference it in documentation as needed in the new code.


Anyway, the whole <model> xml is below, but it fails to even open the door. I don't understand, and can find no reference to, the method for ANDING three parameters instead of just two. In case it can only cope with two operands at a time, I have put the operator after the first two operands, then a third AND operator after the third. I have tried using the not operator to reverse the result of AMBIENT PRECIP RATE, which incidentally I want to trigger when millimeters of water exceeds 5.

Any help on this would be greatly appreciated.

Martin


<?xml version="1.0" encoding="utf-8"?>
<ModelInfo guid="{01a28a9d-37b7-4e5f-adc7-e29e7ee0a2cc}" version="1.1">
<LODS>
<LOD minSize="0" ModelFile="SkyHarborMainHangarA.gltf"/>
</LODS>

<!--Animation occurs in pairs due to a problem with MSFS not accepting constraints -->

<!--Original Mk 1 objective was to open a hangar door during the day and close it at night, but also be able to open it by hiding the right hand yoke of the aircraft -->
<!-- The Mk 2 objective is to close the door in inclement weather, but allow this to be overriden by the hidden yoke -->

<Animation name="OpenDoor" guid="f9c375db-9a10-4dc4-b729-df4aae9130e0" type="Sim" typeParam="Autoplay"/>
<Animation name="BottomDoor" guid="f0b6ea65-e1cc-469e-a37a-9e2cbc11814d" type="Sim" typeParam="Autoplay" />


<DefaultState name="SkyHarborHangar"/>

<AnimGraph>
<DefaultState name="SkyHarborHangar"/>
<BlendTreeState name="SkyHarborHangar">
<Animations>
<Animation guid="f9c375db-9a10-4dc4-b729-df4aae9130e0" loop="False" speed="1"/>
<Animation guid="f0b6ea65-e1cc-469e-a37a-9e2cbc11814d" loop="False" speed="1"/>
</Animations>
</BlendTreeState>
</AnimGraph>

<PartInfo>
<Name>OpenDoor</Name>
<AnimLength>720</AnimLength>
<Animation>
<Parameter>
<Code>
<!--(L:XMLVAR_YokeHidden2) 1 == (E:Time of Day,enum) 1 == or if{ 715 } els{ 0 } This is the working code without the precip addition-->
(A:AMBIENT PRECIP RATE, millimeters of water) 5 !&gt; (L:XMLVAR_YokeHidden2) 1 != and (E:Time of Day,enum) 1 == and (A:AMBIENT PRECIP RATE, millimeters of water) 5 &gt; (L:XMLVAR_YokeHidden2) 1 == and or if{715} els{0}
</Code>
<Lag>10</Lag>
</Parameter>
</Animation>
</PartInfo>
<PartInfo>
<Name>BottomDoor</Name>
<AnimLength>720</AnimLength>
<Animation>
<Parameter>
<Code>
<!--L:XMLVAR_YokeHidden2) 1 == (E:Time of Day,enum) 1 == or if{ 715 } els{ 0 }-->
(A:AMBIENT PRECIP RATE, millimeters of water) 5 !&gt; (L:XMLVAR_YokeHidden2) 1 != and (E:Time of Day,enum) 1 == and (A:AMBIENT PRECIP RATE, millimeters of water) 5 &gt; (L:XMLVAR_YokeHidden2) 1 ==; and or if{715} els{0}
</Code>
<Lag>10</Lag>

</Parameter>
</Animation>
</PartInfo>

<!-- Behaviour below makes Light inside the hangar visible if Yoke 2 is hidden and it is not daytime.-->



<Behaviors>
<Component ID="LightInsideOfHangar" Node="InsidePointLight">
<Visibility>
<Parameter>
<Code>(L:XMLVAR_YokeHidden2) 1 == (E:Time of Day,enum) != or if{1} els {0}</Code>
</Parameter>
</Visibility>
</Component>>
</Behaviors>

</ModelInfo>
 
I can't go through all this but I suggest removing comments from within the <Code> elements (because I've had trouble with that before).

What is !&gt; ? Is that legal? Why not use &lt;= ?

Put a space between if( and 715 (again, not sure if this is completely necessary but it's something I always do)

<Code>(L:XMLVAR_YokeHidden2) 1 == (E:Time of Day,enum) != or if{1} els {0}</Code>

You have a space between els and { which is a syntax error.

Also, in reverse polish notation if you want to "and" test 3 parameters then "parameter parameter parameter &amp; &amp;" works although "parameter parameter &amp; parameter &amp;" will work just as well.

If a string of and/or statements is starting to get too confusing don't be afraid of breaking it up into if els statements.

For example, you could if els the precip rate and then use and/or for the yokehidden/time of day test.
 
Many thanks Anthony, you have confirmed for me how the stack principle works with multiple parameters, so I know not to try three in a row again. No spaces between if{ and els{ but space after is now clear, so if{ 20 } etc.
Next step is to work out how to template this lot so I can efficiently use it in multiple instances.

Breaking down in sections using if{ } els {} is a good idea. I will try that out.

Thanks again,
Martin
 
Back
Top