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

FSXA [Solved]Gauge to ModelDef, any XML changes required?

Kekelekou

Resource contributor
Messages
226
Country
france
Hello,

I am working on an animated firefighter signaling to the airtanker pilot the required actions at refill station (to be used along FireFighterX).
I had added the animation code to a XML gauge so that debugging was much easier. The codes is now working like a charm.
But I would like to directly inject the code into the MDL file, so that no panel/gauge fiddling is required from the end-user.
So I have just updated the anim code in the ModelDef to include the whole code as given below. But no joy ingame.

I have heard about XML format changes between gauges and ModelDef, could this be the cause of the animation failure ingame?

Any help appreciated.

Have a nice evening.

Code:
<?xml version="1.0" encoding="utf-8"?>

<ModelInfo>

  <Animation name="Peli_Guide_anim" guid="03351903-AF90-41fa-9406-8098038A0823" length="1000" type="Sim" typeParam2="Peli_Guide_anim" typeParam="AutoPlay" />

  <PartInfo>

    <Name>Peli_Guide_anim</Name>

    <AnimLength>1000</AnimLength>

    <Animation>

      <Parameter>

        <Code>



(L:RefillStation_Distance, number) 10 - 0 max (&gt; L:Peli_DistToZone, number)




(L:Peli_CurrentStatus, enum) 0 !=

(L:Peli_CurrentStatus, enum) 0 ==

(L:RefillStation_Status, number) 1 == &amp;&amp;

||

if{



    (L:Peli_Timer, number) 90 &gt;=

    if{

        (L:Peli_CurrentStatus, enum) (L:RefillStation_Status, number) !=

        if{

            (L:Peli_Timer, enum) 99 ==

            if{

                (L:Peli_CurrentStatus, enum) 4 ==

                (L:Peli_CurrentStatus, enum) 5 ==

                ||

                (L:RefillStation_Status, number) 0 ==

                &amp;&amp;

                if{

                    9 (&gt; L:Peli_CurrentStatus, enum)

                    0 (&gt; L:Peli_LoopStart, number)

                    0 (&gt; L:Peli_IsLoop, bool)

                    0 (&gt; L:Peli_Timer, number)

                }

              

                (L:Peli_CurrentStatus, enum) 9 ==

                (L:Peli_DistToZone, number) 150 &gt;

                (A:Sim On Ground, bool) ! ||

                &amp;&amp;

                if{

                    0 (&gt; L:Peli_CurrentStatus, enum)

                    30 (&gt; L:Peli_LoopStart, number)

                    1 (&gt; L:Peli_IsLoop, bool)

                    1 (&gt; L:Peli_Timer, number)

                }

              

                (L:RefillStation_Status, number) 1 ==

                if{

                    1 (&gt; L:Peli_CurrentStatus, enum)

                    80 (&gt; L:Peli_LoopStart, number)

                    0 (&gt; L:Peli_IsLoop, bool)

                    80 (&gt; L:Peli_Timer, number)

                }

              

                (L:RefillStation_Status, number) 2 ==

                (L:RefillStation_Status, number) 3 == ||

                (L:RefillStation_Status, number) 4 == ||

                (L:RefillStation_Status, number) 5 == ||

                if{

                    (L:RefillStation_Status, number) (&gt; L:Peli_CurrentStatus, enum)

                    70 (&gt; L:Peli_LoopStart, number)

                    1 (&gt; L:Peli_IsLoop, bool)

                    60 (&gt; L:Peli_Timer, number)

                }


                (L:RefillStation_Status, number) 6 ==

                (L:RefillStation_Status, number) 7 == ||

                if{

                    (L:RefillStation_Status, number) (&gt; L:Peli_CurrentStatus, enum)

                    0 (&gt; L:Peli_LoopStart, number)

                    0 (&gt; L:Peli_IsLoop, bool)

                    60 (&gt; L:Peli_Timer, number)

                }


                (L:RefillStation_Status, number) 8 ==

                if{

                    8 (&gt; L:Peli_CurrentStatus, enum)

                    0 (&gt; L:Peli_LoopStart, number)

                    0 (&gt; L:Peli_IsLoop, bool)

                    90 (&gt; L:Peli_Timer, number)

                }


            }

      

            els{

                (L:Peli_Timer, number) 1.0 + 99 min (&gt; L:Peli_Timer, number)

            }

      

        }

      

        els{

            (L:Peli_IsLoop, bool)

            if{

                (L:Peli_LoopStart, number) (&gt; L:Peli_Timer, number)

            }

        } 

  


  

    }

  

    els{

        (L:Peli_Timer, number) 1.0 + 90 min (&gt; L:Peli_Timer, number)

    }


}


      

