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

additional cowl flaps?

Messages
231
Country
us-alabama
I am working on an F4u-1 Corsair for FS9 in gmax. I addition to the normal cowl flaps, this aircraft also has intercooler flaps and oil cooler flaps. All of which need to deploy and retract, controlled from seperate VC controls incrementely and independenly. I have the additional animations working using cowl flaps 1, and cowl flaps 2 event ids to control the flaps incrementaly.

My problem lies in the fact to get the flaps to function I have to add engine entries to the aircraft.cfg file to get the animations to play. Is there a way to fool the .cfg file into thinking the added engines are not there so I can continue to use the cowl flap 1 and 2 event ids to move the flaps incrementaly? Failing that, is there a way to write a part name that will play it's keyframes incrementaly and still be triggered from the VC controller? Or Are there 2 other incremental event Ids I can use to do the job with out having to add engines.

Here is an example of the VC controller code I am using:

Code:
<part>
	<name>oil_switch_spring</name>
	<animlength>100</animlength>
	<animation>
	   <parameter>
	   <code>50 (L:oil_switch_spring,enum) 50 * +</code>
		<Lag>100</Lag>
	   </parameter>
	</animation>
<mouserect>
	   <cursor>Hand</cursor>
	   <tooltip_text>Left_Click-open/Right_Click-close</tooltip_text>
	   <mouse_flags>LeftSingle+Leftrelease+RightSingle+RightRelease</mouse_flags>
			<callback_code>
			(M:Event) 'LeftSingle' scmp 0 ==
				if{ 1 (>L:oil_switch_spring, enum) (>K:INC_COWL_FLAPS3) }
			(M:Event) 'LeftRelease' scmp 0 ==
				if{ 0 (>L:oil_switch_spring, enum) }
			(M:Event) 'RightSingle' scmp 0 ==
				if{ -1 (>L:oil_switch_spring, enum) (>K:DEC_COWL_FLAPS3) }
			(M:Event) 'RightRelease' scmp 0 ==
				if{ 0 (>L:oil_switch_spring, enum) }
	   </callback_code>
    </mouserect>
</part>

And here is the cowl flap entry:

Code:
<part>
	<name>lever_cowl_flaps2</name>
	<copy>lever_cowl_flaps</copy>
	<animation>
		<parameter>
			<sim>
				<variable>RECIP ENG COWL FLAP POSITION:3</variable>
			</sim>
		</parameter>
	</animation>
	<mouserect>
		<tooltip_id>TOOLTIPTEXT_ENG3_COWL_FLAPS_PERCENT</tooltip_id>
		<callback_jump_dragging>
			<ymovement>
				<event_id_inc>INC_COWL_FLAPS3</event_id_inc>
				<event_id_dec>DEC_COWL_FLAPS3</event_id_dec>
			</ymovement>
		</callback_jump_dragging>
	</mouserect>
</part>

Any help would be welcomed.

Carl
 
Tom

I will convert the code examples to fs9 and try it. But the code looks simular to left click to play code I already have. The incremental movement aspect in the cowl flap parts was the needed factor not the cowl flaps themselves.

As I have stated before I am a nubie, I am just getting a slight understanding of xml coding for part names. In most cases I just look for a part name in makemdl parts, or forum posts that seems to be what I want and then trial and error for a couple of weeks. Until I get it to work or convince myself it is a blind alley. So please excuse my ignorance. I know nothing of gauge design. I am doing production work and trying to learn at the same time.

So ingnorance stated. This is what I think I need: A part name that will advance 10 to 20% of its keyframes and stop, when left clicked from the vc controller, thru all of it's keyframes. And reteact 10 to 20% of its keyframes and stop, when right clicked from the vc controller, thru all of it's keyframes.

Is this a possible code? Not knowing if it is possible is the worst part about trying to find an example for trial and error.

Carl
 
Here is code in FS9 format:

http://www.aerodynamika.com/cgi-bin/yabb2/YaBB.pl?num=1094344931

The key thing to remember is that the value of the Code line is the keyframe number that will be displayed in FS. The lag value will smooth the transition between keyframe values. So if you have it animated between keyframe 0 and 100, you need to modify the code in the mouserect section so that it doesn't just move between 0 and 100 and back again, but moves in steps as you desire.

