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

FS2004 Display in range?

Messages
231
Country
us-alabama
Hi All

Can some one point me to any SDK or third party info on display in range codes?

Ronnie Pendergraft gave me several examples of display in range code, but I have never been able to get any of them to work. I have tried a couple of code strings I have found on forum posts both here and at Felix's site. I can't get any of them to work.

Any info from any source will be welcome. Like what can you actually do with the display in range concept?

For my current problem I would like to be able to have a static part displaying most of the time, a clone to play one animation upon left click another clone to play another animation upon right click. Ronnie said display in range could be used to have the static part display except when, either the left click or right click clone was playing it's animation. The left click or right click clone would both remain out of range except when they here playing their own animation.

Damned confusing! Is this even possible?

For FS2004 using gmax

Carl
 
Almost anything is possible. But I would need more specific information that you have given to be any help...
 
The Corsair had a pull handle to release the contents of a C02 bottle to lower the landing gear in an emergency. I need the pull handle to display as static during other gear opperations.

The static "in" pull handle part. When left clicked should go out of display replaced by the left click animated clone which plays its animation,triggers the landing gear, then goes out of display.

To be replaced by a up to this point out of display static "out" pull handle part which acts as a mouse click and triggers the right click animated clone to come into display, play it's animation which is a simple return to the static "in" pull handle part location, then go out of display.

Then the static "in" pull handle part comes back into Display to act as the trigger to start the process over again by dislpaying and playing the left click animated clone's frames.

The landing gear system of the Corsair used the front gear as dive brakes I need to take out of display the landing gear handle animation and the center gear indicator"s animation when the dive brake animation is played.

Lots of other places in this vc where display in range might quench my editor's thirst for complete and total historic accuracy. That's why I hoped you could point me to a spot in one of the SDKs where display in range was completely and cocisely explained and all would be sweetness and light....Uh I guess I was mistaken.

Carl
 
Last edited:
Yeah, I wish there were such things in the SDK...

Sounds like you would have a lot of parts there. I would try just using one lever part with the code set to operate the animations properly under the correct conditions.
 
tgibson

When I started working on Ronnies Corsair the most I could do with xml was place my scenery objects where I wanted them. This project was dropped in my lap. I aquired a stumbling ability to write parts names, just enough to get the vc animated really. I just finished a 3 month sentance keyframing canopy release cables. I seem to have forgotten what little I knew. When I look at parts code now I no longer get that glimmer of understanding I had before starting to keyframe the release cables.


I can write an "eye candy" parts name to play the animation. But I don't know how or where to insert code to lower/raise the gear when clicked for the pull out/push in movement of the pull handle. Would giving the pull handle a name like em_pull_handle keep such a part from moving during normal landing gear opperations?

Carl
 
Hi,

