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

Debugging XML "Gauges"

n4gix

Resource contributor
Messages
11,674
Country
unitedstates
Here is a feature I learned about years and years ago, but frankly had completely forgotten about since it was a "do once and forget about it" event...

Add this one entry in your FSX.cfg or Prepar3D.cfg file as an aid to help debug XML scripted 'gauges'...

Code:
[PANELS]
...
GaugeDevDebug=1
 
Thanks for that - Can I also suggest:

For those of you trying to troubleshoot the gauges (for me the G1000) suggest you look at the SDK and the section on gauge programming.
Programmable Gauges in the SDK - look on-line at the prepar3d site.
In your Prepar3d.cfg file [Main] section set the
ContentErrorLogging = 1
And look at all the errors in your favorite add-on.

It puts the errors in a txt file.
 
If you comment out everything except the single XML script you are working on, you can then edit/save then simply "Reload User Aircraft" to see if the error is truly cleared. I assigned Ctrl-Shift-R to this command.

The ContentErrorLog.txt file however will be invaluable since there are apparently a TON of previously ignored and/or "auto-corrected" boo-boos I'll have to fix.

What is truly handy is that it even lists errors in embedded XML scripts in the compiled model. I can't believe I never noticed this one before! :yikes:
Code:
error=Gauge: Non-gauge
 
Error: Empty parens or closing paren missing: "(A:GPS IS APPROACH ACTIVE), bool) {if}
  ((A:GPS APPROACH WP TYPE), enum) {case}
  {:2}proc. turn
  {:3}proc
 
This "GaugeDevDebug=1" instruction was something new to me.:eek: I had never heard of it before, and I am not precisely a newbie in FS stuff...So thank you Bill for bringing this up here.

Now, after doing some tests I've got erratic results. It seems to work fine when dealing with missing parens or brackets, but sometimes gives false errors on <String> scripts; doesn't recognize also Avars that are a carry from FS9 but are not defined in the SDK (ie GENERAL ENG1 STARTER ACTIVE),and many other glitches.
Anyway, I think is an interesting tool. Need to test it deeper to obtain a strong conclusion.

Tom
 
As a follow up, after four solid days of effort, I've managed to find and fix all reported "errors" in the Milviz C310R project for P3Dv2.x, but it was a struggle finding the last few so-called "errors..." ;)
 
How was the model itself, the embedded animation/visibility coding? Did it all make it?
Bill, I just re-compiled all of the variants of the C310R using the v2.0 SDK so that all models are "native P3Dv2.0" now. They are working fabulously! I've thoroughly tested the new builds all afternoon and will get a new P3Dv2.x installer built tomorrow for the Beta team to give it a complete look-through and shakedown... ;)

Changing export tools in Max2012 was a matter of changing one entry in the Configuration, then remembering to move a copy of my C310_modeldef.xml file to the v2.0 SDK ..\bin folder and saving as modeldef.xml.

I already had set up a "SendTo" for the v2.0 compiler, so the whole process was pain-free and seamless. :wizard:
 
Ok.

More work. At least you got it all working. I had hoped that V1.4 models would be fine in V2.0.


Bill
 
Ok.

More work. At least you got it all working. I had hoped that V1.4 models would be fine in V2.0.
Oh my, they ARE compatible. The only reason why I bothered to make these new models v2.x compliant is to prevent customers from installing these exclusive releases in FSX or P3Dv1.x!!!
 
I found that my models I created in V2 SDK did not work in 1.4 or FSX. I might still be using the beta 2.0 SDK though.
 
Bill, models compiled with the P3Dv2.x SDK are NOT "backwards compatible" with FSX or P3Dv1.x that's the whole point... ;)
 
Bill, 1.4 models work OK in 2.0, while 2.0 models do NOT work in 1.4 - just what the other Bill wanted.
 
What would be awesome about ContentErrorLogging = 1 is if LM would put the line number that the error occurs.

Trying to find a missing closing parentheses in a GPS gauge with 4000 lines of code is a real bugger (says he who spent an hour doing just that :( ).
 
The problem with that suggestion is that by the time the ContentErrorLog "sees" the XML script, all unnecessary spaces and carriage returns have been stripped out, which would then make line numbers meaningless.

Wes wrote this in an email I received this morning:
What we are exploring for a future version is to have it as a menu item under the Help menu, and have the log run inside a window in real time. That way it will be easier to get access to the errors, and then customers can also use it as a way to help debug their content, or if they are running some really old content that hasn’t been updated, they can help see why it might not be running as well as they think it should, etc.
That would be a terrific help, as it would mean we could "edit" XML scripted 'gauges' in real-time, then Reload User Aircraft to see if the 'error' has been fixed. :idea:
 
The problem with that suggestion is that by the time the ContentErrorLog "sees" the XML script, all unnecessary spaces and carriage returns have been stripped out, which would then make line numbers meaningless.

Actually CR-LF are stripped out, spaces remain in the script as they are the natural separation of operands and operators.

And the possibilty to have a log of script errors while the sim is running sounds very interesting, though I guess it should involve different functions as those used for the actual parsing, as to not affect code performance.

Tom
 
Last edited:
I did say "unnecessary spaces," Tom.
Code:
(A:SomeVar,bool)            0 !=
        if{ do this }
should come out as
Code:
(A:SomeVar,bool) 0 != if{ do this }
My suggestion to Wes was that whenever an "error" is found, that they log the entire section of script immediately preceding or following the "error" to provide an easier way to find the "error."

Wes agreed that might be something feasible to implement.
 
I did say "unnecessary spaces," Tom.
Code:
(A:SomeVar,bool)            0 !=
        if{ do this }
should come out as
Code:
(A:SomeVar,bool) 0 != if{ do this }

Uh, no. Unfortunately extra spaces are not removed but included as part of the script.
Not a big issue though ;)

Tom
 
Come to think on it, I guess they aren't. Now that I think on this more, I do seem to recall a few of the 'error' XML snippets in the ContentErrorLog.txt file that seem to have kept the extraneous and unnecessary spaces... :scratchch
 
Back
Top