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

Another spoiler question

GOT iT!!!

Code:
<Macro id="SpoilerPctToRadiansConversion" Name="SpoilerPctToRadiansConversion">
            <MacroValue>@ASZdivby100xPreviousSpoiler @InActiveSpoilerZone +</MacroValue>
            <Macro id="ActiveSpoilerZone" Name="ActiveSpoilerZone">
                <MacroValue>11632</MacroValue>
            </Macro>
            <Macro id="ASZdivby100" Name="ASZdivby100">
                <MacroValue>@ActiveSpoilerZone 100 /</MacroValue>
            </Macro>
            <Macro id="ASZdivby100xPreviousSpoiler" Name="ASZdivby100xPreviousSpoiler">
                <MacroValue>@ASZdivby100 (L:SPOILERS_POSITION_PREVIOUS,number) *</MacroValue>
            </Macro>
            <Macro id="InActiveSpoilerZone" Name="InActiveSpoilerZone">
                <MacroValue>4751</MacroValue>
            </Macro>
        </Macro>
        <Update id="Update">
            <Script>  
(A:Spoilers Left Position,position) 0.25 &gt;  (A:Spoilers Right Position,position) 0.25 &gt;  ||  (A:AIRSPEED INDICATED,knots) 345 &lt; &amp;&amp;  if{ (A:Spoilers Left Position,position) (A:Spoilers Right Position,position) + 2 / (&gt;L:SPOILERS_POSITION_PREVIOUS,number) }

(A:Spoilers Left Position,position) 0.25 &gt;  (A:Spoilers Right Position,position) 0.25 &gt; || (A:AIRSPEED INDICATED,knots) 345 &gt;= &amp;&amp;   if{ 7659 (&gt;K:SPOILERS_SET) }       (A:Spoilers Left Position,position) 0.25 == (A:Spoilers Right Position,position) 0.25 == || (A:AIRSPEED INDICATED,knots) 345 &lt; &amp;&amp;   if{ @SpoilerPctToRadiansConversion (&gt;L:SPOILERS_SET,number)  (L:SPOILERS_SET,number) (&gt;K:SPOILERS_SET) }</Script>
        </Update>

This script does what you want it to the spoilers, does not flood (won't continuously set the spoiler ), it also returns the spoilers to their original position if they were above the limit once falling below the restricting speed, if the limiting speed was reached with the spoilers extended past 25 %.

This was more complicated than it should have been.
It was a math issue, this was tricky to figure out.
Spoiler handle position is measured in % and can only be set in values similar to radians " 0 - 16383 ", but don't forget, autospoiler is set at 29 % lever position, so this is really zero for the actual spoilers, so it works out that the ( K : Spoilers Set ) of 7659 = 25 % spoilers extended, before we were setting the spoiler lever pos to 25 %, anything 29 % and down is zero spoilers.
The equation in the macros above is:
16383 / 100 = 163.83
163.83 * 29 = 4751.07 This = 29 % spoilers_set = autospoilers set = 0 % extended.
16383 - 4751.07 = 11631.93 this is your active spoiler zone
11631.93 / 100 = 116.3193 value 1 % of spoiler set
116.3193 * (A:Spoilers Left Position,position) or (A:Spoilers Right Position,position) "no other variables measure actual spoiler position except these" = value of active within spoiler range.
Value of active spoiler in active spoiler range + inactive spoiler value (4751.07) = value you use to set spoiler handle for the desired ( > K : Spoiler_SET )
I could not get the script right in the update when trying to do this without macros. Keeps the update shorter and simpler anyway too so what the hey.
I had this in mind earlier but posted the suggested codes incorrectly upon speculation, with some trial and error I've figured out what actually works. This code in this post is it. Funk Out With the flexibility and possibility of this script "hint", Elaborate... ENJOY
 
Last edited:
Thanks for that though it does seem a bit complex!!
The solution I use is below and does what is wanted. It does not seem to have any adverse affect on the sim.
vololiberista
Code:
<Update>
(A:SPOILER HANDLE POSITION,position) 4097 &gt; (A:AIRSPEED INDICATED,Knots) 345 &gt; AND if{ 4096 (>K:SPOILERS_SET) }
</Update>
 
Thanks for that though it does seem a bit complex!!
The solution I use is below and does what is wanted. It does not seem to have any adverse affect on the sim.
vololiberista
Code:
<Update>
(A:SPOILER HANDLE POSITION,position) 4097 &gt; (A:AIRSPEED INDICATED,Knots) 345 &gt; AND if{ 4096 (>K:SPOILERS_SET) }
</Update>

You are more than welcome, the code you are using will set the spoiler handle position to 25 % indeed, if the aircraft has autospoiler's (and maybe even if it doesn't ) actual spoiler extended position is still zero up to 29 % spoiler handle position, and to set spoilers extended position to 25 %, the K : Spoilers_set value would be 7659, now that you say your code is working for you, makes me want to test this on an aircraft with no autospoilers available to see if it's a different scenario. If you get back to this thread let me know if your aircraft has "autospoilers_available=1 or 0" in the .cfg I would appreciate it. I have learned great things from this interesting thread you have started here, and for that sir I thank you.

