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

gauge display priority

Messages
129
Country
us-indiana
Hello. I am trying to modify the FS9's default autopilot. The behavior works great but not the graphics. I have the following in one XML:

Gauge 1:
<Element><Select><Value>
(A:Autopilot Master,bool) (A:AUTOPILOT HEADING LOCK, bool) ! and (A:AUTOPILOT NAV1
LOCK, bool) ! and if{ 1 (>L:TurnBK_AP_HDG_LT_ON, bool) els{ 0 (>L:TurnBK_AP_HDG_LT_ON, bool) }
</Value></Select>
</Element>

<Element>
<Visible>(P:Absolute time,seconds) 1 % 0.5 1 * > (A:Autopilot Master,bool) 1 == and
(A:AUTOPILOT HEADING LOCK, bool) ! and (A:AUTOPILOT NAV1 LOCK, bool) ! and </Visible>
<Position X="86" Y="43"/>
<Image Name="Hdg_Alert.bmp" Bright="Yes"/>
</Element>

The (A:AUTOPILOT HEADING LOCK, bool) is turned off on purpose so I have can control:
(L:AileronControl, Degrees) (>K:AXIS_AILERONS_SET)

In a different gauge, the one that not completely working, I have:
Gauge 2:

<Element>
<Visible> (L:TurnBK_AP_HDG_LT_ON, bool) </Visible>
<Position X="0" Y="0"/>
<Image Name="AP_HDG_ON.bmp" Luminous="Yes" Bright="Yes"/>
</Element>

The panel.cfg:

[Window01]
Background_color=2,2,2
size_mm=156,308
position=8
visible=0
ident=RADIO_STACK_PANEL

gauge00=Bendix_King_Radio!Bendix-King Radio Audio, 0,0
gauge01=Bendix_King_Radio!Bendix-King Radio Nav-Comm 1, 0,29
gauge02=Bendix_King_Radio!Bendix-King Radio Nav-Comm 2, 0,86
gauge03=Bendix_King_Radio!Bendix-King Radio ADF, 0,142
gauge04=Bendix_King_Radio!Bendix-King Radio DME, 0,180
gauge05=Bendix_King_Radio!Bendix-King Radio Xpndr, 0,217
gauge06=Bendix_King_Radio!Bendix-King Radio AP, 0,262
gauge07=SS!BK_AP_HDG_LIGHT, 26,295,17,13

In Gauge 1, I have a heading alert .bmp flashing as indicator that the autopilot's heading is turned off. I attempted to apply
this same logic in Gauge 2 but to no avail.

In Gauge 2, the gauge displayed correctly if:
<Visible>1</Visible> but not when I added any kind of logic. I originally used FS's variables directly but
that didn't work either.

In the panel.cfg, I played around with draw_order_00 but that also made no difference. Since I'm turning off the
Autopilot's heading using: (>K:AP_HDG_HOLD_OFF) and (>K:AP_PANEL_HEADING_OFF), so I can control the ailerons, I still want
to show the autopilot's heading is ON in the Bendix King radio stack. Thank you for any help.
 
I'll take a look at your code once you've wrapped it in [code] [/code] tags.
 
Haven't looked in what the code does and if it's correct, but just an XML syntax tip:
​
Code:
[SIZE=4][FONT=Segoe UI][COLOR=rgb(20, 20, 20)]<Element>
 <Visible>
   (P:Absolute time,seconds) 1 % 0.5 1 * > (A:Autopilot Master,bool) 1 == and 
   (A:AUTOPILOT HEADING LOCK, bool) ! and (A:AUTOPILOT NAV1 LOCK, bool) ! and
 </Visible>
 <Position X="86" Y="43"/>
 <Image Name="Hdg_Alert.bmp" Bright="Yes"/>
 </Element>[/COLOR][/FONT]
[COLOR=rgb(20, 20, 20)]
[/COLOR]

Should be:
Code:
<Element>
 <Visible>
   (P:Absolute time,seconds) 1 % 0.5 1 * > (A:Autopilot Master,bool) 1 == and 
   (A:AUTOPILOT HEADING LOCK, bool) ! and (A:AUTOPILOT NAV1 LOCK, bool) ! and
 </Visible>
 <Position X="86" Y="43"/>
 <Element>
     <Image Name="Hdg_Alert.bmp" Bright="Yes"/>
 </Element>
 </Element>
[/SIZE]

The first works in FS9, but in FSX you need to add another nested Element if you use Visibility. Otherwise sometimes it works, sometimes not.
Rob
 
Hello. Thank you for your responses. You are correct that I use FS9. I haven't begun to start XML for FSX, it's too verbose for my typing skills and patience. Someone once mentioned that the FSX XML schema allows the code to be compiled but I haven't delved into that either. But I'm still confused me why it works in one gauge and not the other. It's my understanding that L:Vars are interconnected with other gauges. So if that's the case, then perhaps something is amiss with my panel.cfg setup. Speaking of XML, does it allow a variable to be used? Say:
<Position X="L:SomeVariable" Y="SomeOtherVariable" />. I tried various formats but couldn't get it to work. I was wondering if it was a syntax error not simply not possible. Again, thanks. Edit: BTW, has anyone ever used a one-shot in XML? I too tried various codes and no good. And is there a technique to store a variable in a more permanent way? In Programmable Logic Controllers, it has a one-shot instruction available. It looks like this:
B1 B0 B2
---| |--------------------------------------| / |------------------------( )-----------
|
| B0
------------( )-----------

They look like electrical contacts but are NOT. The are inspection instructions to look at the status of a bit (in this case). Again, thank you.
 
Last edited:
Someone once mentioned that the FSX XML schema allows the code to be compiled but I haven't delved into that either.

I think any XML schema can be "compiled" into .spb format, but it's a bit moot since it can alsmost as easily be decompiled.

Speaking of XML, does it allow a variable to be used? Say:
<Position X="L:SomeVariable" Y="SomeOtherVariable" />. I tried various formats but couldn't get it to work. I was wondering if it was a syntax error not simply not possible.

That's not possible, but you can use a macro for input. Macros are not shared across gauges.

(FS9 syntax)
Code:
<Macro Name="X_Pos">20</Macro>
<Macro Name="Y_Pos">50</Macro>

<Position X="@X_Pos" Y="@Y_Pos" />

I figure that macro values can also be pulled from L:vars, but that's for you to confirm.

BTW, has anyone ever used a one-shot in XML? I too tried various codes and no good. And is there a technique to store a variable in a more permanent way? In Programmable Logic Controllers, it has a one-shot instruction available. It looks like this:
B1 B0 B2
---| |--------------------------------------| / |------------------------( )-----------
|
| B0
------------( )-----------

They look like electrical contacts but are NOT. The are inspection instructions to look at the status of a bit (in this case). Again, thank you.

Fake variables, but you get the idea:
Code:
(A:Simvar1, bool) (L:Uservar1,number) == (L:LockVar1,bool) ! and
if{ [Do something]
1 (>L:LockVar1,bool) }

This will prevent setting the condition to "true" until LockVar1 is reset to zero. You'll need a code block like this to engage altitude hold for the current altitude.
 
Hello. 1) In the macro provided above, it still doesn't allow the <Position X and Y to be variable, as far as I can tell unless the "20" and "50" can be [a] variable(s). I'll try. Thanks. 2) I did try something like in the example in "Fake variable" and it didn't work because once 1 (>L:LockVar1,bool) then (L:LockVar1,bool) ! is no longer true (or equal to zero) which then affects if{ [Do something]. Also, why am I not able to see AP's heading light ON in the Gauge 2? I appreciate your time and insight. Thanks.
 
