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

Conditions in XML

Messages
2
Hey:-)

At first...sorry for some mistakes but english isn't my mother tongue.

Ok...I have a question especially to the XML-files. I use the freeware add-on of the T-6 Texan 2. At the moment I try to improve the add-an because some things are quiet different to the real airplane.
I have some problems to write conditions in XML, e.g. one display (EADI) should start to work if the switches for "Battery" AND "Avionic" are on OR the Voltage of the GEN-Bus is 28V AND the "BUS-Tie-Switch" is off AND the avionic witch is on. Additionally a further variable should be always true.
I know that you don't know all the names of the switches for the T6. That's no problem. I need only a schema for writing conditions in XML. Especially for this: ((... AND ...) OR (...AND...AND...)) And ...

I have seen in other XML Files something like this:
<visible> (...) (...) &amp; (...) ! &amp; &amp; </visible>

In my opinion it means:
(...AND...) And ...

But why there are two "&amp" at the end? And how can I realize my condition?:
((... AND ...) OR (...AND...AND...)) And ...

Thank for your help:-)

Bye
Peter
 
Hi Peter,
a few comments from slightly advanced beginner to beginner.
Believe me - I've been there ...

.xml takes some getting used to. Just jumping in and changing a few lines by guesswork is likely to lead to a lot of frustration.
You're in for a steep learning curve.
But after about 6 months or so it starts to get easier... ;)

I suggest you go through the different tutorials, e.g.

http://www.fs2x.com/Tutorials.htm
http://users.skynet.be/fa062023/files/Writing xml Gauges for FS.pdf
http://blogs.technet.com/b/engauged/

Also, as for online ressources, ESB and P3D sdk are in most parts relevant to FSX and FS2004 regarding .xml syntax, variables and events):
http://msdn.microsoft.com/en-us/library/cc526953.aspx
http://www.prepar3d.com/sdk../SimObject Creation Kit/Panels and Gauges SDK/creating xml gauges.html
Your FS version's sdk primes of course.

A few hints:

- You'll have to learn Reverse Polish Notation. It's not really difficult once you've gotten the hang of it, just different. See the tutorials.

- FS's xml is extremely unforgiving of even slight errors/variations in syntax.
If you don't KNOW something works, don't ASSUME it does. Always test !
Stick to proven ways to write the code if there are no good arguments to try a new approach. Experiments can be time-consuming.

- Test frequently !
Always test after even slight changes to the code. Nothing worse than hunting for that missing "space" after adding 50 lines of new code.

- Capitalisation often counts.
Write operators, variable names, units ect. exactly as specified in the sdk (best copy from the sdk). Will not be necessary in all cases, but if you don't do it, and it did count, you're in for some major pain debugging the code. So better develop good reflexes from the start, instead of going through painful troubbleshooting later.

- Spaces are extremely important !
Spaces separate operators, variables, events, values ect. from each other.
One missing space can break the whole code. I personally place a space after each operator or variable or number in the code (except within strings), even if not necessarily needed in all cases.
But don't cut an operator in two with a space either, e.g. "if{ " is an operator (note the space at the end), "if { " will not work.

- All variables (except G:Var variables) need UNITS, e.g. (L:PropRPM,rpm)
Events (>K:...) don't need units.

- Notepad++ is a good editor for writing the code.

- Timesaver for testing FS2004 gauges:
FS2004 does not allow editing a .xml gauge file while an aircraft using the gauge is loaded in FS.
2 solutions to unlock the .xml file:
1. Load another aircraft; alt-tab out of FS; edit .xml file in Notepad++ and save; go back to FS; load original aircraft -> ready to test gauge.
2. Map the command "RELOAD_PANELS" to a key in the fs9.cfg. Hit this key in FS2004 (this "unlocks" the .xmls); alt-tab out of FS; edit .xml file in Notepad++ and save; go back to FS; hit "Reload Panels" key again -> ready to test gauge (for some changes to take effect, e.g. new bitmaps, the aircraft has to be reloaded - map another key to "RELOAD_USER_AIRCRAFT".

Good luck, and hang on... there are rewards for the efforts spent.

Now to your questions:

"and" (minuscules!, AND does not work!) "&amp;&amp;" and "&&" are identical logical operators. They have the exact same effect.


Suggested code for your logic, assuming all variables are user-defined L: type:
Code:
(L:BatterySwitchON,bool) 0 != 
(L:AvionicsSwitchON,bool) 0 != and 

(L:GENBusVoltage,number) 27.9 &gt; 
(L:BUSTieSwitchON,bool) 0 == and 
(L:AvionicsSwitchON,bool) 0 != and 

or 

(L:FurtherVariableON,bool) 0 != and
Read a little about Reverse Polish Notation and you'll figure it out.
 
Last edited:
Just to add to Teson1's reply, one thing to use too is Internet Explorer or Chrome ( not sure of others) as XML is a native language roduced mainly for internet uses. Because of this you can use the browsers to check for "format errors" such as missing closing tags etc.. Parsing your xml gauge in a browser if it doesn't show up in FS will give you line #s and the reason why..

Roman
 
Back
Top