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

Su26: Gauges not working

Messages
167
Country
netherlands
Hello guys,

I've made this thread because I feel I'll get a lot of questions. (Especially because I have no experience in XML-coding and I have complex gauges like the Aspen 1000).

Question 1: What is wrong with this code:
Code:
<Animation name="Su26_needle_rpm" guid="a5a4f839-fda7-4857-121d-e6ce397665b9"
type="Sim" typeParam="AutoPlay" typeParam2="Su26_needle_rpm" length="62"/>

<PartInfo>
    <Name>Su26_needle_rpm</Name>
    <AnimLength>62</AnimLength>
    <Animation>
      <Parameter>
        <Code>(A:GENERAL ENG RPM:1, rpm) (1 / 50) *</Code>
      </Parameter>
    </Animation>
    <MouseRect>
      <TooltipID>TOOLTIPTEXT_RPM</TooltipID>
    </MouseRect>
  </PartInfo>
The needle doesn't move in FSX (has an animation tag and an animation).

Question 2:
What is wrong with this code:
Code:
<Animation name="needle_asi_Su26" guid="fc746d67-e72d-4693-9214-9d5d80a4f31b"
type="Sim" typeParam="AutoPlay"  length="200" typeParam2="needle_asi_Su26" />

<PartInfo>
    <Name>needle_asi_Su26</Name>
    <AnimLength>200</AnimLength>
    <Animation>
      <Parameter>
        <Sim>
          <Code>(A:AIRSPEED INDICATED, kph) (1/2.25) *</Code>
        </Sim>
      </Parameter>
    </Animation>
    <MouseRect>
      <TooltipID>TOOLTIPTEXT_AIRSPEED_KPH</TooltipID>
    </MouseRect>
  </PartInfo>
Same problem as the first one.

Question 3:
And.... this code:
Code:
 <Code>(A:RECIP ENG CYLINDER HEAD TEMPERATURE:1, celsius) .5 * 25 +</Code>
The 2D Extra 300s panel says 68 degrees Celsius, my 3D Sukhoi says +- 5 degrees Celsius (keyframe 26/27)

Question 4:
I have 2 G-meters, each with their own reset button. But how can I make each button reset only the G-meter to which it belongs? Now they reset both G-meters :(

Lots of questions, probably lots to come. I hope you guys don't care and are willing to help me.

Cheers,
Daniël
 
Gauge code does not support parenthesis.

1)
Code:
<Animation name="Su26_needle_rpm" guid="a5a4f839-fda7-4857-121d-e6ce397665b9" type="Sim" typeParam="AutoPlay" typeParam2="Su26_needle_rpm" length="62"/>

<PartInfo>
<Name>Su26_needle_rpm</Name>
<AnimLength>62</AnimLength>
<Animation>
<Parameter>
<Code>(A:GENERAL ENG RPM:1, rpm) 50 /</Code>
</Parameter>
</Animation>
<MouseRect>
<TooltipID>TOOLTIPTEXT_RPM</TooltipID>
</MouseRect>
</PartInfo>

2)
Code:
<Animation name="needle_asi_Su26" guid="fc746d67-e72d-4693-9214-9d5d80a4f31b" type="Sim" typeParam="AutoPlay" length="200" typeParam2="needle_asi_Su26" />

<PartInfo>
<Name>needle_asi_Su26</Name>
<AnimLength>200</AnimLength>
<Animation>
<Parameter>
<Sim>
<Code>(A:AIRSPEED INDICATED, kph) 2.25 /</Code>
</Sim>
</Parameter>
</Animation>
<MouseRect>
<TooltipID>TOOLTIPTEXT_AIRSPEED_KPH</TooltipID>
</MouseRect>
</PartInfo>

3)
Code:
<Code>(A:RECIP ENG CYLINDER HEAD TEMPERATURE:1, celsius) 0.5 * 25 +</Code>

Why the 25 keyframe offset?


4)
Make a custom animation using L:vars for each g meter. You need one variable for maximum g and one for minimum g, so four variables altogether.

Note: I'm too lazy to check whether the A: var is correct or not, so you have to do that yourself.

