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

FSX ACE xml schema if condition

Messages
28
Country
unitedkingdom
I have created a gauge in ACE xml with some 30 elements all of which are working but 1.
the element in question is a warning light for the altitude bug the code for which was in FS9 schema that I have tried unsuccessfully to convert.
can anybody point out the error, it always shows red.bmp whether the two variables are equal or not, even if I ensure they are equal by presing the "B" key
snippet below:-
XML:
<Macro Name="Round2">d flr s0 - 100 * near 100 / l0 +</Macro>
<Element id="Element">
    <FloatPosition>600.000,14.000</FloatPosition>
    <Image id="green.bmp" Name="green.bmp">
        <Transparent>True</Transparent>
    </Image>
        </Element>

    <Element id="Element">
        <FloatPosition>600.000,14.000</FloatPosition>
        <Visibility>(A:Radio height, feet) 18000 &lt;</Visibility>
                <Select id="Select">
                    <Expression id="Expression">
                        %(A:SEA LEVEL PRESSURE, inHG) @Round2 (A:KOHLSMAN SETTING HG, inHG) @Round2 == if{ 1 } els{ 0 }
                    </Expression>
                    <Case id="Case1">
                        <ExpressionResult>1</ExpressionResult>
                        <Image id="green.bmp" Name="green.bmp">
                        <Transparent>True</Transparent>
                        <Bright>True</Bright>
                        <Luminous>True</Luminous>
                        </Image>
                     </Case>
                    <Case id="Case0">
                        <ExpressionResult>0</ExpressionResult>
                        <Image id="red.bmp" Name="red.bmp">
                        <Transparent>True</Transparent>
                        </Image>
                    </Case>
                </Select>
    </Element>
regards
 

Heretic

Resource contributor
Messages
6,830
Country
germany
That "%" should not be in the expression.

And that rounding macro for the value looks a bit overly complex to me.
I don't know what the format of the values for (A:SEA LEVEL PRESSURE, inHG) and (A:KOHLSMAN SETTING HG, inHG) is, but assuming that they're decimal separated, e.g. "29.92", an evaluation as simple as
Code:
(A:SEA LEVEL PRESSURE, inHG) (A:KOHLSMAN SETTING HG, inHG) - abs 0.01 &gt;=
should do the trick for the expression.
This will return "true" (1) when the difference between sea level pressure and kohlsman setting is greater than or equal to 0.01 ("abs" converts values into absolute, i.e. positive ones).
 

taguilo

Resource contributor
Messages
1,585
Country
argentina
Hi,

Macro definition is bad.

Use this in FSX schema:

Code:
        <Macro id="Round2" Name="Round2">
            <MacroValue>d flr s0 - 100 * near 100 / l0 +</MacroValue>
        </Macro>

Besides, as Bjoern stated, remove the % char in the element section

Tom
 
Messages
28
Country
unitedkingdom
Thanks for the quick responses guys but neither worked, I had previously tried
Code:
%(A:SEA LEVEL PRESSURE, inHG) (A:KOHLSMAN SETTING HG, inHG) - abs 0.01 &gt;=
as sugested by taguilo but had a % as above, now removed and also edited the macro to FSX schema and removed the % in my code.
I added a few lines to display both the Kohlsman and SEA LEVEL variables and the results are shown in the image.
Image3.jpg

Clicking the red warning light resets BAROMETRIC to be equal.Even when equal I get the red warning.
Is there a way to display the <ExpressionResult>
BrianB
 
Last edited:

Heretic

Resource contributor
Messages
6,830
Country
germany
Temporarily replace one of the other values in your display gauge with the evaluation or at least one of the pressure related variables to see the format returned.
 
Messages
28
Country
unitedkingdom
I have been trying multiple variations including changing to millibars instead of inHG in case that was the problem.
I have added an element to display the expression result. By changing &gt;= to &lt;= the result changes to 1 or 0
initially therefore the true or false is evaluating correctly BUT varying the Kohlsman setting manually has no effect on on the evaluation result. see image:-
comp.jpg

