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

FSX Radiator_flap animation ?

Messages
39
Welcome dear community
I have an additional radiator flap in my actual model. This flap must be controlled in VC from a lever. I made all animation of this parts in 3d max, but logic... nothing. Could some one answer me with code I must sign for flaps part, for example using a (L:var), in the following body (apropos is it correct?)

Code:
<PartInfo>
		<Name>radiator_flaps</Name>
		<AnimLength>100</AnimLength>
		<Animation>
			<Parameter>
				<Code>
					[B][COLOR="Blue"](First bla-bla-bla)[/COLOR][/B]
				</Code>
			</Parameter>
		</Animation>
</PartInfo>

Same for the lever <Code> part, especially for <MouseRect> section. Suppose in this I need to introduce a (M:Var) ?

Code:
<PartInfo>
		<Name>lever_radiator_flaps</Name>
		<AnimLength>100</AnimLength>
		<Animation>
			<Parameter>
				<Code>
					[B][COLOR="Blue"](Second bla-bla-bla)[/COLOR][/B]
				</Code>
			</Parameter>
		</Animation>
		<MouseRect>
			<Cursor>Hand</Cursor>
                                  <HelpID>[I][COLOR="DarkOrange"]Is it necessary (important) №1 ?[/COLOR][/I]</HelpID>
                                  <TooltipID>[I][COLOR="DarkOrange"]Is it necessary (important) №2 ?[/COLOR][/I]</Tooltip
			<MouseFlags>LeftSingle+LeftDrag+Wheel</MouseFlags>
			<CallbackCode>
				            [B][COLOR="Blue"](Third bla-bla-bla)[/COLOR][/B]
			</CallbackCode>
		</MouseRect>
</PartInfo>

Is <HelpID> and <TooltipID> so needed, may I wright here whatever I want?
And last, can I use same (L:var) in an eventual guage for example to simulate engine failure?

Many thanks in advance!!!
 
Assuming that the flaps move right along with the lever (i.e. mechanically connected), First and Second bla blas are identical. The variable will vary between 0 and 100, and both objects should be keyframed from 0 to 100.

(L:Radiator_Flap_Position, percent)

This can use any name you wish, I used Radiator_Flap_Position.

As for the third bla bla, that is more complicated and I don't have specific code for you. It depends on if your lever moves up and down or sideways, and whether it moves from keyframe 0 to 100 or 100 to 0.
 
Thank you Tom!
Assuming that the flaps move right along with the lever (i.e. mechanically connected), First and Second bla blas are identical. The variable will vary between 0 and 100, and both objects should be keyframed from 0 to 100.

(L:Radiator_Flap_Position, percent)

This can use any name you wish, I used Radiator_Flap_Position.
Must I add some special instruction for this L:Var?
Something like //and, //if, //els, //* etc? Or it's good?
I heard that at first loading the L:Var takes the 0 value, so must I write something like

Code:
1 (<L:Radiator_Flap_Position, percent)

???

As for the third bla bla, that is more complicated and I don't have specific code for you. It depends on if your lever moves up and down or sideways, and whether it moves from keyframe 0 to 100 or 100 to 0.

The lever moves totally like cowl_flaps_lever. But the last one uses special internal code, and I can't use the same, because the lever_cowl_flaps already in use.

Code:
<MouseRect>
      <Cursor>Hand</Cursor>
      <HelpID>HELPID_GAUGE_COWL_FLAPS_SWITCH</HelpID>
      <TooltipID>TOOLTIPTEXT_COWL_FLAPS_PERCENT</TooltipID>
      <MouseFlags>LeftSingle+LeftDrag+Wheel</MouseFlags>
      <CallbackJumpDragging>
        <YMovement>
          <Delta>30</Delta>
          <EventIdInc>INC_COWL_FLAPS1</EventIdInc>
          <EventIdDec>DEC_COWL_FLAPS1</EventIdDec>
        </YMovement>
      </CallbackJumpDragging>
    </MouseRect>
 
Code:
<PartInfo>
		<Name>radiator_flaps</Name>
		<AnimLength>100</AnimLength>
		<Animation>
			<Parameter>
				<Code>
					(L:Radiator Flap Var, number)
				</Code>
			</Parameter>
		</Animation>
</PartInfo>