Code for a controller*.
Code:
(A:Gforce, geforce) (L:Maximum G 1, number) &gt;
if{ (A:Gforce, geforce) (>L:Maximum G 1, number)  }
(A:Gforce, geforce) (L:Minimum  G 1, number) &lt;
if{ (A:Gforce, geforce) (>L:Minimum  G 1, number)  }

(A:Gforce, geforce) (L:Maximum G 2, number) &gt;
if{ (A:Gforce, geforce) (>L:Maximum G 2, number)  }
(A:Gforce, geforce) (L:Minimum  G 2, number) &lt;
if{ (A:Gforce, geforce) (>L:Minimum  G 2, number)  }

Have the L: vars drive the animation of the corresponding needle for maximum and minimum Gs.

The reset button simply resets both needles to the current G force.
Code:
(A:Gforce, geforce) d (>L:Maximum G 1, number) (>L:Minimum  G 1, number)
and
Code:
(A:Gforce, geforce) d (>L:Maximum G 2, number) (>L:Minimum  G 2, number)



*Lower half of my post: http://fsdeveloper.com/forum/threads/case-in-eventid.436185/#post-732688
 
@Heretic thanks for your reply.
For 1 and 2, it explanes it all.
3) The cylinder temperature indicator can go negative, but now you mention it, I start wondering if it is necessary.
4) I'll try this, altough I do not understand totally the way L:vars works.
 
3) The cylinder temperature indicator can go negative, but now you mention it, I start wondering if it is necessary.

You can assign a lower limit.

Code:
<Code>(A:RECIP ENG CYLINDER HEAD TEMPERATURE:1, celsius) 0.5 * (A:AMBIENT TEMPERATURE, celsius) max</Code>

In this case, the CHT won't fall below the ambient temperature (check the variable name before using it!).
The "max" denotes a lower limit in FSX gauge code. Don't ask my why it is that way. ("Min" would specify an upper limit.)

4) I'll try this, altough I do not understand totally the way L:vars works.

L: vars are simply custom variables. They won't directly interact with FSX, but they are useful for storing values.
 
Finally found some time to try these codes. The airspeed indicator and RPM indicator are moving (although there was another fault in the airspeed code: the '<sim> and \<sim> part shouldn't be there ;)
However, maybe a dumb question, but what should this code be to get a moving needle?
Code:
<PartInfo>
    <Name>Su26_needle_G1_min</Name>
    <AnimLength>6</AnimLength>
    <Animation>
      <Parameter>
        <Code>(A:G FORCE, Gforce) (L:Minimum G 1, number) &lt;
        if{(A:G FORCE, Gforce) (>L:Minimum G 1, number)} -1 * 1 +</Code>
      </Parameter>
    </Animation>
  </PartInfo>
I don't know if the code is written as it should be?

Thanks in advance!
Cheers, Daniël
 
You need an els{} statement. And more spaces.
Code:
<PartInfo>
<Name>Su26_needle_G1_min</Name>
<AnimLength>6</AnimLength>
<Animation>
<Parameter>
<Code>(A:G FORCE, Gforce) (L:Minimum G 1, number) &lt;
if{ (A:G FORCE, Gforce) (>L:Minimum G 1, number) } els{ (L:Minimum G 1, number) } -1 * 1 +</Code>
</Parameter>
</Animation>
</PartInfo>
 
Thanks, the accelerometers are working.
Unfortunatelly, your code for the reset buttons doesn't work. Do you maybe know why?
Code:
<PartInfo>
    <Name>Su26_switch_G1_reset</Name>
    <AnimLength>100</AnimLength>
    <Animation>
      <Parameter>
        <Code>(A:G FORCE, Gforce) d (>L:Maximum G 1, number) (>L:Minimum G 1, number)</Code>
        <Lag>400</Lag>
      </Parameter>
    </Animation>
    <MouseRect>
      <Cursor>hand</Cursor>
      <HelpID>HELPID_EXTR_G_METER_RESET</HelpID>
    </MouseRect>
  </PartInfo>

Also, is it possible to 'paste' a 2D gauge on a 3D model? I hope I can use a 2D GPS gauge on my 3D Garmin 430 (on pic just with texture)
FSX_SU26_GPS1.jpg


Thanks,

Daniël
 
Last edited:
Try another d in the code line?

Sure you can do that - that's what non 3D VC's do. You add the gauge to the VCockpit01 (etc.) section of the panel.cfg file and set up that polygon as a 2D gauge poly.
 
