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

P3D v4 A few questions about 3D virtual cockpit

Unfortunately it's not working;-(
Change cfg to:
Center1 = 12.68, 0, -5.4, 11336, 5 //Бак 6
LeftMain = 5.98, -24.15, -0.02, 9962, 0 //Бак 1 и 2
RightMain = 5.98, 24.15, -0.02, 9962, 0 //Бак 3 и 4
LeftAux = -8.03, -51.7, 3.53, 2879, 4 //Бак 5 лев
RightAux = -8.03, 51.7, 3.53, 2879, 4 //Бак 5 прав
LeftTip = -16.25, -65.72, 4.99, 617, 1 //Бак 5А лев
RightTip = -16.25, 65.72, 4.99, 617, 1 //Бак 5А прав

Add to panel gauge gauge16=FUEL!FUEL, 0, 0 ,0 with xml:
Code:
<Gauge Name="FUEL" Version="1.0">
(A:FUEL TANK CENTER QUANTITY, liters) 20 &gt;
if{ (A:FUEL TANK SELECTOR:1,enum) 6 != if{ 6 (>K:FUEL_SELECTOR_SET) }
     (A:FUEL TANK SELECTOR:2,enum) 6 != if{ 6 (>K:FUEL_SELECTOR_2_SET) } }
els{  (A:FUEL TANK LEFT MAIN QUANTITY, liters) 10000 &gt;
        if{ (A:FUEL TANK SELECTOR:1,enum) 2 != if{ 2 (>K:FUEL_SELECTOR_SET) }
             (A:FUEL TANK SELECTOR:2,enum) 2 != if{ 2 (>K:FUEL_SELECTOR_2_SET) } }
      (A:FUEL TANK RIGHT MAIN QUANTITY, liters) 10000 &gt; and
        if{ (A:FUEL TANK SELECTOR:1,enum) 3 != if{ 3 (>K:FUEL_SELECTOR_3_SET) }
             (A:FUEL TANK SELECTOR:2,enum) 3 != if{ 3 (>K:FUEL_SELECTOR_4_SET) } }
        els{ (A:FUEL TANK LEFT AUX QUANTITY, liters) 700 &gt;
               if{ (A:FUEL TANK SELECTOR:1,enum) 4 != if{ 4 (>K:FUEL_SELECTOR_SET) }
                    (A:FUEL TANK SELECTOR:2,enum) 4 != if{ 4 (>K:FUEL_SELECTOR_2_SET) } }
              (A:FUEL TANK RIGHT AUX QUANTITY, liters) 700 &gt; and
               if{ (A:FUEL TANK SELECTOR:1,enum) 5 != if{ 5 (>K:FUEL_SELECTOR_3_SET) }
                    (A:FUEL TANK SELECTOR:2,enum) 5 != if{ 5 (>K:FUEL_SELECTOR_4_SET) } }
               els{ (A:FUEL TANK LEFT TIP QUANTITY, liters) 5 &gt;
                      if{ (A:FUEL TANK SELECTOR:1,enum) 12 != if{ 12 (>K:FUEL_SELECTOR_SET) }
                           (A:FUEL TANK SELECTOR:2,enum) 12 != if{ 12 (>K:FUEL_SELECTOR_2_SET) } }
                     (A:FUEL TANK RIGHT TIP QUANTITY, liters) 5 &gt; and
                      if{ (A:FUEL TANK SELECTOR:1,enum) 11 != if{ 11 (>K:FUEL_SELECTOR_3_SET) }
                           (A:FUEL TANK SELECTOR:2,enum) 11 != if{ 11 (>K:FUEL_SELECTOR_4_SET) } }
                      els{ (A:FUEL TANK LEFT AUX QUANTITY, liters) 15 &gt;
                             if{ (A:FUEL TANK SELECTOR:1,enum) 4 != if{ 4 (>K:FUEL_SELECTOR_SET) }
                                  (A:FUEL TANK SELECTOR:2,enum) 4 != if{ 4 (>K:FUEL_SELECTOR_2_SET) } }
                            (A:FUEL TANK RIGHT AUX QUANTITY, liters) 15 &gt; and
                             if{ (A:FUEL TANK SELECTOR:1,enum) 5 != if{ 5 (>K:FUEL_SELECTOR_3_SET) }
                                  (A:FUEL TANK SELECTOR:2,enum) 5 != if{ 5 (>K:FUEL_SELECTOR_4_SET) } }
                             els{ (A:FUEL TANK SELECTOR:1,enum) 2 != if{ 2 (>K:FUEL_SELECTOR_SET) }
                                    (A:FUEL TANK SELECTOR:2,enum) 2 != if{ 2 (>K:FUEL_SELECTOR_2_SET) }
                                    (A:FUEL TANK SELECTOR:1,enum) 3 != if{ 3 (>K:FUEL_SELECTOR_3_SET) } and
                                    (A:FUEL TANK SELECTOR:2,enum) 3 != if{ 3 (>K:FUEL_SELECTOR_4_SET) } } } } } }
