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

Variable increment/decrement rate

JB3DG

Resource contributor
Messages
1,325
Country
southafrica
Can anyone tell me how to recreate that phenomena that you get when scrolling through lets say the heading bug and if you click/scroll rapidly it suddenly starts making bigger jumps? I want to do the same for a custom trim system using custom events. Any ideas?
 
Also, I found an ingenious way to be able to have double speed and single speed on settings.

Put a 10, or 100, or 1000 in front of the command K:string to cause a 'measured' amount of input. You can do this with altitude, works great. You would need dual clickzones for hundreds and thousands.


But with heading, the coolest thing is mouse wheel. Dials very swiftly.
 
err...im using actual inc/dec events which cannot be set. And yes this is using the mouse wheel as well. the inc/dec rate changes dynamically. I need to know how to do that.
 
Some should work with the dec/inc commands ..(not tested all) If so, they can take a value prior..

This works.. FS always sets Radio Alt Decision Height @ 200 ft. on load..

In an initialization --

(G:Var1) 0 = if{ 200 (>K:DECREASE_DECISION_HEIGHT) 1 (>G:Var1) }

= 0

Roman
 
Last edited:
This goes beyond what XML can do. Im actually not even sending the event to FSX but intercepting it with Simconnect and making it change my own variable in C++. So fixed inc/dec rates like += 200 or -= 10 are useless. As i said previously, this is DYNAMIC. Ie key event doesnt change. I will describe what happens again. Go into one of your aircraft that has a autopilot and rapidly scroll using the mouse wheel through the heading bug setting. It will initially start incrementing with small increments but as you carry on rapidly scrolling it suddenly starts changing with much bigger increments. Then stop for a moment and start scrolling with your mouse wheel again. The increments will be small again. That is what im trying to achieve.
 
If I understand your needs, souldn't be difficult to code a polinomial that links inc/dec event rate of change in secs (1/4,1/2,1,etc) and rate of inc/dec of your custom variable. You can use Excel or any other spreadsheet to obtain the polinomial's formula, and then past it to your code.
And it can be developed in C++ or XML.

Tom
 
hmm...new term polinomial. I think i heard it before in a math class....can you elaborate a bit for me here please?
 
See the attached .jpg as an example.
You build the table in Excel, select all the fields then Insert graph, choose any style with lines, then add a polinomial line of 2/3/n order depending on the complexity of the relationships. Finally the formula returned by the spreadsheet is translated to C/XML code and used in the calcs.
Not always you will get an acceptable R index (the closer to 1 the better); in those cases you will have to "manually" calculate the Y values between the X fields.

Tom
 

Attachments

  • polinomial.jpg
    polinomial.jpg
    32.5 KB · Views: 524
Surely in order to use the mouse wheel you would need to handle mouse wheel events. and respond to those?ction (toward the user).
 
Thanks a bunch Tom. Ugh....timers again...Any other timer systems that you use aside from FSX timer vars that may be easier to handle?

@mgh This isnt about the mouse events. This is a bit deeper. Read my above replies.
 
I misunderstood

..actually not even sending the event to FSX but intercepting it with Simconnect and making it change my own variable in C++.

What is it you are actually intercepting?
 
key events. Just like the events that increment trim or autopilot heading/speed/altitude values. But everything that im doing is custom stuff. Custom trim, custom autopilot the works. However since i want to use default key events to make hardware integration easier I am needing this variable increment/decrement rate. There are some things (like the trim in particular) that i am masking from being sent to FSX so FSX doesnt interfere with my systems. Anyways Tom has answered my question. Now i just have to figure out simpler solutions for timers....
 
Last edited:
Here is a sample from COBS and it uses @PLUS and @Minus. I want something like this for my custom lvar with -- max and ++ min can't get nothing to work.
Tried a few methods like below with no luck.

(L:custom,number) @Minus - 100 max (>L:custom,number)
(L:custom,number) @PLUS + 100 min (>L:custom,number)

(L:custom,number) -- @Minus100 max (>L:custom,number)
(L:custom,number) ++ @PLUS100 min (>L:custom,number)

Code:
        <!--ALT SET-->
<Macro Name="Plus1000">
(A:AUTOPILOT ALTITUDE LOCK VAR,feet) 1000 +
</Macro>

<Macro Name="Minus1000">
(A:AUTOPILOT ALTITUDE LOCK VAR,feet) 1000 -
</Macro>

<Macro Name="Button1">(M:Event) 'RightSingle' scmp 0 == if{ (>K:AP_ALT_VAR_INC) }
        (M:Event) 'LeftSingle' scmp 0 ==  if{ (>K:AP_ALT_VAR_DEC) }
        (M:Event) 'WheelUp' scmp 0 == if{ @Plus1000 (>K:AP_ALT_VAR_SET_ENGLISH) }
        (M:Event) 'WheelDown' scmp 0 == if{ @Minus1000 (>K:AP_ALT_VAR_SET_ENGLISH) }</Macro>
    <Area Left="171" Top="62" Width="60" Height="25">
  <Tooltip>Set ALT</Tooltip>
  <Click Kind="LeftSingle+RightSingle+WheelUp+WheelDown" Repeat="Yes">@Button1</Click>
  <Cursor Type="Hand" />
  </Area>
 
Try this and see if it works,
Code:
(A:AUTOPILOT ALTITUDE LOCK VAR,feet) (L:custom,number) ++ @PLUS100 min (>L:custom,number)
 
This is my crude contribution. It relates to a yellow pointer as part of the underwing refuelling dials. The yellow pointer is set to the required quantity and the fuel uplift cuts off when the white needle reaches it.
To set the yellow pointer a knob is turned (see second bit of code). I added a multiplier of 1.03 so that the more mouse input the faster the yellow needle rotates. It's crude but it works!!
Code:
<Element>
      <Position X="103" Y="102"/>
      <Image Name="ext_needle_fuel_yellow.bmp" Luminous="1" PointsTo="North">
         <Axis X="13" Y="81"/>
      </Image>
      <Rotate>
         <Value>(L:T1a,number)</Value>
         <Nonlinearity>
            <Item Value="0" X="74" Y="178"/>
            <Item Value="3000" X="102" Y="18"/>
            <Item Value="6000" X="130" Y="175"/>
         </Nonlinearity>
         <Delay DegreesPerSecond="20"/>
      </Rotate>
   </Element>


<Mouse>
<Tooltip>Fuel Set Knob Tank 1a (%((L:fuelL_in_kilos,number) 21.43 * 100 / )%!d!) kgs</Tooltip>
      <Area Left="0" Top="0" Right="10" Bottom="14">
      <Cursor Type="DownArrow"/>
      <Click Repeat="Yes">(L:T1a,number) 10 &gt; if{ (L:T1a,number) 1.03 / -- (&gt;L:T1a,number) (L:T4a,number) 1.03 / -- (&gt;L:T4a,number) } </Click>
      </Area>
      <Area Left="11" Top="0" Right="21" Bottom="14">
      <Cursor Type="UpArrow"/>
      <Click Repeat="Yes">(L:T1a,number) 6000 &lt; if{ (L:T1a,number) 1.03 * ++ (&gt;L:T1a,number) (L:T4a,number) 1.03 * ++ (&gt;L:T4a,number) } </Click>
      </Area>
   </Mouse>
 
Lol I kind of forgot about this thread....I resorted to using the timer function that I posted in the wiki (See C++ timers) and a variable increment rate that gets multiplied a bit each time the event is fired if the delta_t between event firings is low enough. That solved my problem.
 
Back
Top