Thanks, the accelerometers are working.
Unfortunatelly, your code for the reset buttons doesn't work. Do you maybe know why?
Code:
<PartInfo>
    <Name>Su26_switch_G1_reset</Name>
    <AnimLength>100</AnimLength>
    <Animation>
      <Parameter>
        <Code>(A:G FORCE, Gforce) d (>L:Maximum G 1, number) (>L:Minimum G 1, number)</Code>
        <Lag>400</Lag>
      </Parameter>
    </Animation>
    <MouseRect>
      <Cursor>hand</Cursor>
      <HelpID>HELPID_EXTR_G_METER_RESET</HelpID>
    </MouseRect>
  </PartInfo>

This has no chance of working properly because the code for actually resetting your needles belong in a mouserect and not into the animation line.


Code:
<PartInfo>
    <Name>Su26_switch_G1_reset</Name>
    <AnimLength>100</AnimLength>
    <Animation>
      <Parameter>
        <Code>(L:G_reset, number) (P:local time, seconds) &gt; if{ 100 } els{ 0 }</Code>
        <Lag>400</Lag>
      </Parameter>
    </Animation>
    <MouseRect>
      <Cursor>hand</Cursor>
      <HelpID>HELPID_EXTR_G_METER_RESET</HelpID>
      <CallbackCode>(A:G FORCE, Gforce) d (>L:Maximum G 1, number) (>L:Minimum G 1, number) (P:local time, seconds) 0.5 + (>L:G_reset, number)</CallbackCode>
    </MouseRect>
  </PartInfo>


The time related part is used to make the button pop out again after you press it. Most of this is straight from a bog standard Modeldef.xml, btw.



Also, is it possible to 'paste' a 2D gauge on a 3D model? I hope I can use a 2D GPS gauge on my 3D Garmin 430 (on pic just with texture)

Define a gauge poly and assign the GPS gauge to it.

https://msdn.microsoft.com/en-us/library/cc526974.aspx#Gauges
 
I'm sorry, I didn't know. Next time I'll take a closer look ;)
BTW, just for me to understand this algebra a bit more, what does the if{ 100 } els{ 0 } do?

Can I use a existing gauge (like the GNS430 on this site: http://www.fs2x.com/Freeware.htm) or should I use my own textures?

Sorry if the questions are a bit dumb, but they say you can better ask 1 question too much than 1 too little :confused:
 
Last edited:
You can also do 1 trial&error or 1 research more than asking 1 question. ;)

The animation length is 100 and the if-else statement simply says that the animation is to be displayed at keyframe 100 as long as the G reset variable is larger than the local time.

And of course you can use a custiom gauge.
 
I did today, and found out that it should be:
Code:
<Code>(L:G_reset)....
(>L:G_reset)</CallbackCode>
And the GPS worked as well. Okay, the screen was still black, but I got the GPS lay-out on my 3D mesh :)
Although, I don't know at this point how I'm going to make the textures suit my model, because the textures aren't the right dimensions compared to the real Garmin ;(
I think I have two options:
1) Make my own textures, with the same size as the original ones and fit my UV on it.
2) Use the original ones and try to fix the UV
[3) Use my textures and edit the XML, but that is way too much work and I'm limited in what I can do now]

Thanks anyway!
 
The gauge polygon can be any size you want, but the gauge itself will turn out distorted. Since you do not have any other options, stick to the GNS540's layout and maybe put it someplace else on the panel.
 
It became a combination, and I think it lookt quite pretty :)
Of course, I have to edit the pictures of the turning knobs, and make some small adjustments like the locations of some knobs, but it doesn't make me unhappy with my result now.
FSX_Su26_GPS2.jpg
 
Hi everyone

I've been busy in real life, but now I'm trying to get back on track (slowly ;) ). So I tried some coding for the radio, which works now almost correct. However, I have 1 problem. I don't want the screen to be on when the power-switch isn't set to on. So I thought I had to do something with a L:anyrandomname.
Code:
    <Element>
        <Position X="86" Y="360"/>
        <Select>
            <Value>(L:Su26BeckerOnOff,bool)</Value>
            <Case Value="0">
                <Image Name="Su26BeckerOff.bmp"/>
            </Case>
            <Case Value="1">
                <Image Name="Su26BeckerOn.bmp"/>
            </Case>
        </Select>
    </Element>

    <Mouse>
     <Area Left="86" Right="184" Top="360" Bottom="458">
        <Cursor Type="Hand"/>
        <Click>(L:Su26Becker,bool)!(&gt;L:Su26Becker,bool)</Click>
     </Area>
    </Mouse>
