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

FS2004 nearest search

Messages
58
Country
netherlands
Hi,

Revisiting the "nearest pages" in my FMC i encountered a nasty fenomenon:
It doesn't work anymore; the gps-500 also refuses to do his/her job.
This happens:
Opening the page: no display.
Pause 5-10 seconds: the correct display.
Unpause: no update.
Reload: everything lost.
Pause etc..

What can be a cause??
This is the code:
Code:
<Element>
<Select>
<Value>

(L:Nearest airport test reset,bool) !
if{
1 (>L:Nearest airport loop,bool)
-1 (>L:Nearest airport index,enum)
0 (>L:Nearest airport counter,enum)
10 (>L:Nearest airport cycles,enum)

1 (>L:Nearest airport test reset,bool)
}

8 (>@c:NearestAirportMaximumItems)
100 (>@c:NearestAirportMaximumDistance,NMiles)

(A:PLANE LATITUDE,degrees) (>@c:NearestAirportCurrentLatitude,degrees)
(A:PLANE LONGITUDE,degrees) (>@c:NearestAirportCurrentLongitude,degrees)

(L:Nearest airport counter,enum) 1 + (>L:Nearest airport counter,enum)
(L:Nearest airport counter,enum) (L:Nearest airport cycles,enum) &gt;
if{

(L:Nearest airport loop,bool)
if{

(L:Nearest airport index,enum) 1 + (>L:Nearest airport index,enum)
(L:Nearest airport index,enum) (>@c:NearestAirportCurrentLine)

(@c:NearestAirportItemsNumber) 8 ==
if{
0 (>L:Nearest airport loop,bool)
}

}

}

</Value>
</Select>
</Element>

and this the display:

Code:
<Element>
<Visible>(@c:NearestAirportItemsNumber) 0 &gt;</Visible>
<FormattedText X="265" Y="230" Bright="Yes" Font="arial" FontSize="14" Color="@color" LineSpacing="15" Tabs="15,25L,125R,140C,205R,265R" Adjust="left" VerticalAdjust="center">
<Font FontSize="15"/>
<Font FontSize="12"/>
<String>

\{lsp=50}

%((@c:NearestAirportItemsNumber) s2 0 !=)%{if}
%(0 sp1)
%{loop}%(l1 (>@c:NearestAirportCurrentLine))

%((@c:NearestAirportCurrentIdent))%!s!
\t%((@c:NearestAirportCurrentTrueBearing,degrees) (A:GPS MAGVAR,degrees) - d360)%!03d! &#xB0;\{fnt2}M\{fnt}
\t
\t%((@c:NearestAirportCurrentDistance,nmiles))%!.1f! \{fnt2}NM\{fnt}
\t%((@c:NearestAirportCurrentDistance,nmiles) (A:GPS GROUND SPEED,knots) / 60 * flr 60 %)%!02d!:%((@c:NearestAirportCurrentDistance,nmiles) (A:GPS GROUND SPEED,knots) / 3600 * flr 60 %)%!02d!
\n

%(l1 ++ s1 l2 &lt; d)%{if}%{end}\n%{next}%{end}


</String>
</FormattedText>
<Clip Top="50" Bottom="170" />
</Element>

Thanks
 
Hi Jan,

This is a head scratcher - what Pausing has to do with it. But please help me to understand, what is the purpose of the first section of script? Is it correct that the objective is to display NearestAirport distance and bearing, ETE info? If so, why is the first section necessary? Just stating NearestAirportCurrentLongitude and Latitude, NearestAirportMaximumItems, and NearestAirportMaximumDistance kicks off the nearest search.

Your display Element is also complicated to me. Is the following workable?