Code:
<PartInfo>
		<Name>lever_radiator_flaps</Name>
		<AnimLength>100</AnimLength>
		<Animation>
			<Parameter>
				<Code>
					(L:Radiator Flap Var, number)
				</Code>
			</Parameter>
		</Animation>
		<MouseRect>
			<Cursor>Hand</Cursor>
                                  <TooltipText>Radiator Flaps: %(L:Radiator Flap Var, number)</TooltipText>
			<MouseFlags>LeftSingle+LeftDrag+WheelUp+WheelDown</MouseFlags>
			<CallbackCode>
	  (M:Event) 'LeftSingle' scmp 0 ==
	  if{ (M:X) (&gt;L:MOUSEPOS1,number) quit }
	  
	  (M:Event) 'LeftDrag' scmp 0 ==
	  if{ (M:X) (L:MOUSEPOS3,number) - 0.2 * (L:Radiator Flap Var, number) + 0 max 100 min (&gt;L:Radiator Flap Var, number) (M:X) 
	      (&gt;L:MOUSEPOS3,number) }
	   
	  (M:Event) 'WheelUp' scmp 0 == 
	  if{ (L:Radiator Flap Var, number) 5 + 100 min (&gt;L:Radiator Flap Var, number) }

    (M:Event) 'WheelDown' scmp 0 == 
	  if{ (L:Radiator Flap Var, number) 5 - 0 max (&gt;L:Radiator Flap Var, number) }
			</CallbackCode>
		</MouseRect>
</PartInfo>


This basically makes the lever draggable by mouse.
 
Thanks for supplying that. BTW, if your lever moves up and down change M:X to M:Y.

Mine only use a single mousepos variable, instead of two separate ones. I wonder if that makes a difference?
 
Thank you very much Björn !!!
Your code is perfectly working, even more - this code displays animation more smoothly then standard cowl_flaps code.

Could you, please, explain on normal English what mean the <CallbackCode> section?
And what exactly represent (M:X) thinks and {quit, min, max} instruction?

Thank you again!

Something else, now for Guag's Guru(GG) :)
May I use the (L:Radiator Flap Var) in guag, for creating engine failure? Example: if radiator flap was totally closed for more than 15 min - then the engine burns :D
 
Thanks for supplying that.

Thank you very much Björn !!!
Your code is perfectly working, even more - this code displays animation more smoothly then standard cowl_flaps code.

You're welcome, guys.

Could you, please, explain on normal English what mean the <CallbackCode> section?
And what exactly represent (M:X) thinks and {quit, min, max} instruction?

CallbackCode => Not sure; just put the things the mouse rectangle does between the tags.

(M:X) => Mouse position (or movement?) in the horizontal plane

Quit => I don't know.

Min, max => Helps to define a minimum and a maximum for a variable. If any of the two is reached, the value of the variable will not increase/decrease any more. Paradoxically, MSFS parses the lowest value as "max" and the highest value as "min" (don't ask me why).

May I use the (L:Radiator Flap Var) in guag, for creating engine failure? Example: if radiator flap was totally closed for more than 15 min - then the engine burns :D

Yes, but it gets a bit complicated.
You will need a timer code that gets initiated if, say, a certain engine temperature reading is greater than a treshhold value. If the temperature falls below that treshhold again, the timer is stopped and reset.
If the timer value reaches a preset value (your 15 minutes), you enable visibility of a fire effect built into the model and make FSX cut engine power.

Modeling any structural failure due to fire damage is, however, not possible.


There have been discussions about implementing timers with code examples. The rest is, however, up to you to implement.



Mine only use a single mousepos variable, instead of two separate ones. I wonder if that makes a difference?

I don't know.

Courtesy for the original mouse drag code goes to Vitus. I've just adapted it to my requirements.
 
Hi,

Quit does just that. FS doesn't parse (i.e. use) any of the code below the quit statement in that CallbackCode section. Think of it as a JUMP instruction to the next code section.

So if you click the mouse it only parses this statement:

(M:X) (&gt;L:MOUSEPOS1,number)

but if you drag the mouse it parses everything.

I don't know why it is needed there, but it does no harm apparently.
 
I don't know why it is needed there, but it does no harm apparently.

Yo've already answered this question :) As you stated, it prevents the rest of the code below from being parsed. Remember every single char of an entire script (even a space) is extracted by an FS function that keeps records to recognize whether it should be further evaluated or not.

In this case, that quit is irrelevant and could be avoided, because the code below is not that long, but in other situations it becomes very useful as to discard huge sections of conditional code within a script (see GPS example).

Tom
 
Back
Top