• 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 Operation for gauge string

Messages
45
Country
brazil
Hi everone.

I need to create this operation for a gauge xml string:

(A) - (B) = 500

Or be, if (variable A) minus (variable B) is equal 500, my gauge returns true.

I tryed to follow the SDK example, but doesn´t work: (A) (B) - 500 ==

What is the correct way to write?

Thanks
 
You're pretty close .....

Code:
(L:VarA, number) (L:VarB, number) -  500  ==  if{  do something  }
 
Last edited:
Good...

I want to do it:

When the result is true, it return "1", and a light signal will show in the gauge, if false, it return "0" the light signal will not.

The 02 lights signal are represented for 02 bitmaps.

If "1" - SignLight_on.bmp
If "0" - SignLight_off.bmp

In this case, the string would be:

(L:VarA, number) (L:VarB, number) - 500 == if{ 1 }

It´s ok?
 
When the result is true, it return "1", and a light signal will show in the gauge, if false, it return "0" the light signal will not.

The 02 lights signal are represented for 02 bitmaps.

If "1" - SignLight_on.bmp
If "0" - SignLight_off.bmp

In this case, the string would be:

(L:VarA, number) (L:VarB, number) - 500 == if{ 1 }

It´s ok?
Not really. You do not need the if{ do something } in this case. The entire statement will either evaluate to 0 or 1 (false or true).

Code:
  <Element>
    <Position X="71" Y="77"/>
    <Select>
      <Value>
        (L:VarA, number) (L:VarB, number) -  500  ==
      </Value>
      <Case Value="0">
        <Image Name="SignLight_on.bmp" Bright="Yes"/>
      </Case>
      <Case Value="1">
        <Image Name="SignLight_off.bmp" Bright="Yes"/>
      </Case>
    </Select>
  </Element>
 
Last edited:
Bill

I followed your example, but it doesn´t work.

Here is the code:

Code:
 <Element id="Sign Light">
            <FloatPosition>0.000,0.000</FloatPosition>
            <Select id="Select">
                <Expression id="Expression">
                    <Minimum>0.000</Minimum>
                    <Maximum>1.000</Maximum>
                    <Script>(A:Autopilot altitude lock var, feet) (A:Indicated Altitude, feet) - 475 ==</Script>
                </Expression>
                <Case id="Case">
                    <ExpressionResult>0.000</ExpressionResult>
                    <Image id="Signlight_off.bmp" Name="Signlight_off.bmp">
                        <Transparent>True</Transparent>
                    </Image>
                </Case>
                <Case id="Case">
                    <ExpressionResult>1.000</ExpressionResult>
                    <Image id="Signlight_on.bmp" Name="Signlight_on.bmp">
                        <Transparent>True</Transparent>
                    </Image>
                </Case>
            </Select>
        </Element>
 
The variables you are using will never allow the expression to precisely match the 475 target value.

You will really need to test for a "range" between -say- 474 and 476 in order to trigger your desired result.
 
Ok Bill, I undestand the problem.

Well, in this case, should I changing the value until the expression works?

Is there a expression that works with range of values?

ex: expression return "1" if (A) - (B) = any value beetwen 474 and 476
 
This:

(L:VarA, number) (L:VarB, number) - 474 476 rng ==
 
Actually should be

Code:
474 476 (L:VarA, number) (L:VarB, number) - rng

Tom
 
Thanks, Tom. I don't use rng often enough to remember the exact sequence... :o
 
Hello guys.

I want to use the string above to play one sound in the cockpit when the result of string is true.
I going to use the dsd_fsx_xml_sound gauge to plays the sound and I already ajusted this for my sound.
I need to know how and where I do it.
I created a xml gauge that use the same string to change between bmp files. I want to do this gauge sends information for other gauge (dsd_gauge) plays the sound.

Thanks
 
Just add the dsd code - something like 02 (&gt;L:dsd_xml_sound_id, number) - yours will be different - to the code that switches the BMP files. Then each time the BMP files switch, the sound will be played too.

Hope this helps,
 
Hello Tom.

Look this code:

Would be this?

Code:
<Element>
    <Position X="71" Y="77"/>
    <Select>
      <Value>
        474 476 (L:VarA, number) (L:VarB, number) -  rng 1 (>L:dsd_xml_sound_id, number)
      </Value>
      <Case Value="0">
        <Image Name="SignLight_on.bmp" Bright="Yes"/>
      </Case>
      <Case Value="1">
        <Image Name="SignLight_off.bmp" Bright="Yes"/>
      </Case>
    </Select>
  </Element>
 
Unfortunately, using that format you can't do that. Just create another element instead, or put the code into an Update section.

Code:
<Element>
    <Position X="71" Y="77"/>
    <Select>
      <Value>
        474 476 (L:VarA, number) (L:VarB, number) -  rng  if{ 1 (>L:dsd_xml_sound_id, number) }
      </Value>
    </Select>
  </Element>

Note that you might have to add more code so the sound only plays once. Add an L: variable, something like this:

Code:
<Element>
    <Position X="71" Y="77"/>
    <Select>
      <Value>
        474 476 (L:VarA, number) (L:VarB, number) -  rng  (L:SoundPlayed, bool) ! &amp;&amp; if{ 1 (>L:dsd_xml_sound_id, number)  1 (>L:SoundPlayed, bool) }
      </Value>
    </Select>
  </Element>

Then you will need more code in the gauge to detect when the difference between VarA and VarB is no longer within 474 to 476 and the SoundPlayed variable is still set to 1 and reset the SoundPlayed variable to 0, ready to play the sound when the difference is back within that range.

Hope this helps,
 
Thanks Tom.

I will try the code and report the result here.

When I put "1" into L:dsd_xml_sound_id, number, it plays the sound once and return for "0". This is a feature of the dsd gauge.
 
Back
Top