You would give the lever part a custom name, and then add XML code into the makemdl.parts.xml file (found in your GMAX gampack/FS2004/plugins folder, as I remember - it's around there somewhere). If you use Middleman and/or MDL Commander it should be renamed to match the renamed makemdl.exe file's name.

There are many posts in this forum and over at FreeFlight Design Shop (i.e. main forum and Working XML forum) about how to write code to do similar (but usually simpler) things.

But I have to admit for something as complex as that (it would probably take me several days to work out something like that, and I've written quite a few custom parts and XML gauges) I might ask for help from someone in your group that has more XML experience.

Hope this helps,
 
tgibson

I cannot claim to have written any part names. But I have modified code to the extent my skills will allow me. So I am familiar with makemdl.parts.xml file and how to add new part name code. Here is the code I will use to get the part to eye candy animate.

Code:
<part>
	<name>em_pull_hndl</name>
      <animation>
	<parameter>
	  <code>(L:em_pull_hndl, bool) 100 *</code>
 	  <lag>300</lag>
	</parameter>
      </animation>
   <mouserect>
	<cursor>Hand</cursor>
   <tooltip_text>Emergency Landing Gear </tooltip_text>
   <callback_code>
     (L:em_pull_hndl, bool) ! (>L:em_pull_hndl, bool)
   </callback_code>
   </mouserect>
</part

Still another rewrite of the code Lionheart gave me in an earlier post. He was right though this code and the mini tutoial on that post has been the work horse that got me thru animating the Vc. Many Thanks Lionheart!

At the moment, I am the only one in the group. Ronnie the aircraft design partner dropped out of the project. And seemingly off the face of the earth. So it is now my job to finish it.

I will take your good advice. And scan the forums. I think I will check Ronnies exterior model and see if there are any display in range parts that I can back engineer to see how they function. This is the code he sent me as dislpay in range examples.

Code:
<part>
	<name>GatCannon_on</name>
	<visible_in_range>
		<parameter>
			<sim>
				<variable>LIGHT RECOGNITION</variable>
				<units>bool</units>
				<scale>50</scale>
			</sim>
			<lag>400</lag>
		</parameter>
		<minvalue>25</minvalue>
	</visible_in_range>
</part>

<part>
	<name>GatCannon_off</name>
	<visible_in_range>
		<parameter>
			<sim>
				<variable>LIGHT RECOGNITION</variable>
				<units>bool</units>
				<scale>50</scale>
			</sim>
			<lag>400</lag>
		</parameter>
		<maxvalue>25</maxvalue>
	</visible_in_range>
</part>

I do not have the Gmax file with this cannon so I created parts using these names tried every way I could think of to link them to to animated parts never got a grunt out of any of the experiments.

Carl
 
For this code to be incorporated into the model, you must compile it into the aircraft's MDL file using GMAX. If you can't do that, then no editing of this XML file is going to change anything in the MDL file...
 
tgibson

I know how to export to the sim. I generate whole aircraft using Lionheart's unlimited process, and create daily rush .mdls to check out progress on whatever lod I am working on, in the sim.

As it is now the em_pull_hndl when clicked will animate the handle as do nothing eye candy. What I am not clear on is what bit of code goes where to control the landing gear only when the em_pull_hndl part is clicked.

On the display in range code I entered the part names into my makemdl.parts .xml, created parts with those names in my gmax file then tried to use them as parents of animated parts to hide one of the anmated parts while showing the other. With no results.

Carl
 
Last edited:
Odd, that works fine for me. Each part must be named uniquely, though. Make sure you don't have two parts with the same name. You can add _01 (etc.) to part names to make them unique.
 
tgibson

Knowing no more than I do about display in range. It is just some thing I am going to have to play with to figure out. I have found a couple of trim tabs in the Corsair exterior model that I think are display in range. I am working on back engineering them now.

Any suggestions on what bit of code goes where to control the landing gear only when the em_pull_hndl part is clicked?

Carl
 
I don't understand what you mean by "only when the em_pull_hndl part is clicked". Of course, the user will be able to use the G key or the button on their joystick as well, and landing gear position indicator gauges often have click spots. You cannot limit the action to your lever.

Here is the code for the default landing gear lever that you can take code from; you will need to change the mouserect section from a lever drag to a click spot:

Code:
<part>
	<name>lever_landing_gear</name>
	<animation>
		<parameter>
			<sim>
				<variable>GEAR HANDLE POSITION</variable>
				<units>percent</units>
			</sim>
			<lag>200</lag>
		</parameter>
	</animation>
	<mouserect>
		<cursor>Hand</cursor>
		<help_id>HELPID_GAUGE_GEAR_LEVER</help_id>
		<tooltip_id>TOOLTIPTEXT_GEAR_LEVER</tooltip_id>
		<mouse_flags>LeftSingle+LeftDrag+Wheel</mouse_flags>
		<callback_jump_dragging>		
			<ymovement>
				<delta>50</delta>
				<event_id_inc>GEAR_DOWN</event_id_inc>
				<event_id_dec>GEAR_UP</event_id_dec>
			</ymovement>
		</callback_jump_dragging>
	</mouserect>
</part>

An example of a part with a click spot:

Code:
<part>
	<name>switch_master_battery</name>
	<animation>
		<parameter>
			<sim>
				<variable>ELECTRICAL MASTER BATTERY</variable>
				<units>bool</units>
				<scale>50</scale>
			</sim>
			<lag>400</lag>
		</parameter>
	</animation>
	<mouserect>
		<cursor>Hand</cursor>
		<help_id>HELPID_GAUGE_BATTERY_SWITCH</help_id>
		<tooltip_id>TOOLTIPTEXT_BATTERY_SWITCH</tooltip_id>
		<event_id>TOGGLE_MASTER_BATTERY</event_id>
	</mouserect>
</part>

You will need to change the event_id to GEAR_TOGGLE, and the help_id and tooltip_id to either the ones listed in the first code, or create your own custom tooltip.

Hope this helps,
 
Tom

"only when the em_pull_hndl part is clicked" refers to the need for the part to play its animation and cycle the gear only when it is clicked. It should stay static when the G key is pressed for normal gear cycling. The em_pull_hndl part represents, a pull handle in the F4U-1 to release a C02 bottle's pressure to lower the landing gear in an emergency.

And I do see a few things in your code that may help. Thanks!

Carl
 
In that case you would need a more complicated animation section (i.e. one that doesn't just follow a variable).

Here is code for a speed brake handle that releases the main gear uplocks and then returns to its original position. I don't code that in the XML file, though:

Code:
<part>
	<Name>lever_propliner_speed_brake</Name>
	<Animation>
	   <Parameter>
	   <Code> (L:Speed_Brake_Lever, bool) 100 * </Code> 
		<Lag>100</Lag> 
	   </Parameter>
	</Animation>
<MouseRect> 
	   <Cursor>Hand</Cursor> 
	   <Tooltip_Text>%((L:Speed_Brake,enum))%{case}%{:1}SPEED BRAKE ON%{:0}SPEED BRAKE OFF%{End}</Tooltip_Text> 
		<mouse_flags>LeftSingle+LeftDrag</mouse_flags> 
		<Callback_Code> 
		    (A:AIRSPEED INDICATED,knots) 260 &lt; if{ 1 (&gt;L:Speed_Brake_Lever, bool) }
	      </Callback_Code> 
    </MouseRect> 
</part>

What I do instead is create an XML gauge in the VCockpit section of the panel.cfg file that monitors the L:Speed_Brake_Lever variable, and then after a small delay returns its value to 0, thus moving the lever back. Much easier for me to code. :)

Code:
<Gauge Name="SPEED BRAKE VC" Version="1.0">
<Element> <!-- if speed brake is activated elsewhere, take action  - to activate, set speed brake *lever* variable to 1 - also sets spoilers to simulate drag of main gear -->
      <Select>
       <Value>(L:Speed_Brake,bool) 0 == (L:Speed_Brake_Lever,bool) 1 == (A:Gear left position,percent) near 0 == &amp;&amp; &amp;&amp;
        if{ (A:SPOILERS RIGHT POSITION,number) (&gt;L:Spoilers_CF,number) 16384 (&gt;K:SPOILERS_SET) 1 (&gt;L:Speed_Brake,bool) 1 (&gt;L:Speed_Brake_Prev,bool) } 
	</Value>
      </Select>
   </Element>

    <Element> <!-- if speed brake is inactivated elsewhere, take action - to inactivate, set speed brake *variable* to 0  - also retracts spoilers -->
      <Select>
       <Value>(L:Speed_Brake,bool) 0 == (L:Speed_Brake,bool) (L:Speed_Brake_Prev,bool) != &amp;&amp;
	if{  0 (&gt;L:Speed_Brake_Prev,bool) (L:Spoilers_CF,number) 16384 * (&gt;K:SPOILERS_SET) }
	</Value>
      </Select>
   </Element>

  <Element> <!-- if speed brake is on and gear comes down, eliminate speed brake drag (raise speed brakes) -->
      <Select>
          <Value>(L:Speed_Brake,bool) 0 &gt; (A:Gear center position, percent) near 100 == &amp;&amp;
		if{ 0 (&gt;L:Speed_Brake,bool) (L:Spoilers_CF,number) 16384 * (&gt;K:SPOILERS_SET) }</Value>
      </Select>
   </Element>

   <Element> <!-- After speed brake lever is thrown, return in 1 second -->
      <Select>
		<Value>(L:Speed_Brake,bool) 1 == (L:Speed_Brake_Lever,bool) 1 == (G:Var1) 0 == &amp;&amp; &amp;&amp;	
		if{ (P:Absolute time, seconds) (&gt;L:Speed_Lever_Time, seconds) 1 (&gt;G:Var1) } 
		(P:Absolute time, seconds) (L:Speed_Lever_Time, seconds) 1 + &gt;
			if{ 0 (&gt;L:Speed_Brake_Lever,bool) 0 (&gt;G:Var1) } 
		</Value>
      </Select>
   </Element>

   <copyright>(c)2005 Ken Mitchell and Tom Gibson</copyright>
</Gauge>

I have a extra set of main gear objects in the plane's model that also have special XML code so they react to the Speed Brake (not Speed Brake Lever) variable. You can also customize the real main gear to have it disappear once the speed brake is engaged, so you don't have two sets of gear visible. :)

Hope this helps,
 
Last edited:
Tom

I think it will. Thank you! I also want to thank you for the suggestion of searching the stacks of data here and at FFDS. That glimmer of understanding I was talking about is starting to return. Plus there are lots of code that seem to have answers to other problems. A lot of the code is written for FSX but I have had success in the past converting FSX part names to FS9 syntax.

My wife is dragging me off to a casino for the weekend. So I do not know if I will have internet access to reply till Monday. But I will get lots of work time in the room while she feeds the one arm bandits! I do love the laptop and folding cyborg stick for trips like these. She thinks taking the esspresso machine is a bit much though.

Carl
 
Back
Top