BrianB
 

JB3DG

Resource contributor
Messages
1,325
Country
southafrica
It could be off at a much lower value just the 1000th decimal
 
Messages
28
Country
unitedkingdom
It could be off at a much lower value just the 1000th decimal
It shouldn't be. pressing "B" key copies Sea Level To Kohlsman set.
But even when trying with rounding both to 2 dec places I am sure I got the same result but will check again.
Also the code is checking for 0.01 difference
Code:
<GaugeString>\{fnt1}\{clr2}EXP\{fnt}\{clr}%((A:SEA LEVEL PRESSURE, inHG) (A:KOHLSMAN SETTING HG, inHG) 0.01 &gt;=) %!1.4f!\{fnt1}\{fnt}</GaugeString>
BrianB
 

Roy Holmes

Resource contributor
Messages
1,803
Country
us-virginia
Your code is missing a minus after the second expression. As it stands it does nothing, nothing is evaluated before being compared to 0.01.
Roy
 
Messages
28
Country
unitedkingdom
OOPS! Mybad copy and paste to the post
Code:
<GaugeString>\{fnt1}\{clr2}EXP\{fnt}\{clr}%(((A:SEA LEVEL PRESSURE, inHG) (A:KOHLSMAN SETTING HG, inHG) - abs) 0.01 &gt;=) %!1.4f!\{fnt1}\{fnt}</GaugeString>
SAME output as post#8
BrianB
 

Heretic

Resource contributor
Messages
6,830
Country
germany
You do not need to wrap this in parenthesis.
Code:
((A:SEA LEVEL PRESSURE, inHG) (A:KOHLSMAN SETTING HG, inHG) - abs) 0.01 &gt;=
 
Messages
28
Country
unitedkingdom
Thanks all
Unless code is in as post #10 the "expression result" 'gaugestring' does not parse correctly and display 0.000 or 1.000.
in 'expression' itself for evaluation I do not have the additional parenthesis.
I have now isolated this from my original gauge into the mini test gauge below nd is included as an attachment.
kohlResult.jpg

(the 'K' button is the equiv of k/b 'B' to reset Barometric)
As before changing &gt; to &lt; changes the 'expressionresult' but varying the kohlsman set manually does not have any effect

Can one of you please install and try get it working then point out my error please
 

Attachments

  • Kohl.zip
    5.6 KB · Views: 143

Heretic

Resource contributor
Messages
6,830
Country
germany
You still have a bugged instance of the evaluation in line 80.

Maybe FSX doesn't like the units of sea level pressure. What happens if you use millibars for both variables?
 
Messages
28
Country
unitedkingdom
Thanks Heretic
The code to display the expression result correcty is
Code:
<GaugeString>\{fnt1}\{clr2}EXP RESULT\{fnt}\{clr}%((A:SEA LEVEL PRESSURE, inHG) (A:KOHLSMAN SETTING HG, inHG) - abs 0.005 &lt;=) %!1.3f!\{fnt1}\{fnt}</GaugeString>
This is working correctly now and changes from 0.000 to 1.000 on changing the the Kohlsman Set
The residual problem is the image flip from green to red bmps in the expession itself at line 41 it always stays at the initial result even with a pressure change
baro.zip attached gut down to the minimum. button resets the pressure
SEA LEVEL PRESSURE, inHG) (A:KOHLSMAN SETTING MB, Millibars) - abs 0.005 &gt;=
NoScriptTag.jpg

When encosed with tags red.bmp is shown
<Script>SEA LEVEL PRESSURE, inHG) (A:KOHLSMAN SETTING MB, Millibars) - abs 0.005 &gt;=</Script>
ScriptTag.jpg
 
Messages
28
Country
unitedkingdom
Thanks Heretic, all working
My mind was getting scrambled the number of times I cut and pasted areas of code.
Incidently it works if both are millibars as well
BrianB
 
Top