Archived

This topic is now archived and is closed to further replies.

Engjell Berisha

FS9 XML FS9GPS.dll

Recommended Posts

I'm trying to set a destination as a direct to if I have no flightplan loaded, I can't understand why the following code doesn't work - but then again I've never done much with the gps module. :(

 (@c:FlightPlanIsActiveFlightPlan) 0 ==  if{ (L:FMC-RTE-DEST-1,number) 64 > (L:FMC-RTE-DEST-4,number) 64 > (L:FMC-RTE-DEST,bool) 0 == and and if{  1 (>C:fs9gps:IcaoSearchStartCursor) (L:FMC-RTE-DEST-1,number) (>C:fs9gps:IcaoSearchEnterChar) (C:fs9gps:IcaoSearchCursorPosition) 1 + (>C:fs9gps:IcaoSearchCursorPosition) (L:FMC-RTE-DEST-2,number) (>C:fs9gps:IcaoSearchEnterChar) (C:fs9gps:IcaoSearchCursorPosition) 1 + (>C:fs9gps:IcaoSearchCursorPosition) (L:FMC-RTE-DEST-3,number) (>C:fs9gps:IcaoSearchEnterChar) (C:fs9gps:IcaoSearchCursorPosition) 1 + (>C:fs9gps:IcaoSearchCursorPosition) (L:FMC-RTE-DEST-4,number) (>C:fs9gps:IcaoSearchEnterChar)  1 (>C:fs9gps:IcaoSearchStopCursor)  1 (>@c:FlightPlanDirectToDestination)  1 (>L:FMC-RTE-DEST,bool) } } 

Any help would be appreciated.Engjell BerishaGood Day!

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

 (@c:FlightPlanIsActiveFlightPlan) 0 ==  if{ (L:FMC-RTE-DEST-1,number) 64 > (L:FMC-RTE-DEST-4,number) 64 > and if{ 1 (>@c:IcaoSearchStartCursor) (L:FMC-RTE-DEST-1,number) chr (>@c:IcaoSearchEnterChar) (L:FMC-RTE-DEST-2,number) chr (>@c:IcaoSearchEnterChar) (L:FMC-RTE-DEST-3,number) chr (>@c:IcaoSearchEnterChar) (L:FMC-RTE-DEST-4,number) chr (>@c:IcaoSearchEnterChar)  1 (>@c:IcaoSearchStopCursor) (@c:IcaoSearchCurrentIcao) (>@c:FacilityICAO) (@c:FacilityICAO) (>@c:FlightPlanNewWaypointICAO)  1 (>@c:FlightPlanDirectToDestination) } } 

Revised the code a little, I've been looking at many examples and what not but I can't seem to make any progress.I noticed that when I tried to retrieve nearestairportcurrenticao I couldn't get anything to show, I'm not quite sure what that means?I'm really hoping someone is willing to help me with this.

Share this post


Link to post
Share on other sites

Engjell, Maybe give this a try. It is only good for airports , NO nav,adf,rporting points etc... There could be some more checks for multiples and such but this basis code works and is tested to the point of being a valid GPS usable waypoint. When you hit the "enter" button start this code set.

'A' (>C:fs9gps:IcaoSearchStartCursor)31 (>C:fs9gps:enteringInput)(L:FMC-RTE-DEST-1,number) chr (L:FMC-RTE-DEST-2,number) chr scat (L:FMC-RTE-DEST-3,number) chr scat (L:FMC-RTE-DEST-4,number) chr scat (>C:fs9gps:IcaoSearchEnterChar)<!-- THIS DOES NOT CHECK FOR MULTIPLE AIRPORTS! -->(C:fs9gps:IcaoSearchMatchedIcaosNumber) 1 == if{ (C:fs9gps:IcaoSearchCurrentIcao) (>C:fs9gps:WaypointAirportICAO) }<!-- UNKNOWN from this point, but you have a usable airport ICAO to send to "DIRECT TO" -->(C:fs9gps:WaypointAirportICAO) (>C:fs9gps:FlightPlanNewWaypointICAO)<!-- ONLY 1 of the next 3 may/may not work  -->1 (>C:fs9gps:FlightPlanIsDirectTo)<!-- OR -->1 (>C:fs9gps:FlightPlanIsActiveWaypoint)<!-- OR -->1 (>C:fs9gps:FlightPlanDirectToDestination)

To see if this works for the initial airport find, use a string to display the airport name. (C:fs9gps:WaypointAirportName) within the same gauge as the code.This will not show up on the stock GPS as these codes run asynchronous, will just have to test by flying the route with GPS drives NAV1.Hope this may help,Roman

Share this post


Link to post
Share on other sites

Hey Roman Thanks a lot, you got me on the right path. I can set all the parameters it seems and I've only got one small problem it seems.Here's the code I've been using:

 (@c:FlightPlanIsActiveFlightPlan) 0 == if{ (L:FMC-RTE-DEST-1,number) 64 > (L:FMC-RTE-DEST-4,number) 64 > and if{ 'A' (>@c:IcaoSearchStartCursor)  31 (>@c:enteringInput)  (L:FMC-RTE-DEST-1,number) chr (L:FMC-RTE-DEST-2,number) chr (L:FMC-RTE-DEST-3,number) chr  (L:FMC-RTE-DEST-4,number) chr scat scat scat (>@c:IcaoSearchEnterChar)  (@c:IcaoSearchMatchedIcaosNumber) 1 == if{ (@c:IcaoSearchCurrentIcao) (>@c:WaypointAirportICAO) (@c:IcaoSearchCurrentIcao) (>@c:FacilityICAO) (@c:FacilityICAO) (>@c:FlightPlanNewWaypointICAO) 1 (>@c:FlightPlanDirectToDestination) @EscapeMenu quit } } } 

The problem is in the last bit of code, the FlightPlanNewWaypointICAO will not set for whatever reason - I use FlightPlanWaypointICAO to see, is this the right variable?The first few times I tried this the Sim crash because everything would set but as soon as the gauge would try and set 1 (>@c:FlightPlanDirectToDestination) the sim would crash giving an error report for panels.dll. I would assume this is because I have no FlightPlanWaypointICAO set to activate a flight plan? So I would omit that piece of code, I added the @EscapeMenu quit piece hoping that would solve the crashing but no avail - I'd seen it in a few gauges.I tried setting flightplanisdirectto but that would not set either, nor would FlightPlanIsActiveWaypoint - I suppose since there was no active waypoint.What I don't understand is why FlightPlanNewWaypointICAO when facilityicao is set and waypointairporticao sets to currenticao, etc..I'm curious as to what enteringinput is? I've seen it used everywhere, but I can not find a single bit of reference from microsoft as to what it is? Also I wonder why I have to start the cursor with 'A'? When I do this it seems to stay there, forever the display would show "A ICAO" the icao being the set ICAO from my variables, maybe I should added a stop cursor afterwards?Thanks for the help so far, it's much appreciated.

Share this post


Link to post
Share on other sites

Engjell, You wrote -- "The problem is in the last bit of code, the FlightPlanNewWaypointICAO will not set for whatever reason - I use FlightPlanWaypointICAO to see, is this the right variable?" This thread http://forums1.avsim.net/index.php?showtopic=268961 may have an answer(s) for maybe all the problems. See Post #5 in the code box I have put a comment. <!-- THESE UPDATES ARE REQUIRED SINCE THE GPS NEEDS 1 CYCLE AFTER ICAO-->WAYPOINT TRANSFER BEFORE ABLE TO ACCESS WAYPOINT DATA -->I have noticed, but not proven why, failure to wait the 1 cycle results in code that just doesn't work. See post #10 on a possible theory on how 31/131 enteringinput works.. Bob (RPMC) had a attachment that dissapeared which just may prove this, good info too. attachment=11441:example_format.jpg in post #1 (PM him for a replacement?)See post #11 for a tool that may help. Tried but my Excel installation is pooched, VB doesn't work.. ( I have to fix that some day :-) )You wrote-- "When I do this it seems to stay there, forever the display would show "A ICAO" the icao being the set ICAO from my variables, maybe I should added a stop cursor afterwards?"Ar you using (C:fs9gps:WaypointAirportName) to display(just for testing)? or something that has ICAO as a suffix for the GPS variable? Maybe use FlightPlanWaypointIdent or something similar w/Ident suffix that fits for your display. That previously mentioned attachment .jpg may show why. IIRC an ICAO suffix sends/reads some/all (depending on when, or how, read) the relevant information about the waypoint (Type, Region, Ident, Name etc...) so it can be processed the core GPS database ??Just some ideas for now, HIH,Roman

Share this post


Link to post
Share on other sites

Roman,I should've mentioned I suppose that the code I'm showing you is all wrapped in update - it was just a massive bit that wou'dve been annoying to show. Shouldn't that suffice as for cycles?

%ICAO %((@c:IcaoSearchCurrentIcao))%!s!\t\t\t%WPAP %((@c:WaypointAirportICAO))%!s!\n%FACT %((@c:FacilityICAO))%!s!\t\t%FPWP %((@c:FlightPlanWaypointICAO))%!s!

The above code is what I use to see what's happening with the gps variables. Now for everything but FlightPlanWaypointICAO I get a return of "A PHNL" (lets just say I typed in PHNL as my DEST ARPT). FlightPlanWaypointicao returns nothing, if I am to load a flight plan it works then.I'm disappointed in the search function of the forum! I've tried for months to find something relevant to fs9gps.dll to help me understand some things. That topic was wonderful, thank you.Once again thanks.

Share this post


Link to post
Share on other sites
Roman,I should've mentioned I suppose that the code I'm showing you is all wrapped in update - it was just a massive bit that wou'dve been annoying to show. Shouldn't that suffice as for cycles?
%ICAO %((@c:IcaoSearchCurrentIcao))%!s!\t\t\t%WPAP %((@c:WaypointAirportICAO))%!s!\n%FACT %((@c:FacilityICAO))%!s!\t\t%FPWP %((@c:FlightPlanWaypointICAO))%!s!

The above code is what I use to see what's happening with the gps variables. Now for everything but FlightPlanWaypointICAO I get a return of "A PHNL" (lets just say I typed in PHNL as my DEST ARPT). FlightPlanWaypointicao returns nothing, if I am to load a flight plan it works then.I'm disappointed in the search function of the forum! I've tried for months to find something relevant to fs9gps.dll to help me understand some things. That topic was wonderful, thank you.Once again thanks.

By Civa INS you can go straight to destination airport.www.simufly.com/insGianfranco

Share this post


Link to post
Share on other sites
By Civa INS you can go straight to destination airport.www.simufly.com/insGianfranco
What is the point of your reply? It has no bearing on the discussion whatsoever... :(

Share this post


Link to post
Share on other sites
What is the point of your reply? It has no bearing on the discussion whatsoever... :(
The poster declared:"I'm trying to set a destination as a direct to if I have no flightplan loaded".Having the Civa INS installed this is not a problem.Gianfranco

Share this post


Link to post
Share on other sites
The poster declared:"I'm trying to set a destination as a direct to if I have no flightplan loaded".Having the Civa INS installed this is not a problem.Gianfranco
I don't think they were asking for your product.

Share this post


Link to post
Share on other sites
The poster declared:"I'm trying to set a destination as a direct to if I have no flightplan loaded".Having the Civa INS installed this is not a problem.Gianfranco
Yes, and with the posting of sample XML script it was pretty obvious that he's trying to write his own gauge... :(

Share this post


Link to post
Share on other sites

Engjell, Did you have any luck? I did, needed to learn a bit about the FlightPlan functions in the GPS anyway for a future project. Here's a stripped down version of what i wrote for DirectTo without an active FlightPlan . Notice I used macros, you should be a ble to do this in an <update> as long as there a some checks to prevent constant firing. I was able to have a DirectTo with a FlightPlan loaded and upon DirectTo cancel it would revert to the last FlightPlan active waypoint. ( donot think the stock GPS does this)This is the same as before.

<Macro Name="FIND">'A' (>C:fs9gps:IcaoSearchStartCursor)31 (>C:fs9gps:enteringInput)"Your 4 Digit ICAO Code" (>C:fs9gps:IcaoSearchEnterChar)(C:fs9gps:IcaoSearchMatchedIcaosNumber) 1 == if{ (C:fs9gps:IcaoSearchCurrentIcao) (>C:fs9gps:FacilityICAO) }</Macro>

In here is the key, when going DirectTo there are 2 waypoints. Index0 = Current AC position @ time of going DirectTo,, Index1 = The DirectTo waypoint ICAO. So you have to set Index to 1 to get the DirectTo to work. Also to display the DirectTo information Index must be @ 1. This macro is controlled by an update below.

Macro Name="DTO">1 (>C:fs9gps:FlightPlanWaypointIndex) (C:fs9gps:FacilityICAO) (>C:fs9gps:FlightPlanNewWaypointICAO) 1 (>C:fs9gps:FlightPlanDirectToDestination)</Macro>

These updates do 2 things, 1st - It keeps the Index locked to current Waypoint. It may not be a good idea to do this in advanced GPS functions such as Waypoint replacement Etc. 2nd - This checks that there is a valid FacilityICAO & that the Facility ICAO is different than FlightPlanWaypointIdent @ index1, if so, do the 1 cycle dilemma I keep getting, then send to @DTO.

Update>(C:fs9gps:FlightPlanActiveWaypoint) (>C:fs9gps:FlightPlanWaypointIndex)(G:Var1) 0 ==  (C:fs9gps:FacilityICAO) slen 3 >  (C:fs9gps:FacilityICAO)  (C:fs9gps:FlightPlanWaypointIdent) scmp 0 == ! & & if{ 1 (>G:Var1) }(G:Var1) 2 == if{ @DTO 0 (>G:Var1) }(G:Var1) 1 == if{ 2 (>G:Var1) }</Update>

This RESET Macro will clear the DirectTo and is only good when there is no FlightPlan loaded. If one is, it will strip 2 waypoints starting at the current Index. It has also locked up FS if there is no waypoints at all, hence the IsDirectTo check.

Macro Name="RESET">' ' (>C:fs9gps:FacilityICAO)(C:fs9gps:FlightPlanIsDirectTo) if{  (>C:fs9gps:FlightPlanCancelDirectTo)(>C:fs9gps:FlightPlanDeleteWaypoint) (>C:fs9gps:FlightPlanDeleteWaypoint) }</Macro>

Here are the variables I used for testing.DirectTo

(C:fs9gps:FlightPlanIsDirectTo)(C:fs9gps:FlightPlanWaypointIdent)(C:fs9gps:FlightPlanWaypointRemainingDistance, Nmile)(C:fs9gps:FlightPlanWaypointMagneticHeading)(C:fs9gps:FlightPlanWaypointEstimatedTimeRemaining, minutes)

GPS Status

C:fs9gps:FacilityIdent)(C:fs9gps:FlightPlanDirectToWaypoint)(C:fs9gps:FlightPlanWaypointsNumber)(C:fs9gps:FlightPlanWaypointIndex)(C:fs9gps:FlightPlanIsActiveFlightPlan)(C:fs9gps:FlightPlanActiveWaypoint)(C:fs9gps:FlightPlanIsActiveWaypoint)

I also noticed that the GPS keeps track of changes that I make using this test gauge.. :-) Maybe because it is on the same window? I assumed that 2 different calls to the GPS would result in 2 actions being separated. (asynchronous???)Hope this can help if you didn't figure it out yourself..Roman

Share this post


Link to post
Share on other sites

Roman,I tested it your way, putting the functional code in macros and then running the macros from within update and I understand what ya meant about the cycles now - and that part seems resolved. No the flight plan will set to directtodestination.The only problem that seems to persist is the (C:fs9gps:FacilityICAO) (>C:fs9gps:FlightPlanNewWaypointICAO) flightplannewwaypointicao will not set at all. I can not figure out why. I considered that I do not use the default GPS gauge or any other default gauge in my panel so maybe some code is lacking?FYI, there was no reference to the FIND macro - initiating it - in the update code nor the RESET so I added @FIND in front of @DTO in the update code - it works right, just don't know if it is right. I did not add RESET anywhere though.Thanks for the help you offer, I hope I'm not being too much of a bother. :(

Share this post


Link to post
Share on other sites

Engjell,

The only problem that seems to persist is the (C:fs9gps:FacilityICAO) (>C:fs9gps:FlightPlanNewWaypointICAO) flightplannewwaypointicao will not set at all. I can not figure out why. I considered that I do not use the default GPS gauge or any other default gauge in my panel so maybe some code is lacking?
Just FYI in case you're trying.. FlightPlanNewWaypointICAO is not readable.FlightPlanWaypointIndex 0 = current LAT/LON at time of DirectTo activation. So FlightPlanWaypointIndex 1 is the DirectTo waypoint.This writes FlightPlanWaypointIndex to 1 so I can put the waypoint there at that index.
1 (>C:fs9gps:FlightPlanWaypointIndex) (C:fs9gps:FacilityICAO) (>C:fs9gps:FlightPlanNewWaypointICAO) 1 (>C:fs9gps:FlightPlanDirectToDestination)

FacilityICAO is now an active waypoint. This writes FlightPlanWaypointIndex to 1 so I can now read the new waypoint at that Index.

1 (>C:fs9gps:FlightPlanWaypointIndex)%(C:fs9gps:FlightPlanWaypointIdent)%!s!%

, there was no reference to the FIND macro - initiating it - in the update code nor the RESET so I added @FIND in front of @DTO in the update code - it works right, just don't know if it is right. I did not add RESET anywhere though.
Me bad - The call to @FIND originates in a part of code that I didn't provide, The keyboard/Mousewheel/Drag functions I use to select the ICAO code. Once that code reaches 4 digits it formats then sends to @FIND to start the whole deal. I know macros are used for multiple calls and such to save space, brevity etcc. I use them to put specific chunks of code into, ones that do a specific purpose - that way I can easily find the offending code. (which is alot, LOL) @RESET is called from the "CANCEL" button.. It was put in a macro just for ease of editing in my code.. Yes this thing could be rewritten to a "proper" syntax set, but it's just a test gauge after all. Keep pluggin at it, Hope this helps,Roman

Share this post


Link to post
Share on other sites

It seems I've come to the end of my wits again.I will try to explain whats happening in my gauge better, hopefully to get to the bottom of this once and for all.I've set up the code just as you recommended, the three macros, the G:Var triggers wrapped in update - within which I've included code to set the flightplan index to 1 as in the macro it won't stay at 1 it only goes to one for a second and then back - and I've added the @find into the mouse click.Three macros:

<Macro Name="FIND">'A' (>@c:IcaoSearchStartCursor)31 (>@c:enteringInput)(L:FMC-RTE-DEST-1,number) chr (L:FMC-RTE-DEST-2,number) chr (L:FMC-RTE-DEST-3,number) chr  (L:FMC-RTE-DEST-4,number) chr scat scat scat (>@c:IcaoSearchEnterChar) (@c:IcaoSearchMatchedIcaosNumber) 1 == if{ (@c:IcaoSearchCurrentIcao) (>@c:FacilityICAO) } </Macro><Macro Name="DTO">(@c:FacilityICAO) (>@c:FlightPlanNewWaypointICAO) <!--== 1 (>@c:FlightPlanDirectToDestination) ==--></Macro><Macro Name="RESET">' ' (>@c:FacilityICAO)(@c:FlightPlanIsDirectTo) if{ (>@c:FlightPlanCancelDirectTo)(>@c:FlightPlanDeleteWaypoint) (>@c:FlightPlanDeleteWaypoint) }</Macro>

In @DTO I've excluded 1 (>@c:FlightPlanDirectToDestination) because when it's included the sim crashes right when @DTO is triggered, and I get a error report for panels.dll.I use the following code wrapped in a bigger string to see what the variables are doing:

%ICAO %((@c:IcaoSearchCurrentIcao))%!s!\t\t\t%WPID %((@c:FlightPlanWaypointIndex))%!s!\n%FACT %((@c:FacilityICAO))%!s!\t\t%FPWP %((@c:FlightPlanWaypointIdent))%!s!

And this is the code in update:

1 (>@c:FlightPlanWaypointIndex) 5 (>@g:blinkingField) (G:Var1) 0 ==  (@c:FacilityICAO) slen 3 > (@c:FacilityICAO) (@c:FlightPlanWaypointIdent) scmp 0 == ! and and if{ 1 (>G:Var1) }(G:Var1) 2 == if{ @DTO 0 (>G:Var1) }(G:Var1) 1 == if{ 2 (>G:Var1) }

Now I would start the aircraft, align the IRU's, then go to the Route page enter in my destination in this below case "PHOG" as I was in PHMK, so then the ICAO-icao sets and the Facility ICAO sets, the Flight plan waypoint does not set, it has never set. I'm trying everything to set it but I can't understand why it will not.FMC-C-MK-T1.jpgFMC-C-MK-T2.jpgFMC-C-MK-T3.jpgI've been trying to understand how to work my way around this by studying the default GPS, but I've gotten no where.Any help would be much appreciated.

Share this post


Link to post
Share on other sites

I've made some progress, it seems where I'm stuck is as you can see in the above pictures that 'A' that the ICAO search starts with seems to be treated as a separate unit, I would think it would change but it sticks, and then the Facility ICAO becomes the same as the ICAO search in the above case "APHOG". Now once I send this to @DTO to make the FlightPlanNewWaypointICAO the FacilityICAO it doesn't work at all, I have the index set to 1 but it wont work so I can't figure out what to do now.I'm trying to copy over some of the examples from the default GPS and get them to work but I can't get them to work when I want to set the FlightPlanNewWaypointICAO.I've been looking at how the GPS does business, and it seems it uses InvokeICAOInputMode macro, to set it up for input so I may figure out a way to work that and see if I get some results, not to sure of anything right now just messing with examples as I can.

Share this post


Link to post
Share on other sites

Out of some odd stroke of luck I found myself a working solution. :( :(

<Macro Name="FMCDESTGET">'A' (>C:fs9gps:IcaoSearchStartCursor)31 (>C:fs9gps:enteringInput)(L:FMC-RTE-DEST-1,number) chr (L:FMC-RTE-DEST-2,number) chr (L:FMC-RTE-DEST-3,number) chr  (L:FMC-RTE-DEST-4,number) chr scat scat scat (>C:fs9gps:IcaoSearchEnterChar) (C:fs9gps:IcaoSearchMatchedIcaosNumber) 1 == if{ (C:fs9gps:IcaoSearchCurrentIcao) (>C:fs9gps:FacilityICAO) quit } </Macro><Macro Name="FMCDESTSET">(C:fs9gps:FlightPlanWaypointIndex) 0 == (C:fs9gps:IcaoSearchMatchedIcaosNumber) 1 == (C:fs9gps:IcaoSearchCurrentIcao) (C:fs9gps:FacilityICAO) == and and if{ 1 (>C:fs9gps:FlightPlanWaypointIndex) } (C:fs9gps:FacilityICAO) (>C:fs9gps:FlightPlanNewWaypointICAO) 1 (>C:fs9gps:FlightPlanDirectToDestination) ' ' (>C:fs9gps:FacilityICAO) ' ' (>C:fs9gps:IcaoSearchStartCursor) quit</Macro>

Thanks to all for your help and I apologize for having been so slow with grasping this. :( Now to figure out how to add waypoints and manipulate the nearest airport code..fun! B)

Share this post


Link to post
Share on other sites

For future reference, don't know if this is known or not - but I had to learn it the hard way. :( %((C:fs9gps:FlightPlanDepartureAirportIdent) (C:fs9gps:FlightPlanDestinationAirportIdent) scat)%!s!The above code works fine, until you try and set the flightplan to directto or directtodestination at which point it crashes the sim with a error report pointing to panels.dll. :( %((C:fs9gps:FlightPlanDepartureAirportIdent))%!s!%((C:fs9gps:FlightPlanDestinationAirportIdent))%!s!The one above works without problem. :(

Share this post


Link to post
Share on other sites