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

XML Question for makemdl code

Milton_Shupe

Resource contributor
Messages
331
Country
us-newmexico
Can a decimal number be used in this comparison?

Code:
      <code>
        (A:AMBIENT WIND VELOCITY, knots) 33.99 &gt;
           if{ 1 } els{ 0 }
      </code>

How does one determine the format of the variable, and is there a way to convert the format to decimal for these kinds of comparisons?
 
Almost all units, except for bool and enum use decimal numbers. So this should be fine.
 
What specifically do minvalue and maxvalue statements accomplish?

Do they initialize the data cell? Do they restrict values to the stated set?

Why does this statement matter, or what is its purpose in a bool test where the result could be zero or one?

Code:
<minvalue>1</minvalue>
 
It is limiting the lowest possible valid values of your variable to the integer "1" thereby excluding anything less than "1".
 
Okay Bill, that makes perfect sense. Now let's put it in context of the following working code. If the value could never be less than 1, why would this work? And forgive my ignorance on this subject, but to what variable does the <minvalue> statement refer?

Code:
<part>
  <name>jibs_port_fly</name>
    <visible_in_range>
    <parameter>
      <code>
        (A:Trailing edge flaps0 left angle, degrees) 50 &lt;
        (A:BRAKE PARKING POSITION, percent) 0 ==
        and
        if{ 1 } els{ 0 }
      </code>
    </parameter>
    <minvalue>1</minvalue>
  </visible_in_range>
</part>
 
Last edited:
I believe it refers to the visible_in_range statement. Note that is is just "inside" that statement /endstatement pair. if the value is less than 1, then the visible_in_range statement is outside the range (i.e. false) and the part becomes invisible.
 
Tom, I like your explanation. If the statement is simply yes or no to display, then how is "in range" defined?
 
"In range" is set by the minvalue statement. True is 1 or greater, false is less than that. This is opposed to the more usual boolean determination - 0 is false, anything else is true.
 
And yet, another question.

Does either/or logic work in xml model coding for FS9? I cannot seem to get this to work at all when either condition is met.

When sail_fs is hidden, or if parking brake is set, show this part.

Code:
<part>
  <name>secured02</name>
    <visible_in_range>
    <parameter>
      <code>
        (L:sail_fs,bool) !
        (A:BRAKE PARKING POSITION, percent) 0 !=
        or
      </code>
    </parameter>
   <minvalue>1</minvalue>
  </visible_in_range>
</part>
 
Last edited:
I am not the best at code, but I think the second condition will not work. Its stating if your brake is 'not' or equals-too a brake position of 0. What if you just use ! alone or use == if you need brakes to be on 0.
! ...... 'not' or naught or 'is-not'
== ...... equaled to (is this)
 
Hi,

The SDK says that BRAKE PARKING POSITION is boolean, and setting this to percent may cause problems. Try using (A:BRAKE PARKING POSITION, bool) ! instead.
 
Hi,

The SDK says that BRAKE PARKING POSITION is boolean, and setting this to percent may cause problems. Try using (A:BRAKE PARKING POSITION, bool) ! instead.
Hi Tom,

The "unit" for this variable changed from FS9 to FSX-Accel. The FSX-Accell SDK speaks of "position" (and a value range) instead of Boolean.
No clue why, since there's no keyevent to set the ParkingBrakes proportionally.

But both (using either bool or percent) work; in FS9 and FSX.

If fact, the code that Milton posted, works as intended; the problem was somewhere else in the .mdl..

Rob
 
Indeed, I am slow getting back to this. This issue I had was with the part name, not the code.

As a matter of fact, the "or" logic works great, as does use of the "||" alternative.
 
Indeed, I am slow getting back to this. This issue I had was with the part name, not the code.

As a matter of fact, the "or" logic works great, as does use of the "||" alternative.


Which is the 'format' preferred for both FSX or FS9....

and && &amp;&amp;
or ||
not !
 
I think it's personal perference only.
When I started with XML in FS2002, I learned the basics of XML from a document by Arne Bartels.
And I still use it the same way; so &gt; &lt; || , &amp;&amp; ! , etc etc

Besides, some "shortcuts" don't work in some situations; like using "<" instead of "&lt;"

Rob
 
The "<" symbol cannot be used since it is the opening delimiter for every <token> used in the XML schema. Although the ">" symbol is the closing delimiter for all <token> used, only it's absence will cause a parsing error in the XML schema. That is why it may be used in lieu of the &gt; form.

As for the logic symbols, I use 'and' and 'or' exclusively.
 
I think it's personal perference only.
When I started with XML in FS2002, I learned the basics of XML from a document by Arne Bartels.
And I still use it the same way; so &gt; &lt; || , &amp;&amp; ! , etc etc

Besides, some "shortcuts" don't work in some situations; like using "<" instead of "&lt;"

Rob

Rob,

Is that Arne Bartels document available to the public; would love to have a copy of that.

EDIT: Whoops! Found it at Flightsim.com. :-)
 
Last edited:
Back
Top