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

Animation that will loop 36 times?

Messages
10,163
Country
us-arizona
Hey all,


I have created a neat little 'emergency landing gear crank' system that has an appearence code, will crank the gear down, etc. But, it must be cranked/clicked 36 times to get the landing gear down.

I was curious, if there is a way to loop a command to function 36 times. Realizing that switches cycle 18 times a second, this would have to cycle every rotation of the crank.

Flowchart;
* Click on crank (has already appeared)
* Landing gear lever is toggled down
* Crank turns once, resets, turns again
* At turn 36, it stops, landing gear is down.


I need to also figure out a Y axis rotation, as the back and fourth motion isnt very realistic, lol... I am working on that.

Here is the code so far which includes the appearence code, but not a loop system as of yet.

Code:
<part>
   <name>ave_gearcrank_switch</name>
      <animation>
	<parameter>
	  <code>(L:AVEauxGEARcrankANIM, bool) 100 * </code>
 	  <lag>150</lag>
	</parameter>
      </animation>
   <mouserect>
	<cursor>Hand</cursor>
   <tooltip_text>Crank Down Landing Gear</tooltip_text>
   <callback_code>
               (L:AVEauxGEARcrankANIM, bool) ! (>L:AVEauxGEARcrankANIM, bool)
               (>K:GEAR_PUMP, bool) 
               1 (&gt;L:XMLSND73,enum)
   </callback_code>
   </mouserect>
</part>

<part>
  <name>lhc_aux_gearcrank_appear</name>
    <animation>
      <parameter>
        <code>
           (L:PUSHaveAUXgearCrank,bool) 10 *
        </code>
       <lag>100</lag>
      </parameter>
    </animation>
   <mouserect>
  <cursor>Hand</cursor>
 <tooltip_text>Fuselage Selector System (%((L:AVEgearCrank_DISPLAY,enum))%{case}%{:0}Emergency Gear Crank Socket)%{:1}Emergency Landing Gear Deployment Sys)%{End}</tooltip_text>
<mouse_flags>LeftSingle+LeftRelease</mouse_flags>
<callback_code>(M:Event) 'LeftSingle' scmp 0 == if{ (L:AVEgearCrank_DISPLAY,enum) 1 + 2 % (>L:AVEgearCrank_DISPLAY,enum) 1 (>L:XMLSND73,enum) 1 (>L:PUSHaveAUXgearCrank,bool) } (M:Event) 'LeftRelease' scmp 0 == if{ (>L:PUSHaveAUXgearCrank,bool) }</callback_code>
</mouserect>
</part>

<part> 
 <name>ave_gearcrank</name>
  <visible_in_range>
   <parameter>
    <code>(L:AVEgearCrank_DISPLAY,enum) 1 ==</code>
   </parameter>
    <minvalue>1</minvalue>
   </visible_in_range>
</part>
 
Why not just have the crank animation tied to the landing gear variable? Since the gear variable goes from 0 to 100 and you need 36 cranks the math should be easy if you animate the crank from 1 to 100.

Something like:

"If the landing gear variable starts changing, increment the crank animation variable by 36 x the landing gear variable. When the crank variable gets to 100, reset it to 0."

Hope this helps,
 
Ah, but what I want is a 'one click' and it starts working, making 36 clicks and rotations.

I tried the landing gear animation. that didnt work well.
 
All 36 cycles of the loop will take place within the same update cycle using labels and goto as demonstrated in the wiki. Pretty fast cranking. :duck:
 
Last edited:
Dang...

Who would have thought it would have been that easy, lololol... Dang..

I would need to figure out how to do a time element on it, so that perhaps it would pulse, like rotate, pause, rotate, pause, etc...

Shall be interesting.


Thanks Bill. So simple, I would have never got it.. arrgh...
 
Dang...

Who would have thought it would have been that easy, lololol... Dang..

I would need to figure out how to do a time element on it, so that perhaps it would pulse, like rotate, pause, rotate, pause, etc...

Shall be interesting.


Thanks Bill. So simple, I would have never got it.. arrgh...
This is a bit messy but works :) just alter the (E:Local Time, seconds) 10 to suit your gear timings (you may need more time for the gear to be fully down)
Code:
<Gauge Name="OhmyOhmy" Version="1.0">
 <Update Frequency="6"/>
  <Element>
    <Select>
      <Value>(L:Egear_pump,enum) 1 == if{ (L:Egear_pump,enum) 1 == (L:EmgcyGear,enum) 0 == 
if{ 1 (>L:EmgcyGear,enum) (>K:GEAR_DOWN) } }
      </Value>
    </Select>
 </Element>
  <Element>
    <Select>
	<Value>(L:EmgcyGear,number) 1 ==
		  if{ (G:Var6) 0 == if{ 1 (&gt;G:Var6) (E:Local Time, seconds) 10 + (&gt;G:Var7) } }
		 els{ (G:Var6) 0 &gt; if{ 0 (&gt;G:Var6) } }
	</Value>
    </Select>
 </Element>
  <Element>
    <Select>
	<Value>(G:Var6) 1 == 
		  if{ (P:Local Time, seconds) (G:Var7) &gt; if{ 2 (&gt;L:Egear_pump,enum) 0 (>L:EmgcyGear,enum)  } }
	</Value>
    </Select>
 </Element>

  <Element>
    <Select>
      <Value>(L:EmgcyGear,enum) 1 == 
if{ (K:GEAR_PUMP) (>K:GEAR_PUMP) }
      </Value>
    </Select>
 </Element>
</Gauge>

Ps the L:Egear_pump is the toggle, so your lever/knob code will trigger this
Wozza
 
Last edited:
Awesome... Many thanks Wozza.

The fun will be in dissecting this to see how you made it work..
 
All 36 cycles of the loop will take place within the same update cycle using labels and goto as demonstrated in the wiki. Pretty fast cranking. :duck:

True enough! Simply add a timer function to slow it down to 1 second steps...

Code:
<Update>
   (P:Absolute time,seconds) 1 % 1 > ! 
   if{
       36 (>L:LoopCounter,enum) (* initialize the counter's stack, 36 cycles *)
       :12345 (* loop label *)

	(* do something *)
       (L:LoopCounter,enum) 1 - (>L:LoopCounter,enum)	(* decrement -1 *)
       (L:LoopCounter,enum) 0 > if{ g12345 } (* next *)
     }
</Update>
 
Back
Top