els{

  

    (L:Peli_DistToZone, number) 300 &lt;

    if{

      

        (L:Peli_DistToZone, number) 15 &lt;

        if{

            90

          

            99 90 -

            15 (L:Peli_DistToZone, number) - 0 max

            15 /

            *

          

            +

            (&gt; L:Peli_Timer, number)

        }

      

        els{

            (L:Peli_Timer, number) 90 &gt;=

            if{

                30 (&gt; L:Peli_Timer, number)

            }

            els{

                (L:Peli_Timer, number) 1.0 + 90 min (&gt; L:Peli_Timer, number)

            }

        }

    }

  

    els{

        25 0 300 5 + (L:Peli_DistToZone, number) - max +

        (&gt; L:Peli_Timer, number)

    }

  

}



100 (L:Peli_CurrentStatus, number) *

(L:Peli_Timer, number) +

                </Code>

      </Parameter>

    </Animation>

  </PartInfo>

</ModelInfo>

In the working "gauge" version, the modeldef featured only the last "100 (L:peli_CurrentStatus, number) * (L:peli_Timer, number) +" bit. All the rest was included in a panel gauge.

19/03/2019 Edit : The issue is related to the fact that this code is not run by the user aircraft's MDL, but by an AI ground vehicle.
 
Last edited:
Messages
440
Country
us-wisconsin
If that code you supplied is a direct copy from your ModelDef then something drastic happened in the formatting, mainly the "& gt ;" when writing to a L:Var.
Below is a cleaned up code set, nothing in the logic was changed. Formatted to keep track of the if/else's.
Just don't know, maybe try the code below.
XML:
<Animation name="Peli_Guide_anim" guid="03351903-AF90-41fa-9406-8098038A0823" length="1000" type="Sim" typeParam2="Peli_Guide_anim" typeParam="AutoPlay" />

<PartInfo>
    <Name>Peli_Guide_anim</Name>
    <AnimLength>1000</AnimLength>
    <Animation>
        <Parameter>
            <Code>
                (L:RefillStation_Distance, number) 10 - 0 max (>L:Peli_DistToZone, number)

                    (L:Peli_CurrentStatus, enum) 0 != (L:Peli_CurrentStatus, enum) 0 == (L:RefillStation_Status, number) 1 == and ||  if{
                        (L:Peli_Timer, number) 90 &gt;= if{
                            (L:Peli_CurrentStatus, enum) (L:RefillStation_Status, number) != if{ 
                                (L:Peli_Timer, enum) 99 == if{
                                    (L:Peli_CurrentStatus, enum) 4 == (L:Peli_CurrentStatus, enum) 5 == || (L:RefillStation_Status, number) 0 == and if{
                                        9 (>L:Peli_CurrentStatus, enum) 0 (>L:Peli_LoopStart, number) 0 (>L:Peli_IsLoop, bool) 0 (>L:Peli_Timer, number) 
                                    }
                                    (L:Peli_CurrentStatus, enum) 9 == (L:Peli_DistToZone, number) 150 &gt; (A:Sim On Ground, bool) ! || and if{ 
                                        0 (>L:Peli_CurrentStatus, enum) 30 (>L:Peli_LoopStart, number) 1 (>L:Peli_IsLoop, bool) 1 (>L:Peli_Timer, number) 
                                    }
                                    (L:RefillStation_Status, number) 1 == if{ 
                                        1 (>L:Peli_CurrentStatus, enum) 80 (>L:Peli_LoopStart, number) 0 (>L:Peli_IsLoop, bool) 80 (>L:Peli_Timer, number) 
                                    }
                                    (L:RefillStation_Status, number) 2 == (L:RefillStation_Status, number) 3 == || (L:RefillStation_Status, number) 4 == || (L:RefillStation_Status, number) 5 == || if{
                                        (L:RefillStation_Status, number) (>L:Peli_CurrentStatus, enum) 70 (>L:Peli_LoopStart, number) 1 (>L:Peli_IsLoop, bool) 60 (>L:Peli_Timer, number) 
                                    }
                                    (L:RefillStation_Status, number) 6 == (L:RefillStation_Status, number) 7 == || if{
                                        (L:RefillStation_Status, number) (>L:Peli_CurrentStatus, enum) 0 (>L:Peli_LoopStart, number) 0 (>L:Peli_IsLoop, bool) 60 (>L:Peli_Timer, number) 
                                    }
                                    (L:RefillStation_Status, number) 8 == if{ 
                                        8 (>L:Peli_CurrentStatus, enum) 0 (>L:Peli_LoopStart, number) 0 (>L:Peli_IsLoop, bool) 90 (>L:Peli_Timer, number) 
                                    }
                                } els{
                                    (L:Peli_Timer, number) 1.0 + 99 min (>L:Peli_Timer, number)
                                }
                            } els{ 
                                (L:Peli_IsLoop, bool) if{ 
                                    (L:Peli_LoopStart, number) (>L:Peli_Timer, number)
                                }
                            }  
                        } els{ 
                            (L:Peli_Timer, number) 1.0 + 90 min (>L:Peli_Timer, number)
                        }
                    } els{ 
                        (L:Peli_DistToZone, number) 300 &lt; if{ 
                            (L:Peli_DistToZone, number) 15 &lt; if{ 
                                90 99 90 - 15 (L:Peli_DistToZone, number) - 0 max 15 / * + (>L:Peli_Timer, number) 
                            } els{ 
                                (L:Peli_Timer, number) 90 &gt;= if{
                                    30 (>L:Peli_Timer, number)
                                } els{ 
                                    (L:Peli_Timer, number) 1.0 + 90 min (>L:Peli_Timer, number) 
                                }
                            }
                        } els{ 
                            25 0 300 5 + (L:Peli_DistToZone, number) - max + (>L:Peli_Timer, number) 
                        }
                    }

                100 (L:Peli_CurrentStatus, number) * (L:Peli_Timer, number) +
            </Code>
        </Parameter>
    </Animation>