Joe
 
My a/c doesn't have autospoilers, but you can see here in the code what elements work.
In addition to normal manuel operations, the spoilers "blow back" to 25deg in an overspeed condition if they are already extended. And, if not extended they raise to 25deg.
For me this is sufficient seeing as the pilot should never get near the trigger speed!!!!!
vololiberista
Code:
<Gauge Name="Spoiler Lever" Version="1.0">
<Image Name="Spoiler_Background.bmp"/>
<Update Frequency="3"/>
<Update>
(A:SPOILER HANDLE POSITION,position) 4097 &gt; (A:AIRSPEED INDICATED,Knots) 345 &gt; AND if{ 4096 (>K:SPOILERS_SET) }
</Update>
<Element>
	<Position X="0" Y="0"/>
	<Select>
         <Value>(A:Spoilers handle position, position) 0 max 1 min 9 * near 1 +</Value>
         <Case Value="1">
            <Image Name="Spoiler1.bmp"/>
         </Case>
         <Case Value="2">
            <Image Name="Spoiler2.bmp"/>
         </Case>
         <Case Value="3">
            <Image Name="Spoiler3.bmp"/>
         </Case>
         <Case Value="4">
            <Image Name="Spoiler4.bmp"/>
         </Case>
         <Case Value="5">
            <Image Name="Spoiler5.bmp"/>
         </Case>
         <Case Value="6">
            <Image Name="Spoiler6.bmp"/>
         </Case>
         <Case Value="7">
            <Image Name="Spoiler7.bmp"/>
         </Case>
         <Case Value="8">
            <Image Name="Spoiler8.bmp"/>
         </Case>
         <Case Value="9">
            <Image Name="Spoiler9.bmp"/>
         </Case>
         <Case Value="10">
            <Image Name="Spoiler10.bmp"/>
         </Case>
      </Select>
</Element>

<Mouse>
	<Help ID="HELPID_GAUGE_SPEED_BRAKE"/>
	<Tooltip ID="TOOLTIPTEXT_SPEED_BRAKE"/>
	<Cursor Type="Hand"/>
	<Click Kind="LeftSingle+LeftDrag">(M:Y) 0 - 136 / 0 max 1 min  16384 * (&gt;K:SPOILERS_SET)</Click>
</Mouse>
</Gauge>
 
Hello Vololiberista! I see your post and I want to use this code in my p3d.

<Update>
(A:SPOILER HANDLE POSITION,position) 4097 &gt; (A:AIRSPEED INDICATED,Knots) 345 &gt; AND if{ 4096 (>K:SPOILERS_SET) }
</Update>

I write this in a new file (spoilers.xml) but in flight nothing happens. Why?

Would you give me any idea?

Thank you very much

Rubén
 
Code:
<Gauge>
<Update>
(A:SPOILER HANDLE POSITION,position) 4097 &gt; (A:AIRSPEED INDICATED,Knots) 345 &gt; AND if{ 4096 (>K:SPOILERS_SET) }
</Update>
</Gauge>
 
Back
Top