Other XML examples will show you left click for increase, right click for decrease and other techniques for this more complicated case.

The forum I am using for these XML examples is here - feel free to browse it:

http://www.aerodynamika.com/cgi-bin/yabb2/YaBB.pl?board=XML/0

Hope this helps,
 
You can also include 'logic' variables to the custom L:vars, which can be pretty awesome.



Bill
 
Tom

Thanks for the links! I will start the trial and error. I will report any progress. And probably ask stupid questions here.

Carl
 
Last edited:
Hey Carl,

Basic logic is having variables in the code that cause and/or use conditions.

For instance, if your cowl flaps were electric, you could assign that the animation will not function if the master battery is off, electrics are below such and such a voltage, etc. You could say that if the flaps are at 99% &gt; and your airspeed is over 200 knots, that an alarm will sound and the system will auto close the flaps for you. If you have a sound system, you can assign a sound to the L:var so that you have a servo or slide sound occur. A switch click as well if its a toggle switch that activates/opens these.

Logics use the 'if' and 'else' scenarios.

I am only still just learning these, but used them extensively on my Avelina to give the aircraft a very 'computer managed' feel, with the craft having tons of dings and soft alerts, auto raising and lowering of landing gear, alerts, blinkies, etc, etc. You can really have fun with conditional basic logic.

The tip of the iceberg.....! 8-)



Bill
 
Here is a quick sample. This is written into a gauge (XML) that goes in the planes gauges CAB folder.



Code:
<!--  ======================= AUTO GEAR RAISE AT 150 KNOTS PLUS  =====  -->

   <Element> 
      <Select>
         <Value>
                      (A:Radio height,feet) 300 &gt;
                      (A:Gear center position,percent) near 100 ==
                      (A:AIRSPEED TRUE, knots) 150 &gt;
                      and and
            if{ 
            1 (&gt;L:XMLSND70,number)
            0 (>K:GEAR_UP) 
            }
            els{ 0 }
         </Value>
      </Select>
   </Element>


If you know nothing about if/else, note that they write it backwards in XML. When you see an 'if', note that 'above' it is where the if zone is, and that below the if is the 'then'.

Thus you write....
Circumstance,how much
Circumstance,how much
Circumstance,how much
if.........
(then) command...(This happens)
command...(This happens)
else......
zero (nada) or something else like 'command, turn thing back off, or move to zero point).
 
Last edited:
Bill

Yes I have a sound engine I bought from n4gix. I have been so busy with production and trying to learn xml I have not even un zipped it yet. I want to thank you for the if/else explanation. You just added about 50% to my understanding of xml editing. Any chance of getting a simular break down of how this snip of callback code works?


Code:
<callback_code>
                 (L:oil_flap_slave,bool) ! (>L:oil_flap_slave,bool)
           </callback_code>

And what is the difference between the bool in the above statement, and the enum in this statement?

Code:
<callback_code>
			(M:Event) 'LeftSingle' scmp 0 ==
				if{ 1 (>L:oil_switch_spring, enum) (>L:oil_flap_slave,bool) }
			(M:Event) 'LeftRelease' scmp 0 ==
				if{ 0 (>L:oil_switch_spring, enum) }
			(M:Event) 'RightSingle' scmp 0 ==
				if{ -1 (>L:oil_switch_spring, enum) (>L:oil_flap_slave,bool) }
			(M:Event) 'RightRelease' scmp 0 ==
				if{ 0 (>L:oil_switch_spring, enum) }
	   </callback_code>

As you can tell by my questions my actual xml coding knowlege is very limited.

Carl
 
Hi!

First of all I'm not an expert.
Still struggling to learn stuff so many how could give you an more technical explanation.

First code.
Code:
(L:oil_flap_slave,bool) ! (>L:oil_flap_slave,bool)

From the SDK:
! (L:Local) ! (>L:Local) Toggles the variable Local

So there you have it.
It will toggle from 0 to 1 and back again.

Next code.

Code:
(M:Event) 'LeftSingle' scmp 0 ==
				if{ 1 (>L:oil_switch_spring, enum) (>L:oil_flap_slave,bool) }