</PartInfo>
 

Kekelekou

Resource contributor
Messages
226
Country
france
Hello Roman,

Thanks for helping!
I have got used to typing "&gt;" instead of ">" (and "lt;" for "<") in my gauges, but it might not be necessary to do so.
I'll test and report with your reformatted code.
Thanks again.
 
Last edited:
Messages
218
Country
greece
@Kekelekou both &gt; and > are accepted in modeldef.xml. There is a syntax problem that can be seen below (direct comparison):

As you can see in the examples, you have a whitespace between &gt; and the L:var, which breaks the syntax rules.

XML:
(&gt; L:Peli_DistToZone, number)
(&gt;L:Peli_DistToZone, number)

Alternatively:

XML:
(&gt; L:Peli_DistToZone, number)
(>L:Peli_DistToZone, number)
 

tgibson

Resource contributor
Messages
11,338
Country
us-california
And while you can use > you cannot use <, you must use the code version.
 

Kekelekou

Resource contributor
Messages
226
Country
france
Thx all for your kind input.
I must say I am puzzled because I am pretty sure the gauge code features the space in the « &gt; L: », but it works fine. Maybe that’s the while point between gauge and modeldef syntaxes?
I’ll test that too.
 

Kekelekou

Resource contributor
Messages
226
Country
france
Well, tested with suggested modification (no space between &gt; and L:var), but no joy so far.
 

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
Thx all for your kind input.
I must say I am puzzled because I am pretty sure the gauge code features the space in the « &gt; L: », but it works fine. Maybe that’s the while point between gauge and modeldef syntaxes?
I’ll test that too.
If your sample code was not contained in a CODE box format, then the added space was inserted to prevent the board software from treating it as a smilie. The space will prevent the scripted variable from working properly. The is undoubtedly something else wrong with your script.
 

Kekelekou

Resource contributor
Messages
226
Country
france
Getting back at this...

I gave another shot today, but I am still experiencing weird things:
- the code works fine when in a gauge
- when the code is "modeldefed" into the MDL, it does not run at all (all Lvars are stuck to 0), but I can still choose the KF by setting Peli_CurrentStatus and Peli_Timer with LINDA. This means that the sim sees what's inside the code section.
I concluded from that the main if/els sections may be faulty :
- I tried deleting everything in the main if{} section, no joy
- I tried deleting everything in the main els{} section, no joy neither

I am puzzled to say the least...
 

Kekelekou

Resource contributor
Messages
226
Country
france
Good lord!

