• 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 Next Hurdle - Squawk Ident

Messages
278
Country
ca-britishcolumbia
Moving along with my Nav Radar guage and hit another stumbling block. Find working with code enjoyable, but a headache as well.

So the problem, which has me completly baffled. Dave Wave has created a squawk ident feature in the FSX ATC Radar, which works amazingly well. You hit the button and on the ATC Radar turns red for easy identification.

The Squawk Ident Code:
Code:
<?xml version="1.0" encoding="UTF-8"?>

<SimBase.Document
        Type="AceXML"
        version="1,0"
        id="xponder">
    <Descr>AceXML Document</Descr>
    <Filename>Ident.xml</Filename>
    <SimGauge.Gauge id="Gauge" ArtDirectory="C:\Documents and Settings\DaveHirst\Desktop\Xponder">
        <FloatPosition>0.000,0.000</FloatPosition>
        <Size>15,15</Size>
        <Element id="Element">
            <FloatPosition>0.000,0.000</FloatPosition>
            <Circle id="Circle">
                <Bright>True</Bright>
                <Radius>7</Radius>
                <FillColorScript>@IdentColour</FillColorScript>
                <LineWidth>2</LineWidth>
                <LineColor>0x444444</LineColor>
            </Circle>
        </Element>
        <MouseArea id="MouseArea">
            <FloatPosition>0.000,0.000</FloatPosition>
            <Size>14,14</Size>
            <MouseArea id="Ident">
                <FloatPosition>0.000,0.000</FloatPosition>
                <Size>14,14</Size>
                <CursorType>Hand</CursorType>
                <MouseClick id="MouseClick">
                    <Script>(L:IdentPushed) 0 &gt; if{ quit }
(A:TRANSPONDER CODE:1,BCO16) (&gt;L:TempSquawk,BCO16)
0 (&gt;K:XPNDR_SET) 
1 (&gt;L:IdentPushed)</Script>
                </MouseClick>
            </MouseArea>
        </MouseArea>
        <Update id="Update">
            <Frequency>1</Frequency>
            <Script>(L:LocalSquawk,BCO16) (A:TRANSPONDER CODE:1,BCO16) != if{
	 (A:TRANSPONDER CODE:1,BCO16) (&gt;K:XPNDR_SET) 
	(A:TRANSPONDER CODE:1,BCO16) (&gt;L:LocalSquawk,BCO16) }
(L:IdentPushed,number) 0 &gt; if{ (L:IdentPushed) ++ (&gt;L:IdentPushed) }
(L:IdentPushed,number) 5 &gt; if{ 0 (&gt;L:IdentPushed)  (L:TempSquawk,BCO16) (&gt;K:XPNDR_SET) }

 </Script>
        </Update>
        <Macro id="IdentColour" Name="IdentColour">
            <MacroValue>(L:IdentPushed) 0 == if{ 0xff3333 } els{ 0x0000ff }</MacroValue>
        </Macro>
        <Comment id="Comment">
            <Value>Any comments please email me at Davethewave2@hotmail.co.uk</Value>
        </Comment>
    </SimGauge.Gauge>
</SimBase.Document>

This attaches to your radio stack so you can ident when required at the press of a button. Alternatly you can squawk 0000 for the same effect.

This is the update from the modified section of the ATC session info XML:

The original update (located at the top) still intack in both guage files
Code:
<Update id="Update">
<Script>(L:SessionInfoInit) 0 == 
(L:Filter) 0 == and if{
25 (&gt;L:Filter)
1 (&gt;L:SessionInfoInit)
}
(L:ListFirstVis) (C:ITrafficInfo:ListSize) min (&gt;L:ListFirstVis)
(C:ITrafficInfo:SelectedVehicleID) (&gt;L:SelectedVehicle)
1607 3000 * (&gt;C:ITrafficInfo:Radius) (* 3000 miles *)</Script>
</Update>

The add-on update (located at the bottom) in same XML:

Code:
<Update id="SquawkIdent">
<Script>quit
0 (&gt;C:ITrafficInfo:Filter)
(C:ITrafficInfo:ListSize) (&gt;G:Var1)
(G:Var1) 0 == if{ quit }
(G:Var1) -- (&gt;G:Var1)
:1 
(G:Var1) (&gt;C:ITrafficInfo:CurrentVehicle) 
(G:Var1) (&gt;C:ITrafficInfo:SelectedVehicle) 
(C:ITrafficInfo:S:TRANSPONDER CODE, number) 0 == if{ (C:ITrafficInfo:SelectedVehicleID) (&gt;C:fs9gps:1:SelectedVehicle) } 
(G:Var1) -- (&gt;G:Var1)
(G:Var1) -1 == if{ quit }	
g1</Script>
</Update>

Talking with Dave Wave, he stated in order to have my guage read the squawk ident i need to:

Code:
Squawk ident, either with pilot assistant or the add in to the com stack, works be setting the transponder to 0000 for 5 seconds.
 
Just code your gauge to detect that and that’s it. 
 
Dave

This is what i came up with, but dont know how to have it activiate the macro (if i need to) and unsure if the code even is sound.

Code:
<Macro id="TARGETIDENT" Name="TARGETIDENT">
<MacroValue>(C:ITrafficInfo:C:TRANSPONDER CODE, number) 0 == 
if{ (C:ITrafficInfo:SelectedVehicle) (&gt;G:Var1) (C:ITrafficInfo:CurrentVehicle) 
(&gt;C:ITrafficInfo:SelectedVehicle) (C:ITrafficInfo:SelectedVehicleID) 
(&gt;C:fs9gps:1:SelectedVehicle) (G:Var1) (&gt;C:ITrafficInfo:SelectedVehicle)   } )</MacroValue>
</Macro>

Any help and advice is alway appreaciated. Thanks you all in advance.

Greg
 

Attachments

Your XML schema shows that you're working for FSX. I've never managed to get the ITrafficInfo.dll to work in FSX.
 
Thanks Bill

A quick question?

Do I need to create an element section to enable a macro, or does the guage automatically enable them?

My newbie and inexperience is glowing with this.

thanks Greg
 
Do I need to create an element section to enable a macro, or does the guage automatically enable them?

The gauge automatically recognizes the macro as long as it is defined in the gauge code. As I'm sure you have seen, most macro definitions are listed at the top of the code body.

Macros are just literal code substitutions (shorthand is another way to think of it) that are used to replace code strings that might be somewhat long and used repetitively in your gauge with a simple macro name. Every place you use the @macro in the code body, FS will substitute the code used to define the macro. All this is done automatically when the gauge loads, and there is nothing additional you need to do to activate the macro.

Bob
 
Thanks to you both

Thanks for the insight. At first I thought this was going to be a simple case of taking existing code combining it to create the gauge with the functions i like. Well lets just say I should of know better. I'm going to start a new thread outlining what intend to do.

Thanks again
Greg
 
Back
Top