What happens when the LEFT mouse button is pressed is that the switch will go into the 1 postion, hence the
Code:
if{ 1 (>L:oil_switch_spring, enum)
It will also trigger the
Code:
(>L:oil_flap_slave,bool)
as there are not any more if or els in the statement.

Code:
			(M:Event) 'LeftRelease' scmp 0 ==
				if{ 0 (>L:oil_switch_spring, enum) }
When the LEFT mousebutton is released the switch will go back into the 0 position. As you can see the
Code:
(>L:oil_flap_slave,bool)
is not included in this statement.

Code:
			(M:Event) 'RightSingle' scmp 0 ==
				if{ -1 (>L:oil_switch_spring, enum) (>L:oil_flap_slave,bool) }

When the RIGHT mouse button is pressed the switch will move to the -1 position and the same will the
Code:
(>L:oil_flap_slave,bool)

And off course in the last statement will the switch move back into its 0 position when the RIGHT mouse button is released.

So to sum up.

The first code was for an simple back and forth animation.

The next one was for an 3 position switch that actually activated the first code :)

Up was 1
Middle was 0
Down was -1

Bill (N4GIX) tought me that when it comes to custom L:variables such as
Code:
(L:oil_flap_slave,bool)
Code:
(L:oil_switch_spring, enum)
it really does not matter regarded the BOOL and ENUM statement.

It's more for you own sanity.
 
Bill (N4GIX) tought me that when it comes to custom L:variables such as

Code:
(L:oil_flap_slave,bool)Code:
(L:oil_switch_spring, enum)it really does not matter regarded the BOOL and ENUM statement.

Not always true. If you use feet as the unit it gets multiplied by 3.2808. So if you had something like (L:height difference, number) the answer would be correct. If you called it (L:height difference,feet) it would be 3.2808 time too high. I imagine it is because the default unit for distance is meters.

Could be true for inches etc but I have not tested that.

Roy
 
Zeiten

I thought sanity and xml coding were mutually exclusive concepts!

Seriously though I thank you for the information. It confirms that the code I am using appears to do what I want it to, even though I have not gotten the oil_flap_slave named parts to respond to the oil_switch_spring named part when I test it in the sim.

Your explanation has added to my understanding greatly! Thank you! Any other tips or explanations of xml editing will be welcomed!

As mentioned above I have not gotten the oil_flap_slave named parts to respond to the oil_switch_spring named part when I test it in the sim. I plan to work on this problem after I post this reply. I will report progress here later.

Carl
 
