FS2004 Proper use of <delta> (SOLVED)

#1
Good evening folks

I am trying to implement a custom animation for a collective and some levers with draggable features. From the MkMDL.parts.xml file, I've seen several times <delta>VALUE</delta>; however, I know nothing about it. I did a simple search for <delta> in the Gauges forum, but no luck so far...

a) What is it for?
b) How does it work?
c) This parameter is relevant in the task at hand?

I am a bit stuck here, any help will be highly appreciated!
In advance, thank you.
Sergio.
 
#2
Hey Sergio,
I use custom animations for my dragable-lever-code. As an example, here's a "vacuum source selector" off my Lockheed Vega:
Code:
  <PartInfo>
    <Name>lever_vac_selector</Name>
    <AnimLength>100</AnimLength>
    <Animation>
      <Parameter>
        <Code>
          (L:LEVER VACUUM SELECTOR POS,number) 0 max 100 min
        </Code>
      </Parameter>
    </Animation>

    <MouseRect>
      <Cursor>Hand</Cursor>
      <MouseFlags>LeftSingle+LeftDrag+LeftRelease+WheelUp+WheelDown</MouseFlags>
      <CallbackCode>
        (M:Event) 'LeftSingle' scmp 0 ==
        if{
          (M:X) (&gt;L:MOUSEPOSX,number)
          quit
        }

        (M:Event) 'LeftDrag' scmp 0 ==
        if{
          (M:X) (L:MOUSEPOSX,number) - (&gt;L:MOUSEPOSDELTA,number)
          (M:X) (&gt;L:MOUSEPOSX,number)

          (L:LEVER VACUUM SELECTOR POS, number) (L:MOUSEPOSDELTA,number) 0.7 * + 0 max 100 min (&gt;L:LEVER VACUUM SELECTOR POS, number)
        }

        (M:Event) 'LeftRelease' scmp 0 ==
        if{
          (L:LEVER VACUUM SELECTOR POS,number) 25 &lt;
          if{
            0 (&gt;L:LEVER VACUUM SELECTOR POS, number)
          }
          els{
            (L:LEVER VACUUM SELECTOR POS,number) 75 &lt;
            if{
              50 (&gt;L:LEVER VACUUM SELECTOR POS,number)
            }
            els{
              100 (&gt;L:LEVER VACUUM SELECTOR POS,number)
            }
          }
        }
       
        (M:Event) 'WheelUp' scmp 0 ==
        if{
          (L:LEVER VACUUM SELECTOR POS,number) 50 - 0 max (&gt;L:LEVER VACUUM SELECTOR POS,number)
        }
       
        (M:Event) 'WheelDown' scmp 0 ==
        if{
          (L:LEVER VACUUM SELECTOR POS,number) 50 + 100 min (&gt;L:LEVER VACUUM SELECTOR POS,number)
        }
       
        (L:LEVER VACUUM SELECTOR POS,number) 25 &lt;
        if{
          1 (&gt;L:VACUUM SOURCE SELECTOR,enum)
        }
        els{
          (L:LEVER VACUUM SELECTOR POS,number) 75 &lt;
          if{
            3 (&gt;L:VACUUM SOURCE SELECTOR,enum)
          }
          els{
            2 (&gt;L:VACUUM SOURCE SELECTOR,enum)
          }
        }
       
      </CallbackCode>
      <TooltipText>Vacuum source selector - %((L:VACUUM SOURCE SELECTOR,enum))%{case}%{:0}not connected%{:1}Venturi%{:2}Vacuum pump%{:3}off%{end}</TooltipText>
    </MouseRect>
  </PartInfo>
This lever has "snap-to" positions, so when you let go of the lever, it snaps in the position that is closest. The LEVER VACUUM SELECTOR POS variable is purely for animation and user interface purposes. The actual state of the system is represented by the LEVER VACUUM SELECTOR variable, which is declared enum.

Depending on you animation, you can tweak the responsiveness by changing the 0.7 in the LeftDrag part of the code.
 
#3
Hello Vitus!

Thank you for your help, very much appreciated. I will test it, with your permission of course!
However, the questions regarding <delta>VALUE</delta> still remain. :duck: :duck: :duck:

Cheers,
Sergio.
 
#4
Gosh, of course you have permission, otherwise I wouldn't post it here :rotfl:
Btw. this is fsx code, not quite sure how it ports to fs9....
 

n4gix

Resource contributor
#6
Good evening folks

I am trying to implement a custom animation for a collective and some levers with draggable features. From the MkMDL.parts.xml file, I've seen several times <delta>VALUE</delta>; however, I know nothing about it. I did a simple search for <delta> in the Gauges forum, but no luck so far...
Sergio.
Sergio, <delta> is the "rate of change" when a <CallbackJumpDragging> operation is being scripted. In the example below, the rate of increase/decrease is defined by the <delta>value</delta>, which in this case is 10 screen pixels:

Code:
  <PartInfo>
    <Name>switch_ignition_magnetos</Name>
    <AnimLength>100</AnimLength>
    <Animation>
      <Parameter>
        <Code>(A:OLD ENG STARTER:1, enum) 0 max 4 min 25 *</Code>
        <Lag>200</Lag>
      </Parameter>
    </Animation>
    <MouseRect>
      <Cursor>Hand</Cursor>
      <HelpID>HELPID_GAUGE_MAGNETO_SWITCH</HelpID>
      <TooltipID>TOOLTIPTEXT_MAGNETO_SWITCH</TooltipID>
      <MouseFlags>LeftSingle+LeftDrag+Wheel</MouseFlags>
      <CallbackJumpDragging>
        <XMovement>
          <Delta>10</Delta>
          <EventIdInc>MAGNETO_INCR</EventIdInc>
          <EventIdDec>MAGNETO_DECR</EventIdDec>
        </XMovement>
      </CallbackJumpDragging>
    </MouseRect>
  </PartInfo>
 
#7
Sergio, <delta> is the "rate of change" when a <CallbackJumpDragging> operation is being scripted. In the example below, the rate of increase/decrease is defined by the <delta>value</delta>, which in this case is 10 screen pixels:
Dear Fr. Leaming, as always, thank you very much for sharing your knowledge with us.

You are incredible Sr.
Kindest regards,
Sergio.
:)
 
Top