</Gauge>
But aircraft used first Tip with slowly center then aux and then main (like in default).
 
You need to wrap the code either in update or element-select-value tags, i.e.
Code:
<Gauge Name="MyGauge" Version="1.0">
<Update>
[Code goes here]
</Update>
</Gauge>
or
Code:
<Gauge Name="MyGauge" Version="1.0">
<Element>
<Select>
<Value>
[Code goes here]
</Value>
</Select>
</Element>
</Gauge>

Note that you may use only one update section per gauge, but as many element-select-value sections as you need.
 
No, it does not work. Maybe I'm doing something wrong?
In the folder with the panel I created the folder Fuel. In it created a xml document with the following content:
<Gauge Name="FUEL" Version="1.0">
<Element>
<Select>
<Value>
(A:FUEL TANK CENTER QUANTITY, liters) 20 >
if{ (A:FUEL TANK SELECTOR:1,enum) 6 != if{ 6 (>K:FUEL_SELECTOR_SET) }
(A:FUEL TANK SELECTOR:2,enum) 6 != if{ 6 (>K:FUEL_SELECTOR_2_SET) } }
els{ (A:FUEL TANK LEFT MAIN QUANTITY, liters) 10000 >
if{ (A:FUEL TANK SELECTOR:1,enum) 2 != if{ 2 (>K:FUEL_SELECTOR_SET) }
(A:FUEL TANK SELECTOR:2,enum) 2 != if{ 2 (>K:FUEL_SELECTOR_2_SET) } }
(A:FUEL TANK RIGHT MAIN QUANTITY, liters) 10000 > and
if{ (A:FUEL TANK SELECTOR:1,enum) 3 != if{ 3 (>K:FUEL_SELECTOR_3_SET) }
(A:FUEL TANK SELECTOR:2,enum) 3 != if{ 3 (>K:FUEL_SELECTOR_4_SET) } }
els{ (A:FUEL TANK LEFT AUX QUANTITY, liters) 700 >
if{ (A:FUEL TANK SELECTOR:1,enum) 4 != if{ 4 (>K:FUEL_SELECTOR_SET) }
(A:FUEL TANK SELECTOR:2,enum) 4 != if{ 4 (>K:FUEL_SELECTOR_2_SET) } }
(A:FUEL TANK RIGHT AUX QUANTITY, liters) 700 > and
if{ (A:FUEL TANK SELECTOR:1,enum) 5 != if{ 5 (>K:FUEL_SELECTOR_3_SET) }
(A:FUEL TANK SELECTOR:2,enum) 5 != if{ 5 (>K:FUEL_SELECTOR_4_SET) } }
els{ (A:FUEL TANK LEFT TIP QUANTITY, liters) 5 >
if{ (A:FUEL TANK SELECTOR:1,enum) 12 != if{ 12 (>K:FUEL_SELECTOR_SET) }
(A:FUEL TANK SELECTOR:2,enum) 12 != if{ 12 (>K:FUEL_SELECTOR_2_SET) } }
(A:FUEL TANK RIGHT TIP QUANTITY, liters) 5 > and
if{ (A:FUEL TANK SELECTOR:1,enum) 11 != if{ 11 (>K:FUEL_SELECTOR_3_SET) }
(A:FUEL TANK SELECTOR:2,enum) 11 != if{ 11 (>K:FUEL_SELECTOR_4_SET) } }
els{ (A:FUEL TANK LEFT AUX QUANTITY, liters) 15 >
if{ (A:FUEL TANK SELECTOR:1,enum) 4 != if{ 4 (>K:FUEL_SELECTOR_SET) }
(A:FUEL TANK SELECTOR:2,enum) 4 != if{ 4 (>K:FUEL_SELECTOR_2_SET) } }
(A:FUEL TANK RIGHT AUX QUANTITY, liters) 15 > and
if{ (A:FUEL TANK SELECTOR:1,enum) 5 != if{ 5 (>K:FUEL_SELECTOR_3_SET) }
(A:FUEL TANK SELECTOR:2,enum) 5 != if{ 5 (>K:FUEL_SELECTOR_4_SET) } }
els{ (A:FUEL TANK SELECTOR:1,enum) 2 != if{ 2 (>K:FUEL_SELECTOR_SET) }
(A:FUEL TANK SELECTOR:2,enum) 2 != if{ 2 (>K:FUEL_SELECTOR_2_SET) }
(A:FUEL TANK SELECTOR:1,enum) 3 != if{ 3 (>K:FUEL_SELECTOR_3_SET) } and
(A:FUEL TANK SELECTOR:2,enum) 3 != if{ 3 (>K:FUEL_SELECTOR_4_SET) } } } } } }
</Value>
</Select>
</Element>
</Gauge>