<Element>
     <Visible>(A:ELECTRICAL MASTER BATTERY,BOOL) (L:Su26Becker,bool) and</Visible>
        <Element>
Blablabla

With this, the screen is off, so the visible part works. However, I can't hit the power-switch, so the screen won't turn on.
The radio works when I delete the whole L:Su26Becker part, but then the only way to get the power-switch turning is by let the battery-switch control it.
Does someone see the fault?

And the text doesn't have the dimensions it should have, when I compare the sim together with the background + text with the same height.
fTJDZDNFpBmEM9apc9M7RieSw0BN-nBVu3R1BihcbuiEAsJyoAnBv-Kxwt-6svhPI1f0Z7M6t8dZnOOfyNbY-YLBefhfrtErY8K44Ps9W8H3nIvCo7vuPsSdePDwfSW_h_TNFkDO-RqrRz6EzCCuAkrqHpMwzbT1ZEP7PBW4CocqXKm2S29Qab5cGWJQH8X9kd-6KmP_8BtWJUH8W0zaYcAiLnKsb438eI8QwMuJiKrcjjkfR8cRN9fCg5cB2fv7eiTeXFN8aPr7EoyGMgJkQQaxtmfjvHU5N_gFfPAhYMLvp8WGs4jd9NB51aPRKaCIWoB2cP8qQmGr_Al46mXsDFd8XuJEGYjgYNdv3jkU_3h0mDu7ztarg1K6tEYBWrp-VsC_j6N7JrP7nrB2QGTe5mq-8sQkhko_5uQp5ztLgmKMjla1SGtINqI2uTQ3yTKqJusHSn1viMJofXEqFc53fTxSw5130ThNRIOc0QpoHwMp2ovfl2G7QQm8gq9pJzv0KeJ--btIgyy9R1K7vLNN4HUlwOFLRkMRlLbe8jfEn4A4AP8ysVEqhts9WTrS-c_AEvtcr05rZ41kk79DpsX4NtErVqwbpapCY0Y29e8lZZyVhQd4=s512-no


px80oWRsUOeYevzddHJkY2Ajrm1soxoKHnnmQPxhUe2oAjObUOScuTU4aNlxHgit7z9zYZfku8EJM5EVGX4shLpNYKM547IXawmSO_HHspR194bWfbP1mOfZvRvqbMAr_FVVlzG70eyZFIJ0l0NEpU-bX0mttkzeKaWqXhilPN7tInllJK446js7776FB1FaWvOcGEXei5lvXiyJu7DKk9CqcnVAZY7hSyKKZM1G64VSvq8G8yZWBJrMqrxau6moPF5iWzxd3ZwvUHqPwTx32fj-ONUHfMbV_rD5vi2ns0PbF1sKshXysjDXAAGUmbcRRmeNW9ydiGaNdQvSQsxpJu4SeNLRVglT0ZlBGOHZmnOCPYdiyK-_pnswhV7QIN9me--NrAvRMx7e4XozYSDSX2sMjdp9gugX7PadMhyrs9lHPcqsf9I9Wjj_W2u5s4NAACp9zuPr-VvJs5Nznugj5E4cLmpWR0Oa5RuX6r2eg4mn7krNWiNlS9u-F0FphR1pBC-98WZ2CrwgkinIsREG8qPbRyhPKHoac6OxdCsRhYCw2ixnvRsWvL2r38GO6sytuCPQCO4Z2XOAMhnoV4Dhc1jGL-lmKGH1Zm8yHsy54j88xMbZ=w614-h489-no


Thanks in advance!

Cheers,
Daniël

PS: Is there a way to get the 3D knobs turning, while using this code?
 
Hi,

Your switch display is using an L: variable with OnOff in the name, while your mouse section is using a similar L: variable without those words. Can't expect a mouse section to control a completely different variable?

And yes, you can use very similar custom part XML code to control the 3D knob.
 
Back
Top