Try with
Code:
callback_code> 
(M:Event) 'LeftSingle' scmp 0 == if{ 1 (>L:oil_switch_spring, enum) 1 (>L:oil_switch_spring, enum)
(M:Event) 'LeftRelease' scmp 0 == if{ 0 (>L:oil_switch_spring, enum) } 
(M:Event) 'RightSingle' scmp 0 == if{ -1 (>L:oil_switch_spring, enum) 0 (>L:oil_switch_spring, enum)
(M:Event) 'RightRelease' scmp 0 == if{ 0 (>L:oil_switch_spring, enum) } 
</callback_code>
I'm not on my pc now so this is from the top of my head so...
 
Last edited:
Zeiten

The top of your head is doing a fine job! The additon of the 1 and the zero seems to have turned the trick. The oil_flap_slave part now responds to the VC controller, this solves the first part of the problem. Here is a wip vid from the sim:

http://www.pendercrafts.com/Carls%20folder/Fldr01/Slave.avi

Here is the code for the VC Controller:


Code:
<part>
	<name>oil_switch_spring</name>
	<animlength>100</animlength>
	<animation>
	   <parameter>
	   <code>50 (L:oil_switch_spring,enum) 50 * +</code>
		<Lag>100</Lag>
	   </parameter>
	</animation>
<mouserect>
	   <cursor>Hand</cursor>
	   <tooltip_text>Left_Click-open/Right_Click-close</tooltip_text>
	   <mouse_flags>LeftSingle+Leftrelease+RightSingle+RightRelease</mouse_flags>
			<callback_code>
			(M:Event) 'LeftSingle' scmp 0 ==
				if{ 1 (>L:oil_switch_spring, enum) 1 (>L:oil_flap_slave, enum) }
			(M:Event) 'LeftRelease' scmp 0 ==
				if{ 0 (>L:oil_switch_spring, enum) }
			(M:Event) 'RightSingle' scmp 0 ==
				if{ -1 (>L:oil_switch_spring, enum) 0 (>L:oil_flap_slave, enum) }
			(M:Event) 'RightRelease' scmp 0 ==
				if{ 0 (>L:oil_switch_spring, enum) }
	   </callback_code>
    </mouserect>
</part>

And the code for the simple on off slave part:

Code:
<part>
	<name>oil_flap_slave</name>
      <animation>
	<parameter>
	  <code>(L:oil_flap_slave, bool) 100 *</code>
 	  <lag>300</lag>
	</parameter>
      </animation>
   <mouserect>
	<cursor>Hand</cursor>
   <tooltip_text>Oil Cooler Flap</tooltip_text>
   <callback_code>
     (L:oil_flap_slave, bool) ! (>L:oil_flap_slave, bool)
   </callback_code>
   </mouserect>
</part>

Now onward to the second part of the problem. Finding an incremental movement code for the slave part to move in a manner simular to the cowl flap movement in the wip vid.

I think I will try a drag able code to drive the slave and see how it reacts to the VC controller's inputs. I will post results as I get them.

Carl
 
The dragable code was a failure. The slave was dragable if I used active cam and went to a spot where I could directly mouse drag it, but the VC controller fails to control it. No way for the controller to drag I guess.

I have no idea where to start re writing the code for making the oil_flap_slave parts incremental. So I will search for existing code that may be adaptable. Hmmm, I may be able to do something with fuel selector code.

Carl
 
Semi failure with the first reedit of fuel selector code:

Code:
<part>
     <name>oil_flap_slave</name>  
     <animation>
        <parameter>
        <code>(L:oil_flap_slave,enum) 50 *</code>
           <lag>100</lag>
        </parameter>
     </animation>
         <mouserect>
           <cursor>Hand</cursor>
           <tooltip_text>Fuel Selector</tooltip_text>
             <mouse_flags>LeftSingle+RightSingle+Wheel</mouse_flags>
           <callback_code>
     (M:Event) 'RightSingle' scmp 0 ==
           if{ (L:oil_flap_slave, enum) ++ 5 min (>L:oil_flap_slave, enum) }
     (M:Event) 'LeftSingle' scmp 0 ==
           if{ (L:oil_flap_slave, enum) -- 0 max (>L:oil_flap_slave, enum) }
                 (L:oil_flap_slave,enum) 5 == if{ 0 (>K:FUEL_SELECTOR_SET) }
                 (L:oil_flap_slave,enum) 4 == if{ 3 (>K:FUEL_SELECTOR_SET) }
                 (L:oil_flap_slave,enum) 3 == if{ 8 (>K:FUEL_SELECTOR_SET) }
                 (L:oil_flap_slave,enum) 2 == if{ 7 (>K:FUEL_SELECTOR_SET) }
                 (L:oil_flap_slave,enum) 1 == if{ 2 (>K:FUEL_SELECTOR_SET) }
                 (L:oil_flap_slave,enum) 0 == if{ 0 (>K:FUEL_SELECTOR_SET) }
           </callback_code>
     </mouserect>
   </part>

The above code when given left click input from the VC controller, plays the first 50 frames, then fails to respond to additional left click inputs from the VC controller. Right click input from the VC controller plays the reverse of the first 50 frames.

The code when used as fuel selector and directly mouse clicked plays the first 50 frames on the first click, then each of the next 50 frames at each additional left click. It plays the revese order when right clicked.

Trial and error continue!

Carl
 
The incremental code must go into the VC Controller. Set up the code so it increments the value of the slave variable by 5 each time you click it (as you have it in the slave part - why do you have a mouse section on a part that is not clicked directly?).

Then set up the slave part as follows:

Code:
 <code>(L:oil_flap_slave,enum)</code>

Now the slave part will display the keyframe position of the L: variable, and change by 5 keyframes each time you right/left click the VC controller part.

Hope this helps,
 
Tom

Part of the mouse click left in the code is so I have the option of using active cam to move out of the cockpit and directly click on the oil flap slave part to check its function when it does not react correctly to the vc controller. Mostly though I am not sure how to remove it and leave the rest of the code functional.
My xml writing skill is limited to the most basic edits. But I will try to edit per your instructions. I will post results when I get them.

Carl
 
Back
Top