Then in the panel.cfg in the section Window00 (main 2D panel) added a line:
gauge16=FUEL!FUEL, 0, 0 ,0
That's all. But gauge not working.
 
Is the gauge located in a folder named "Fuel"?
And if you add it to Window00 you need to be in 2D panel view to run it.
 
Affirm. Xml named - FUEL.xml and place in folder named FUEL.
2D panel opened. I try to add gauge to 3d vc section... and results is very strange;))) start burn in center and right tip, first burned right tip (there is a little bit of fuel), then left tip... when in Left Tip eas a fuel starting burned Right Aux, tnen when burn Right Aux a few times later starting burn Left aux.
I'll try to figure it out later. Now it's more interesting to work on the 3d cockpit and systems.
 
Affirm. Xml named - FUEL.xml and place in folder named FUEL.
2D panel opened. I try to add gauge to 3d vc section... and results is very strange;))) start burn in center and right tip, first burned right tip (there is a little bit of fuel), then left tip... when in Left Tip eas a fuel starting burned Right Aux, tnen when burn Right Aux a few times later starting burn Left aux.
I'll try to figure it out later. Now it's more interesting to work on the 3d cockpit and systems.

I've only posted code for the left side tanks. The engines on the right side continue to use default fuel logic. You will have to adapt the code for the right side fuel selectors.
If the left side tanks do not burn correctly, check that I've specified the correct tanks for the fuel selectors (use the list in the SDK documentation that I've linked to in this thread).
 
I've only posted code for the left side tanks. The engines on the right side continue to use default fuel logic. You will have to adapt the code for the right side fuel selectors.
If the left side tanks do not burn correctly, check that I've specified the correct tanks for the fuel selectors (use the list in the SDK documentation that I've linked to in this thread).

But I was add code for the right side. I think is wrong (see above). I've been double check it. Tanks are correct. Nevermind, I'll back to that problem later, when fuel system will be almost correct and added to 3d VC.