Last edited:
Have you checked that (L:TurnBK_AP_HDG_LT_ON, bool) is ever actually receiving the value of 1? If not, it will never light up.
 
Hello. 1) In the macro provided above, it still doesn't allow the <Position X and Y to be variable, as far as I can tell unless the "20" and "50" can be [a] variable(s). I'll try. Thanks. 2) I did try something like in the example in "Fake variable" and it didn't work because once 1 (>L:LockVar1,bool) then (L:LockVar1,bool) ! is no longer true (or equal to zero) which then affects if{ [Do something]. Also, why am I not able to see AP's heading light ON in the Gauge 2? I appreciate your time and insight. Thanks.

As I've said, wrap your code properly (you can still edit that post) and I'll take a look at it.


-E: Here's another example: https://www.fsdeveloper.com/forum/threads/jet-engine-fan-animation.441961/#post-791228
 
Have you checked that (L:TurnBK_AP_HDG_LT_ON, bool) is ever actually receiving the value of 1? If not, it will never light up.
Very good point, and a gauge de-bugger app like Blackbox, or Doug Dawson's xml vars will greatly help see things like that. Tom Aguilo's LocalVars (part of XMLTools) is out there too, but, AFAIK, LocalVars isn't functional in FS9.

Fly, is Gauge 2 in a separate folder from Gauge 1? If yes, then your .bmp image needs to be in both folders.

