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.
10000 % int d 10 % r 10 / int d 10 % r 10 / int d 10 % r 10 / int 16 * + 16 * + 16 * +
115.50 100 *
10000 % int d 10 % r 10 / int d 10 % r 10 / int d 10 % r 10 / int 16 * + 16 * + 16 * +
(>K:NAV1_RADIO_SET)
(@c:NearestVorCurrentFrequency, Frequency BCD16) (>K:NAV1_RADIO_SET)
(L:Nav1Autotune, bool) if{
(A:PLANE LATITUDE, degrees) (>@c:NearestVorCurrentLatitude, degrees)
(A:PLANE LONGITUDE, degrees) (>@c:NearestVorCurrentLongitude, degrees)
100 (>@c:NearestVorMaximumItems, enum)
150 (>@c:NearestVorMaximumDistance, nmiles)
3 (>@c:NearestVorRemoveVorType)
(@c:NearestVorItemsNumber) 0 != if{
0 (>@c:NearestVorCurrentLine) (@c:NearestVorCurrentFrequency, Frequency BCD16) (>K:NAV1_RADIO_SET) 0 (>L:Nav1Autotune, bool)
} }
(L:ADFAutotune, bool) if{
(A:PLANE LATITUDE, degrees) (>@c:NearestNdbCurrentLatitude, degrees)
(A:PLANE LONGITUDE, degrees) (>@c:NearestNdbCurrentLongitude, degrees)
100 (>@c:NearestNdbMaximumItems, enum)
100 (>@c:NearestNdbMaximumDistance, nmiles)
(@c:NearestNdbItemsNumber) 0 != if{
(L:ADFindex,enum) (>@c:NearestNdbCurrentLine)
(@c:NearestNdbCurrentType, enum) 3 >= (@c:NearestNdbCurrentFrequency, khz) 0 > && if{
@SetADF((@c:NearestNdbCurrentFrequency, khz)) 0 (>L:ADFAutotune, bool) 0 (>L:ADFindex,enum)
} els{
(L:ADFindex,enum) ++ (@c:NearestNdbItemsNumber) min (>L:ADFindex,enum)
} } }
<Macro Name="SetADF">
(* UPDATE ADF FREQUENCY *)
[COLOR="Red"][B]@1 [/B][/COLOR]10000 * s0 10 %
s2 l0 10 / flr 10 % 16 * l2 +
s2 l0 100 / flr 10 % 256 * l2 +
s2 l0 1000 / flr 10 % 4096 * l2 +
s2 l0 10000 / flr 10 % 65536 * l2 +
s2 l0 100000 / flr 10 % 1048576 * l2 +
s2 l0 1000000 / flr 10 % 16777216 * l2 +
s2 l0 10000000 / flr 10 % 268435456 * l2 +
s2 (>K:ADF_COMPLETE_SET)
</Macro>
Code:(@c:NearestVorCurrentFrequency, Frequency BCD16) (>K:NAV1_RADIO_SET)
For ADF i'm doing it this way.
Code:(C:FS9GPS:NearestNdbCurrentFrequency,Frequency ADF BCD32) (>L:NavM_NDB_save,Frequency ADF BCD32)
Code:(L:NavM_NDB_save,Frequency ADF BCD32) (>K:ADF_COMPLETE_SET)
Edi
I honestly don't know what to say, Geoff. I've been using both as written in the Wiki for years without problems...A note about the @SetADF macro in the wiki. I could not get this to work until I added the @1 reference as shown in red (actually, I could not get the BCD one to work either but found the workaround above)... Is that an error in the wiki or me doing something wrong?
Wiki for both NAV and ADF @Macros now edited.The wiki is indeed bad, lacks the @1 parameter as geoffco noticed. This parameter is passed from the code in red :
@SetADF((L:ADF1 Frequency,Khz))
Anyway, the macro will work as it is written in the wiki if the script is like
(L:ADF1 Frequency,Khz) @SetADF((L:ADF1 Frequency,Khz))
The parameter is ignored, but the last stack's value is used instead.
(L:ADF1 Frequency,Khz) @SetADF
Actually, I note now that I have indeed been using the method above in past projects, where I call the @Macro after declaring the L:variable:
Code:(L:ADF1 Frequency,Khz) @SetADF
Yes, although it requires a couple of more lines of XML in FS9 than in later sims because the gps variable, FlightPlanWaypointFrequency, doesn't work in FS9.Can this be done with VOR's in FS9? I'm trying to at least get the next VOR frequency that is in a flightplan (*.pln) but so far to no avail.
<Update>
(C:fs9gps:FlightPlanActiveWaypoint) (>C:fs9gps:FlightPlanWaypointIndex)
(C:fs9gps:FlightPlanWaypointICAO) (>C:fs9gps:WaypointVorICAO)
</Update>
<Element Name="VOR IDENT AND FREQUENCY">
<Position X="5" Y="60"/>
<FormattedText X="90" Y="9" Font="courier new" FontSize="10" LineSpacing="10" Color="#101010" Bright="Yes">
<String>%((C:fs9gps:WaypointVorIdent))%!5s!% %((C:fs9gps:WaypointVorFrequency, MHz))%!7.3f!% MHz</String>
</FormattedText>
</Element>
If you want to get information about a flight plan waypoint, such as VOR frequency, then don't introduce Nearest Search vars like NearestVORCurrentLatitude. A Nearest search is quite a different thing.(A:GPS WP NEXT LAT, Radians) (>@c:NearestVORCurrentLatitude, Radians)
(A:GPS WP NEXT LON, Radians) (>@c:NearestVORCurrentLongitude, Radians)
There are some Flight Sim XML tutorials out there, but not a lot. Search "Tutorial" in this forum. I think Nick Pike's tuts at fs2X.com are the best I've seen, so take a look at those.how did one learn so much about the internals of FS and also, how to write xml with all its options?