Yesterday I was try to make APU door animation. I have a switch APU in VC - toggle_APU_switch. I was add new animation to modeldef.xml named - apu_door for external model. And I want when I turned on switch apu in VC apu door on external model opened too. I think code is wrong... (write by memory, maybe variables a little bit incorrect, but logic like this)
Code:
(A:toggle_apu_switch, bool) if{ (L:apu_door, bool)
Is that correct? When I turn on apu switch in VC apu door is open on external model.
 
You need a closing bracket at the end of the line. That should be correct if:

1. The A: variable is a valid FS variable from the SDK.
2. The switch in the VC swaps the value of this FS variable.
3. There is a part in the modeldef.xml file that specifies that the animation of the part should be dependent on the value of the L:apu_door variable, and that animation is properly assigned to the apu door.

BTW, if the VC switch swaps the value of that FS variable, I see no reason you could not control the animation of the apu door using that same A: variable in the modeldef.xml file, thus eliminating the need for the L: variable. This is unless you have further things to code and the code above is only a starting point.
 
There is no such variable in any of the SDKs I've looked at...
The only APU variables are:

APU PCT RPM Auxiliary power unit rpm, as a percentagePercent over 100
APU PCT STARTER Auxiliary power unit starter, as a percentagePercent over 100
APU VOLTS Auxiliary power unit voltage Volts
APU GENERATOR SWITCH True if APU generator switch on Bool
APU GENERATOR ACTIVE True if APU generator active Bool
APU ON FIRE DETECTED True if APU on fire Bool

Something like this would work:
Code:
(L:SwitchAPU,bool) if{ 1 (>L:apu_door,bool) } els{ 0 (>L:apu_door,bool) }
 
You need a closing bracket at the end of the line. That should be correct if:

1. The A: variable is a valid FS variable from the SDK.
2. The switch in the VC swaps the value of this FS variable.
3. There is a part in the modeldef.xml file that specifies that the animation of the part should be dependent on the value of the L:apu_door variable, and that animation is properly assigned to the apu door.

BTW, if the VC switch swaps the value of that FS variable, I see no reason you could not control the animation of the apu door using that same A: variable in the modeldef.xml file, thus eliminating the need for the L: variable. This is unless you have further things to code and the code above is only a starting point.

Yes, i forgot a bracket when write it, but i have it in code offcourse.
Almost i was check variable - apu switch in modeldef is not A it is a L-variable.

Something like this would work:
Code:
(L:SwitchAPU,bool) if{ 1 (>L:apu_door,bool) } els{ 0 (>L:apu_door,bool) }

Thank you so much! I think this is what I need. Because i don't know how to say "when switch is on animation is on too" by RPN in code.
 
It's strange, but it's not working:-( And I don't know why.
I was try with APU door and also with landing light retracted. Maybe virtual cockpit and external model not connected by L-variables? Cuz sim variables is work... like a flaps, gears etc. For example here is the code for retracted lights:
Code:
    <Animation name="switch_light_open" guid="62458c2d-92af-43a3-ab84-64ad1162d0a2" length="50" type="Sim" typeParam2="switch_light_open" typeParam="AutoPlay" />
    <PartInfo>
        <Name>switch_light_open</Name>
        <AnimLength>50</AnimLength>
        <Animation>
            <Parameter>
                <Code>
                    (L:switch_light_open, bool) if{ 50 } els{ 0 }
                </Code>
                <Lag>400</Lag>
            </Parameter>
        </Animation>
        <MouseRect>
            <Cursor>Hand</Cursor>
            <TooltipID>switch_light_open</TooltipID>
            <CallbackCode>
                    (L:switch_light_open, bool) ! (>L:switch_light_open, bool)
            </CallbackCode>
        </MouseRect>
    </PartInfo>
  <PartInfo>
    <Name>light_light_open</Name>
    <Visibility>
      <Parameter>
        <Code>
          (L:switch_light_open, bool)
          (A:ELECTRICAL MASTER BATTERY,bool)
          and
        </Code>
      </Parameter>
    </Visibility>
  </PartInfo>

    <Animation name="light_open" guid="49c759b4-9ef0-4dd3-9b63-97eeb978d9fd" length="100" type="Sim" typeParam2="light_open" typeParam="AutoPlay" />
    <PartInfo>
        <Name>light_open</Name>
        <AnimLength>100</AnimLength>
        <Animation>
            <Parameter>
                <Code>
                   (L:switch_light_open,bool) if{ 1 (>L:light_open,bool) } els{ 0 (>L:light_open,bool) }
                </Code>
                <Lag>50</Lag>
            </Parameter>
        </Animation>
    </PartInfo>

switch_light_open - it is a button on VC. light_light_open - announciator light "ON" in this switch. light_open - is a retractable light on external model.
 
Last edited:
Try this:

Code:
    <Animation name="switch_light_open" guid="62458c2d-92af-43a3-ab84-64ad1162d0a2" length="50" type="Sim" typeParam2="switch_light_open" typeParam="AutoPlay" />
    <PartInfo>
        <Name>switch_light_open</Name>
        <AnimLength>50</AnimLength>
        <Animation>
            <Parameter>
                <Code>
                    (L:switch_light_open, bool) 50 *
                </Code>
                <Lag>400</Lag>
            </Parameter>
        </Animation>
        <MouseRect>
            <Cursor>Hand</Cursor>
            <TooltipText>Landing Lights%((L:switch_light_open, bool) (A:ELECTRICAL MAIN BUS VOLTAGE, volts) 5 &gt; and)%{if} (Open)%{else} (Closed)%{end}</TooltipText>
            <CallbackCode>
                    (L:switch_light_open, bool) ! (>L:switch_light_open, bool)
            </CallbackCode>
        </MouseRect>
    </PartInfo>
  <PartInfo>
    <Name>light_light_open</Name>
    <Visibility>
      <Parameter>
        <Code>
          (L:switch_light_open, bool) (A:ELECTRICAL MAIN BUS VOLTAGE, volts) 5 &gt; and
        </Code>
      </Parameter>
    </Visibility>
  </PartInfo>

    <Animation name="light_open" guid="49c759b4-9ef0-4dd3-9b63-97eeb978d9fd" length="100" type="Sim" typeParam2="light_open" typeParam="AutoPlay" />
    <PartInfo>
        <Name>light_open</Name>
        <AnimLength>100</AnimLength>
        <Animation>
            <Parameter>
                <Code>
                   (L:switch_light_open,bool) (A:ELECTRICAL MAIN BUS VOLTAGE, volts) 5 &gt; * 100 *
                </Code>
                <Lag>50</Lag>
            </Parameter>
        </Animation>
    </PartInfo>

1) It's best to multiply the input variable for an animation with the animation length. So if the animation evaluates to "1", you'll get 1*50 = keyframe 50 as a result.
2) "TooltipID" only works for hardcoded default tooltips. For everything else, you'll need "TooltipText". I've also added an example for implementing a conditional display of strangs.
3) When a light or variable requires electricity, it's best to check for voltage instead of the standard battery switch. That way, the light will operate independent of the battery (e.g. with engine generators running).
4) The light animation for the external model evaluates to 1*1*100 = keyframe 100 when both conditions are true.

