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

Calling Effects From XML

Messages
10
Country
unitedstates
Can anyone give me the general syntax to call an FX from an XML gauge? My understanding is that the only way to activate an FX outside of the stock ones is to call it via XML. Also, I need to be able to call the effects conditionally. Since I doubt the basic "Visible" attribute to an element works for that, could you tell me in general terms who to do invoke an FX inside an aircraft?

Please?

Cyborg Bill
 
The easiest way to do it is via the smoke system. You can set multiple smoke effects using indexed items, like smoke.0, smoke.1, etc.

Then you need to trigger the effect with a smoke on or smoke toggle K event. I don't know whether this works, but you could try passing the index of the event as the parameter.

An alternative way is to use unused lights on your aircraft. For example, define you effect as the logo light (or other) in the aircraft.cfg and then send K events to either switch the light/effect on or off.

Si
 
OK, could you give me a line or two of pseudo code to illustrate how to do it? I would want to run the FX at various power or flap settings. I'm still new at this whole backwards-polack thinking that seems to be the heart of XML.

I know how to turn a gauge on or off - using the "Visible" attribute of the element. Is that the way to do it? Send the activate K event if the conditions are right and send the de-activate when the parameter is out of range? Surely it isn't that simple.

Cyborg Bill
 
a working example of an effects xml file

Here's a working example of an XML file used in the Panel section of an aircraft to control some effects. This one makes engine smoke when the aircraft is travelling greater than 25kts, at altitudes below 30,000ft, and when the throttle is greater than 80%. The first Element switches the smoke on, the second Element switches it off.

<Gauge Name="Engine1 Smoke">
<Element>
<Select>
<Value>
(A:AIRSPEED INDICATED,knots) 25 &gt; (A:INDICATED ALTITUDE,feet) 30000 &lt; (A:GENERAL ENG1 THROTTLE LEVER POSITION,percent) 80 &gt; (A:SMOKE ENABLE,bool) 0 == ; &amp;&amp; &amp;&amp; &amp;&amp; if{ (&gt;K:SMOKE_ON) }
</Value>
</Select>
</Element>
<Element>
<Select>
<Value>
(A:GENERAL ENG1 THROTTLE LEVER POSITION,percent) 80 &lt; (A:INDICATED ALTITUDE,feet) 30000 &gt; || (A:AIRSPEED INDICATED,knots) 25 &lt; || (A:SMOKE ENABLE,bool) 1 == ; &amp;&amp; if{ (&gt;K:SMOKE_OFF) }
</Value>
</Select>
</Element>
</Gauge>


The above code could be saved as a file called, for example, "engine_smoke.xml".

This engine_smoke.xml file could then be included in a CAB file, which I have called in this example, "voodoo_c130.cab". You can use an open source utility called TUGzip to create CAB files. The CAB file can contain several XML files such as this. If you wish, the cab file can reside in the Panel folder of the aircraft you are working on (it could also go in the main FSX Gauges folder, but I prefer to keep them in the Panel folder for add on aircraft so I can uninstall them more easily if I wish to later).

In the PANEL.CFG file in the Panel folder you would create an entry for the xml gauge. Here's an extract from the [Window00] section of the Panel.cfg file in this working example. The smoke effect is attached to gauge62. The format is:
"gauge number = cab file ! embedded xml file, screen coordinates of the gauge".

gauge59=L_Registration!AtcReg, 547,230,39,18
gauge60=ALPHA_C-5!ENGINE LIGHTS, 277,435,86,34
gauge61=ALPHA_C-5!STALL OVERSPEED, 372,444,80,12
gauge62=voodoo_c130!engine_smoke, 1,1,1,1
gauge63=voodoo_c130!GS, 566,269,36,18
gauge64=voodoo_c130!engine_boost, 1,1,1,1


I hope this gives you one idea of how you can make make a gauge work to control an aircraft effect. Check out the SDK for all the Simulation Variables you can use in XML gauges.

The Reverse Polish Notation is tricky to do but there's a tool in the SDK called the Infix2Postfix Tool that (claims) can help you to figure the logic out.
 
This engine_smoke.xml file could then be included in a CAB file, which I have called in this example, "voodoo_c130.cab". You can use an open source utility called TUGzip to create CAB files. The CAB file can contain several XML files such as this. If you wish, the cab file can reside in the Panel folder of the aircraft you are working on (it could also go in the main FSX Gauges folder, but I prefer to keep them in the Panel folder for add on aircraft so I can uninstall them more easily if I wish to later).


If you like to make .CAB Files, you need the cabdir_sdk_setup. This is Attached here.
Install the cabdir_sdk_setup on the default path.
Now put your Folder with the Files for the gauge in the Folder of Cabdir_SDK and then move your Folder on the cabdir.exe and a short while later you have the .CAB File. Move this into the Gauges Folder of the FS and you are be ready.
 
Last edited:
RPN & Cabdir

Thanks for the help especially Voodoo and Bambi.

Voodoo:
I am familiar with Cabdir and have a directory set up with an appropriately named subdir for "compiling" cab files. I also have a couple of batch files that 1) get me there when I open up a DOS window and 2) cab the files. I am a dinosaur from the old DOS days (DOS 1 in fact) so have no problems working from a DOS window. Plus when I am working on tweaking the behavior of a gauge (or in the current case positioning an element) it is very easy to task switch, re-run the last line in the DOS window and drag/drop.

But which SDK has that Infix2Postfix program? I have the FS2004 SDKs installed and just did a search for it and it isn't there.

I was actually able to figure out your code for turning an effect on/off from your description. Am I right in understanding that when you have multiple conditions - IAS, altitude, etc. - that apply those conditions are separated by semicolons? If so then the only thing that puzzles me is the use of (to my unpracticed eye) a lot of "extra" ampersands between the last condition and the "if" statement. Also, If I want to do more than one thing based on the conditions can I just put more k: actions into the parenthesis? If not how would I do that?

Bambi:
Thanks for the Cabdir but I already had it. BTW, when you drop the directory (folder) onto the cabdir icon, what name results? Also where does the resulting cab file end up being created? Right now I am using the batch files to cab the desired directory and drag/drop the resulting cab where I want it.

Again, thanks for the help.
 
First of all, let me state for the record, Cyborg, that I am not experienced at XML coding. I have only pieced a few things together trying to get my head round this polish logic. The example I used is cobbled together from various sources and the syntax for the AND and OR operators about which you are asking has me confused too.

However, the infix2postfix tool is part of the FSX SDK, which you can download from "http://msdn.microsoft.com/en-us/esp/cc742007.aspx" I am sure a lot of it has good relevance. The infix2postfix tool (and a few other useful things) is described in the section "Creating XML Gauges"

The way I understand it is that the ampersands are "AND" operators and you need two in the command list separated by a semicolon for every AND operation you are carrying out. And also the pipe symbol "|" is the "OR" operator, and is used likewise. Although the OR pipe symbols don't "seem" to need so many semicolons, but I don't know why.

Someone more experienced may be able to dscribe why they seem to have to be used in pairs and separated by semicolons (or not). I'm sorry, Cy, I don't yet understand the finer points of that. :confused:
 
Back
Top