• 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

Messages
1,468
Country
italy
I have a gauge that raises and lowers the spoilers by degree. What I want to do is to introduce a limiting airspeed. If IAS is >345kts then either the spoilers will reduce (blow back) to 25% or not exceed 25%.
Can you suggest where I put my modification.
vololiberista
Code:
<Image Name="Spoiler_Background.bmp"/>

<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>
 
Well, it probably needs to go in an Update clause, where you check to see if the speed is above the limit, then lower the spoilers if needed. However, make sure you do not continuously fire key events all the time, as this causes big performance problems. Only fire the key events if needed to bring the spoilers down.
 
Can you explain a little about the click statement above?
In the gauge there are two areas
one controls the handle position. If I just change this then I still get 0%-100% but in a much smaller clickable area.
On the other hand the click statement just seems to control the spoiler extension. So I need to attack both areas.
What I'm after is:-
1. If spoilers extended beyond 25% and speed exceeds 345kts IAS then reduce spoilers to 25% and move handle to equivalent position.
2. If spoilers not extended and speed exceeds 345kts IAS prohibit any handle movement beyond the positon where it would normally produce a 25% value
and to produce a 25% value not 100%
vololiberista
 
No, it's easier than that. Just program the handle on the gauge to go 0-100, then leave it. Then program an Update clause that looks at the position of the spoilers and if needed, sets them back to 25%. The handle position and so on will update automatically, and if you try and drag beyond that, as soon as you let go the spoilers will be set back again.
 
You have a (M:Y) range of 136 pixels which should be the height of your mouse area. If it is not 136 pixels high then change 136 to whatever the height is. That way you will get the full range of selection.

Roy
 
I've tried using the update and it makes no difference.

Basically:-
if (A:Spoilers handle position, position) greater than 0
and (A:indicated airspeed) greater than 345 kts
then (A:Spoilers handle position, position) = 0.25 i.e. 25%

is what I want but everything I tried seemed to be ignored even though the update was at the top before the element!!!
vololiberista
 
You can NOT SET A:Vars. Period.

You MUST use the (>K:event) instead.
 
Sol - ved!
But I'm curious as to how or if as said above it can flood the system.
vololiberista
Code:
<Update>
(A:AIRSPEED INDICATED,knots) 345 &gt; if{ 4191 (>K:SPOILERS_SET) }
</Update>
 
Because that code you've just listed will flood the system with key events, sending one every single gauge update that the aircraft is over the speed listed. The spoilers should already by in the correct position unless moved, so before you send the key event, check to see if it actually needs to be sent.
 
If the code was standalone, as you go faster than 345 IAS, the flaps will go to 25% even if they were up below 345. Scary!

You had the logic right earlier, but the code wrong
Basically:-
if (A:Spoilers handle position, position) greater than 0
and (A:indicated airspeed) greater than 345 kts
then (A:Spoilers handle position, position) = 0.25 i.e. 25%
Code:
<Select>
	<Value>(A:SPOILER HANDLE POSITION,position) 0 &gt; (A:AIRSPEED INDICATED,Knots) 345 &gt; AND if{  4191 (>K:SPOILERS_SET) }</Value>
</Select>

That should achieve what you wanted.

Roy
 
Thanks Roy,
I'll try your code.
What I'm trying to simulate is as you say a little scary! That is above 345kts "blow back" if the poilers are out and refusal to extend beyond 25% at the same speed. Considering that 345kts is well in excess of Vno for the VC10 one should never be in that territory. Having said that the a/c is physically capable of very high mach numbers and indeed is still the fastest subsonic transport even today!
vololiberista
 
Code:
<Select>
	<Value>(A:SPOILER HANDLE POSITION,position) 0 &gt; (A:AIRSPEED INDICATED,Knots) 345 &gt; AND if{  4191 (>K:SPOILERS_SET) }</Value>
</Select>

That'll work, but it'll still flood the system with key events. You need to compare the spoiler handle position with, say 4192, not zero.

Think also about the following scenario - spoilers are set 10%, and we accelerate above 345 knots. The above code will then set the spoilers to 25%, when it should have left them. That's why you only need to move the spoilers if they are greater than 25% already. That also ensures it doesn't keep sending key events once the spoilers have been moved.
 
i don't know if this will work but try going into the aircraft.cfg file and changing the max spoiler speed. Try that.
 
FOJ,
Thanks, got it, should be
Code:
<Select>
	<Value>(A:SPOILER HANDLE POSITION,position) 4192 &gt; (A:AIRSPEED INDICATED,Knots) 345 &gt; AND if{  4191 (>K:SPOILERS_SET) }</Value>
</Select>

Roy
 
BASIC KEY EVENT Flooding Prevention.
----------------------------------------------

To prevent / reduce "key Event" flooding, always check if the current Variable value that you are going to change by the key Event, is at the SAME value as you are going to set it to.

If it is already at that value (or maybe Close enough to it), then do NOT send the Key Event that time.

------------

EVERY key event that is going to be sent, should first be checked to see if it is really necessary to send that event to change the variable.

AVOID code like

if (gear is up) then "Turn Landing_lights" OFF

Instead do

if ( ( gear is up) and (landing lights are ON) ) then "Turn Landing Lights" OFF

-----

A2A -- you reading this ????

Geoff
 
The single biggest culprit is the innocuous els{ xxx } condition!

Folks keep forgetting that the els{ do something } will ALWAYS be executed 18 times/sec whenever the if{ xxx } condition isn't being executed...

Instead of using an els{ xxx } statement, make it another if{ xxx } instead...

...or at the very least make it a conditional els{ xxx } statement!
 
Last edited:
Oh the pain. You've got me thinking about els{. How many times have I done that? A quick scan with ZTree tells me I have 1,357 xml files under /cabdir to look at ... :o
 
It's not a problem with the els statement, or any other statement for that matter, per se. It's the way people use them.

It's as with anything really - even the infamous GOTO statement is not that bad when used properly. It's just that having the GOTO statement encourages bad practice like nothing else, and everyone gets lax... Which is why no-one used GOTO anymore.
 
Back
Top