Even a anim code as simple as this one does not work : No incrementation of Peli_Timer when its value is brought above 100 with LINDA. What the heck is going on?
Code:
<?xml version="1.0" encoding="utf-8"?>
<ModelInfo>
  <Animation name="Pelicandrome_Guidage_anim1" guid="994959c3-90d4-4f94-b229-8ef5ba9d5c91" typeParam2="Pelicandrome_Guidage_anim1" length="999" type="Sim" typeParam="AutoPlay" />
  <PartInfo>
    <Name>Pelicandrome_Guidage_anim1</Name>
    <AnimLength>999</AnimLength>
    <Animation>
      <Parameter>
        <Code>
(L:Peli_Timer, number) 100 &gt;=
            if{
                (L:Peli_Timer, number) 1.0 + (&gt; L:Peli_Timer, number)
            }

100 (L:Peli_CurrentStatus, number) *
(L:Peli_Timer, number) +
        </Code>
      </Parameter>
    </Animation>
  </PartInfo>
</ModelInfo>

Just to check if "if{}" code is run (or even read), I have just tested this code. Which is working as expected.

Code:
<?xml version="1.0" encoding="utf-8"?>
<ModelInfo>
  <Animation name="Pe_Guidage_anim" guid="994959c3-90d4-4f94-b229-8ef5ba9d5c90" length="1000" type="Sim" typeParam2="Pe_Guidage_anim" typeParam="AutoPlay" />
  <PartInfo>
    <Name>Pe_Guidage_anim</Name>
    <AnimLength>1000</AnimLength>
    <Animation>
      <Parameter>
        <Code>
(L:Peli_Timer, number) 100 &lt;
if{
    (L:Peli_Timer, number) 50 &lt;
    if{
        190
    }

    els{
        932
    }
}

els{
    580
}
        </Code>
      </Parameter>
    </Animation>
  </PartInfo>

But what follows won't work :

Code:
 <Animation name="Pelicandrome_Guidage_anim1" guid="994959c3-90d4-4f94-b229-8ef5ba9d5c91" length="1000" type="Sim" typeParam2="Pelicandrome_Guidage_anim1" typeParam="AutoPlay" />
  <PartInfo>
    <Name>Pelicandrome_Guidage_anim1</Name>
    <AnimLength>1000</AnimLength>
    <Animation>
      <Parameter>
        <Code>
(L:Peli_Timer, number) 100 &gt;=
            if{
                (L:Peli_CurrentStatus, number) 1.0 + (&gt; L:Peli_CurrentStatus, number)
            }

100 (L:Peli_CurrentStatus, number) *
(L:Peli_Timer, number) +
        </Code>
      </Parameter>
    </Animation>
  </PartInfo>

So evaluations seem to work fine, while calculations or value assignments won't.
Has anyone ever face such a "no calculations or value assignments within a modeldef if{} section" limitation? Would be weird though
 
Last edited:

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
Try this math instead:
(L:Peli_CurrentStatus, number) ++ (&gt;L:Peli_CurrentStatus, number)