In the macro provided above, it still doesn't allow the <Position X and Y to be variable, as far as I can tell unless the "20" and "50" can be [a] variable(s). I'll try. Thanks.

You cannot use a variable inside the quotes for Position X, Y, or a macro that is a variable. Same thing for <Size X="750" Y="542" />, or the Left, Top, Width, Height in <Area Name="ZOOM IN" Left="445" Top="6" Width="35" Height="13".

Since you mentioned Position, if it turns out you want to dynamically move objects like text, polygons, polylines, .bmps around in a 2D gauge, then Shift may be used. Read through this thread and study the xml for more info.

I did try something like in the example in "Fake variable" and it didn't work because once 1 (>L:LockVar1,bool) then (L:LockVar1,bool) ! is no longer true (or equal to zero) which then affects if{ [Do something].

By one-shot, do you mean something that happens for one gauge update cycle only? If yes, then I think Bjoern has an answer for you in #5. Another example is a typical initiation sequence:

Code:
<Update>
    (L:InitSequence, bool) 0 ==
        if{
            13 (>L:ZCase, enum)                                           
            1 (>L:TERRLayer, bool)
            270 (>@c:GeoCalcAzimuth1, degrees)
            .
            .
            . whatever
            1 (>L:InitSequence, bool)
        }     
</Update>

Because all L:Vars are zero value when a gauge loads, the InitSequence will run the first gauge update cycle only. Another example of a one cycle only action is a simple mouse click. Script included within the <Click> ... </Click> tags executes one time only unless you specify something like <Click Repeat="Yes">

Lastly, I agree with Bjoern that you really must place your code examples in CODE tags. Take a look at the icon bar at the top when you're typing a forum posting or reply. Play around with it and you'll find what we're talking about.

Bob
 
You are correct, I am trying to dynamically move objects - what I'd had hope was an easy way. Too bad that it couldn't be done as wished :). Thanks about the initiation sequence! But I did try something like that and couldn't get it to take, will re-try though. And I prefer not to use any mouse clicks as I'm trying to get the XML do it - otherwise I could just click on the radio stack, AP panel or MCP, etc. Will do on the code /code. Again, thanks for the help!
 
Last edited:
As I've said, you can try to put an L: var into the macro and see if it works.

Code:
<Macro Name="X_Pos">20</Macro>
<Macro Name="Y_Pos">(L:Element Y position, number)</Macro>

<Position X="@X_Pos" Y="@Y_Pos"/>

Other than that, there's also <Shift> objects to shift something along an axis, but they're a bit tricky to set up.
 
Back
Top