And L: vars are shared across the entire model and even multiplayer (or shared cockpit).
 
It works! Thank you so much!:D

Next on this example I'll try with other details, in view of what you said
 
Yesterday was try to add engine starters to the VC. Add switch with variable GENERAL ENG STARTER and lever GENERAL ENG FUEL VALVE - everything is great, engine is starting up.;-) and I don't need to use mixture (don't know why, but fact). But I have a question... Is there have a variable for emergency cutoff lever? I can't see nothing. For example, when engine on fire, turning off lever for it switching off valve, pumps and bleed of this engine?!
And once more. When default starter is off? I need for light "starter on" off at 51% N2. Did I need to add condition for it or have a something default var?
Thanks! Your help makes the model better.
 
Look here for the "EXTINGUISH_ENGINE_FIRE" event:
https://msdn.microsoft.com/en-us/library/cc526980.aspx

No starter light, you need to write code for it. Condition for engine 1:
Code:
(A:GENERAL ENG STARTER:1,bool) (A:TURB ENG N2:1,percent) 51&lt; and



Mixture is only a problem if a user has a default flight in which the mixture is at 0%. That setting will be inherited by your model, therefor it is preferable to check the setting and set mixture to 100% if it is below 25%.
 
Mixture is only a problem if a user has a default flight in which the mixture is at 0%. That setting will be inherited by your model, therefor it is preferable to check the setting and set mixture to 100% if it is below 25%.

Or the user has hardware lever(s) for mixture that are set to 0%...

I just automatically add these commands to any initialization routine to be safe:
Code:
    16384 (>K:MIXTURE1_SET)
    16384 (>K:MIXTURE2_SET)
 
Of course if you want your pilots to set this properly *before* they start their engines, you will want to leave it up to them. :) But I agree I do add it to any "automatic start" cheat.
 
I was thinkin' about starter light, and understand - is wrong! I don't need to swithing off starter light when starter is off - I need to swithing off starter and light will be turning off too. Else light is off. but starter is staying on.
It's will be like this:
Code:
(A:GENERAL ENG STARTER:1,bool) if{ 1 (>K:KEY_TOGGLE_STARTER1,bool) (A:TURB ENG N2:1,percent) 51&lt; and} els{ 0 (>K:KEY_TOGGLE_STARTER1,bool) }
Is that will be correct? When turning on starter switch it will be switching on and engine will be starting until N2 = 51% then starter switch is turned off automaticly.
Or not? It's incorrect?! will be: if key toggle starter on and N2 51% and below general engine starter will be on, else is off. Yes?
 
Last edited:
Of course if you want your pilots to set this properly *before* they start their engines, you will want to leave it up to them. :) But I agree I do add it to any "automatic start" cheat.

Only in piston engines. Mixture in jets is always automatic.
 
Back
Top