Hint 1: if you want to increment by one, ++ will work just as well as 1 +
Hint 2: your "math" failed because you have a space between (&gt; and L:....
Hint 3: I prefer using the > symbol exclusively for XML assignment functions: (>L:...)
 

Kekelekou

Resource contributor
Messages
226
Country
france
Thank you Bill for your input, once again.
Hint 1 : I wrote 1.0 + because the value defines the animation speed. I find it more explicit with 1.0 rather than with ++.
Hint 2 : I am pretty sure I tested with no space, but I'll double-check tonight. Won't harm. By the way, if this is the root-cause of the failure, this means that this is a discrepency between ModelDef XML and gauge XML : the code posted in my first comment runs smoothly from a gauge (and with space between &gt; and L:var)
Hint 3 : So far, I have wanted to keep consistency with my code by always typing &gt; and &lt;. But if it can fix my issue, I'll change my point of view.
 

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
Hint 3: In this sole case where the symbol > works, I use it strictly for my own clarity. The fact that it's only one character rather than four is yet another reason.

In this one instance there is no functional difference between > and &gt; :teacher:
 

Kekelekou

Resource contributor
Messages
226
Country
france
No joy with neither

Code:
<Code>
(L:Peli_Timer, number) 100 &gt;=
            if{
                4 (>L:Peli_CurrentStatus, number)
            }

100 (L:Peli_CurrentStatus, number) *
(L:Peli_Timer, number) +
        </Code>

nor

Code:
<Code>
(L:Peli_Timer, number) ++ (>L:Peli_Timer, number)

(L:Peli_Timer, number)
        </Code>

nor

Code:
<Animation>
      <Parameter>
        <Code>
95 (>L:Peli_Timer, number)

(L:Peli_Timer, number)
        </Code>
      </Parameter>
    </Animation>


This is getting ridiculous... o_O

Edit : By "doesn't work" I mean Peli_Timer value remains at 0 whatever the code should force it to. But when altered with Linda the supposed KF is reached indeed.
 
Last edited:

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
You know, I've actually only been looking for syntax errors. I finally occurred to me to examine the logic. In the following example, you are looking for a condition of (L:Peli_Timer, number 100 &gt;... How and where is this condition being reached? Nowhere that I can see.

What are these two lines supposed to accomplish? 100 (L:Peli_CurrentStatus, number) * (L:Peli_Timer, number) +

Code:
(L:Peli_Timer, number) 100 &gt;=
            if{
                (L:Peli_CurrentStatus, number) 1.0 + (&gt; L:Peli_CurrentStatus, number)
            }

100 (L:Peli_CurrentStatus, number) *
(L:Peli_Timer, number) +
 

Kekelekou

Resource contributor
Messages
226
Country
france
I set the value of
Code:
L:Peli_Timer
through LINDA. So that I can check if changing its value ends up in
Code:
L:Peli_CurrentStatus
changing too.

The last two lines are the ones that set the KF depending on the status of the Lvars. I suspected first that I couldn't have a Lvar assignement AND a calculation at the same time. I have kept the lines but they are not essential in the test code.
 
Messages
440
Country
us-wisconsin
I concur with Fr. Bill.. Looking at the original code from above, nowhere in it does "peli_Timer" gets assigned any value before the 2nd if{ ..

XML:
<Animation name="Peli_Guide_anim" guid="03351903-AF90-41fa-9406-8098038A0823" length="1000" type="Sim" typeParam2="Peli_Guide_anim" typeParam="AutoPlay" />

<PartInfo>
    <Name>Peli_Guide_anim</Name>
    <AnimLength>1000</AnimLength>
    <Animation>
        <Parameter>
            <Code>
                (L:RefillStation_Distance, number) 10 - 0 max (>L:Peli_DistToZone, number)

                    (L:Peli_CurrentStatus, enum) 0 != (L:Peli_CurrentStatus, enum) 0 == (L:RefillStation_Status, number) 1 == and ||  if{
                        (L:Peli_Timer, number) 90 &gt;= if{

<!-- EVERYTHING IN THIS AREA DOESN'T MATTER  - L:Peli_Timer never gets above 0. -->

                         }
                    }

                100 (L:Peli_CurrentStatus, number) * (L:Peli_Timer, number) +
            </Code>
        </Parameter>
    </Animation>
</PartInfo>
 
Last edited:

Kekelekou

Resource contributor
Messages
226
Country
france
Thanks for posting.
I am pretty confident that the original code works as expected because I tested it as follows : all the code in a gauge except this last bit in the modeldef animation:


Code:
100 (L:peli_CurrentStatus, number) *
(L:peli_Timer, number) +
And this works absolutely fine!


That’s why I don’t understand why the same darn code won’t work when injected from the modeldef!
 
D

Deleted member 1281

Guest
Be aware of what your code accomplishes, namely, as far as I can see:
Code:
timer      0-99     100   101   102 ...  107   108
status     0        1     2     3   ...  8     9
result    0-100    200   301   402 ...  907    unpredictable

Your timer can only run from 0 to 107 (really?); your animation will be active even if timer is less than 100 (really?) ... many other questions, including why make it so trap-prone in the first place. Of course you could assign that last calculation to a variable and read it out together with current time and status values, better than relying on anything else.
 

Kekelekou

Resource contributor
Messages
226
Country
france
Thanks for joining mjahn!

Just to make things clear : The only real code that is supposed to run the anim is the one posted in my #1 comment. This code runs flawless if used in a XML gauge and the modeldef featuring only the "100 (L: peli_CurrentStatus, number) * (L: peli_Timer, number) +" bit.

All others are TEST codes supposed to help me finding the bug. They are not supposed to work in a meaningful way. I just wanted to check if specific features work indeed (lvar assignements) or and the entrance in a if{} section (by setting values with LINDA).
 
Top