Code:
<String>
    %((@c:NearestAirportItemsNumber) s2 0 !=)
        %{if}
            %(0 sp1)
            %{loop}
                %(l1 (>@c:NearestAirportCurrentLine))
                    %((@c:NearestAirportCurrentIdent))%!s!
                    \t%((@c:NearestAirportCurrentTrueBearing,degrees) (A:GPS MAGVAR,degrees) - d360)%!03d! &#xB0;\{fnt2}M\{fnt}
                    \t
                    \t%((@c:NearestAirportCurrentDistance,nmiles))%!.1f! \{fnt2}NM\{fnt}
                    \t%((@c:NearestAirportCurrentDistance,nmiles) (A:GPS GROUND SPEED,knots) / 60 * flr 60 %)%!02d!:%((@c:NearestAirportCurrentDistance,nmiles) (A:GPS GROUND SPEED,knots) / 3600 * flr 60 %)%!02d!
                    \n
                %(l1 ++ s1 l2 &lt;)
            %{next}
        %{end}
</String>

Anyway, I hesitate to respond because I know you are an expert with the gps, so I may be missing something.

BTW, I guess !.1f! is valid? I was under the mistaken impression that XML always wanted the leading integer, like !0.1f! (but I have to think about that one some more :scratchch) so I learn something every day.

Bob
 
Last edited:
Same to to me!!
My code is similar to yours or Bob's! Standardprogramingroutine!!
And a least 4 years old.
And since a few months i also have a very long update time!!

It's FS2004!

Bob, you are using FSX??

Edi
 
OK Bob,

This is code from the "middle ages" and worked ok in those years...

How should you write it?
I mean the <update> , in my fmc a lot of code!!, and display sections.

NB1. No problems with nearest airspace search, only apt, isec, vor and ndb.

NB2. go to MPTO in a few days to visit my children.
 
Edi - I use both FS9 and FSX and in both cases, utilize FS9 XML format. The gps modules in both sims behave the same except for the additional variables that are included in FSX (mostly, more Nearest variables which reduce the need for ICAO transfers - a useful upgrade in FSX).

Jan - the following 4 lines will initiate a NearestAirport search which will pull the 8 nearest airports out of the database. Other than a conditional statement that permits these lines to be executed only when you want, nothing more needed. Likely, it will be in your Update section.

Code:
8 (>@c:NearestAirportMaximumItems)
100 (>@c:NearestAirportMaximumDistance,NMiles)
(A:PLANE LATITUDE,degrees) (>@c:NearestAirportCurrentLatitude,degrees)
(A:PLANE LONGITUDE,degrees) (>@c:NearestAirportCurrentLongitude,degrees)

The database extraction will take several gauge update cycles to complete, but the display Element will sit there waiting until there are data to display. %((@c:NearestAirportItemsNumber) s2 0 !=) does this. It checks that data have been returned before allowing the loop to proceed, displaying the airport information you want to display, one airport at a time.

What is &#xB0; ? Is it the degree symbol? So, equivalent to \{dplo=M} escape?

Once again, apologies for 'preaching to the choir'. Actually, I have no idea what's behind the Pause thing.

Bob
 
Bob,

Found the solution:
Code in use is ok and works flawless in the 767.
Took over almost all code to a new project: 787 (all big MFD's have gps code for flightplan etc.)
This is what happens:

767: Starting the 767 everything is ok, but the first screen, panel, doesn't contain gps code.
Second act is, almost always, opening the fmc and no problems whatsoever (code loaded)

787: The first screen of the 787 contains ND's with gps code and functions ok, but after opening the fmc the nearest search functions, except airspace, are lost.

Now, empirically, with outcomenting gauges with gps code, i found out, when the fmc was loaded first, all was ok and even with speed 16x, and > 5 gauges with gps code open, the nearest search and update work as expected.

So, It seems that when using multiple gauges with gps code, load the fmc first!
What pause does?, don't know, but a "reload panel" results in malfunction, because the then open mfd's are consuming something, which inhibits the nearest search.
The solution in this situation is to "reload" only in a panel vieuw without gauges containing gps code.
 

Attachments

  • 787 nearest arpt search.jpg
    787 nearest arpt search.jpg
    313.3 KB · Views: 514
Last edited:
Back
Top