Jump to content
Sign in to follow this  
Guest Maltish

Help with XML code in Modeldef

Recommended Posts

Guest Maltish

Hi All .... Pretty new to FSX developing (but I know FS inside and out) I'm having major trouble with the code for a "simple" ? Pitch Trim switch as found in some light aircraftNone of the built in tags appear to work as I need ... OK .. 4 buttons on top of the control column... Pitch trim UP/down & Roll Trim L/RI appreciate they will probably be made in 2 seperate parts (Trim / Roll ) but I cannot figure out the required code :( FYI .. The below just wont work ... Pretty obviously to you that can see why LOL <PartInfo> <Name>button_trim_elevator_up_down</Name> <AnimLength>50</AnimLength> <Animation> <Parameter> <Sim> <Variable>ELEVATOR TRIM PCT</Variable> <Units>percent</Units> <Scale>-0.5</Scale> <Bias>50</Bias> </Sim> </Parameter> </Animation> <MouseRect> <Cursor>Hand</Cursor> <HelpID>HELPID_GAUGE_PITCH_TRIM</HelpID> <TooltipID>TOOLTIPTEXT_PITCH_TRIM</TooltipID> <MouseFlags>LeftSingle+LeftDrag+Wheel</MouseFlags> <CallbackJumpDragging> <YMovement> <Delta>1</Delta> <EventIdInc>ELEV_TRIM_DN</EventIdInc> <EventIdDec>ELEV_TRIM_UP</EventIdDec> </YMovement> </CallbackJumpDragging> </MouseRect> </PartInfo>HELP PLEASE !!!

Share this post


Link to post
Share on other sites

Did you remember to create a custom GUID and add it to an <Animation...guid.../> entry? Every <PartInfo> section that has an <Animation> and or <MouseRect> entry must have one.Try this. Animate your switch 0 - 50 - 100 keyframes, with 50 the "neutral position."

<Animation name="button_trim_elevator_up_down"   guid="2ab0357c-05ba-40ef-b4c7-c5936e21b442" length="100" type="Sim" typeParam2="button_trim_elevator_up_down" typeParam="AutoPlay" />  <PartInfo>	<Name>button_trim_elevator_up_down</Name>	<AnimLength>100</AnimLength>	<Animation>	  <Parameter>		<Sim>		  <Variable>ELEVATOR TRIM PCT</Variable>		  <Units>percent</Units>		  <Scale>0.5</Scale>		  <Bias>50</Bias>		</Sim>	  </Parameter>	</Animation>	<MouseRect>	  <Cursor>Hand</Cursor>	  <HelpID>HELPID_GAUGE_PITCH_TRIM</HelpID>	  <TooltipID>TOOLTIPTEXT_PITCH_TRIM</TooltipID>	  <MouseFlags>LeftSingle+LeftDrag+Wheel</MouseFlags>	  <CallbackDragging>		<Variable>ELEVATOR TRIM PCT</Variable>		<Units>percent</Units>		<Scale>163.84</Scale>		<YScale>163.84</YScale>		<MinValue>-16384</MinValue>		<MaxValue>16384</MaxValue>		<EventID>ELEVATOR_TRIM_SET</EventID>	  </CallbackDragging>	</MouseRect>  </PartInfo>


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556

Interests: Gauge Programming - 3d Modeling for Milviz

Share this post


Link to post
Share on other sites
Guest Maltish
Did you remember to create a custom GUID and add it to an <Animation...guid.../> entry? Every <PartInfo> section that has an <Animation> and or <MouseRect> entry must have one.Yep I have the GUID sorted, its just the FSX Parsing.. givin me a nightmare :)My FS9 xml was full of fancy stuff but I just dont know enough about the new version yet .. MANY Thanks for the code, I think you misunderstood slightly though, Unless I just explained it badly :) Its more of a button scenario than a switch I'm after .. Like er...... One button for trim UP, one for Trim Down.. make sense ??Then I can adapt it for Right and Left on the ailerons.There are 4 buttons on the top of the stick.. I'm sure you've seen the kinda thing ?Anyway, much appreciated, I'll try your code though today and get back to you, see if I can adapt it to a "button" rather than a switch

Share this post


Link to post
Share on other sites
Guest Maltish

Hmm , No code defined error there .. seems strange, however let me try to explain a little better whats required here ..This diagram is what you'd see looking down onto the top of the control column grip Pitch Trim Down button --------------------- O Aileron Trim Left button ----------------- O ---- O ---- Aileron Trim Right ButtonPitch Trim Up Button ------------------------ OThe buttons dont even need to animate really as they are so small you wouldn't notice them being pushed in, however when "pressed" .. each button would increment the corresponding trim action untill "UN-Pressed"perhaps they need to be 4 seperate parts ?? One for each operation Pitch Up / Pitch Down / Aileron Left / Aileron Right ???(My head hurts) :)

Share this post


Link to post
Share on other sites
Guest Maltish
Hmm , No code defined error there .. seems strange, however let me try to explain a little better whats required here ..This diagram is what you'd see looking down onto the top of the control column grip Pitch Trim Down button --------------------- O Aileron Trim Left button ----------------- O ---- O ---- Aileron Trim Right ButtonPitch Trim Up Button ------------------------ OThe buttons dont even need to animate really as they are so small you wouldn't notice them being pushed in, however when "pressed" .. each button would increment the corresponding trim action untill "UN-Pressed"perhaps they need to be 4 seperate parts ?? One for each operation Pitch Up / Pitch Down / Aileron Left / Aileron Right ???(My head hurts) :)
How about this ??? Pitch trim section <PartInfo> <Name>trimtab_elevator_key_UP</Name> <AnimLength>100</AnimLength> <Animation> <Parameter> <Sim> <Variable>ELEVATOR TRIM PCT</Variable> <Units>percent</Units> <Scale>0.5</Scale> <Bias>50</Bias> </Sim> </Parameter> </Animation> <MouseRect> <Cursor>UpArrow</Cursor> <HelpID>HELPID_GAUGE_PITCH_TRIM</HelpID> <TooltipID>TOOLTIPTEXT_PITCH_TRIM</TooltipID> <MouseFlags>LeftSingle</MouseFlags> <CallbackJumpDragging> <YMovement> <Delta>-3</Delta> <EventIdDec>ELEV_TRIM_UP</EventIdDec> </YMovement> </CallbackJumpDragging> </MouseRect> </PartInfo> <PartInfo> <Name>trimtab_elevator_key_DN</Name> <AnimLength>100</AnimLength> <Animation> <Parameter> <Sim> <Variable>ELEVATOR TRIM PCT</Variable> <Units>percent</Units> <Scale>0.5</Scale> <Bias>50</Bias> </Sim> </Parameter> </Animation> <MouseRect> <Cursor>DownArrow</Cursor> <HelpID>HELPID_GAUGE_PITCH_TRIM</HelpID> <TooltipID>TOOLTIPTEXT_PITCH_TRIM</TooltipID> <MouseFlags>LeftSingle</MouseFlags> <CallbackJumpDragging> <YMovement> <Delta>-3</Delta> <EventIdDec>ELEV_TRIM_DN</EventIdDec> </YMovement> </CallbackJumpDragging> </MouseRect> </PartInfo>

Share this post


Link to post
Share on other sites

PLEASE... When posting code/script snippets, click on the code icon in the toolbar to wrap the code/script so the indenting is preserved. It makes it possible then to simply cut-and-paste directly from the forum to your modeldef.xml file! :( Okay, since you don't need any animation, we'll get rid of that.Since you want only left-click, let's get rid of the stupid mouse dragging BS as well.Here is the drop-dead simplest solution. Four <MouseRect> that only do one thing; send the designated key_event once when clicked (or repeat if the button is held down).

<PartInfo>  <Name>trim_elevator_trim_up</Name>  <MouseRect>	<Cursor>Hand</Cursor>	<TooltipText>Elev Trim Up</TooltipText>	<MouseFlags>LeftSingle+DownRepeat</MouseFlags>	<CallbackCode>	  (>K:ELEV_TRIM_UP)	</CallbackCode>  </MouseRect></PartInfo><PartInfo>  <Name>trim_elevator_trim_down</Name>  <MouseRect>	<Cursor>Hand</Cursor>	<TooltipText>Elev Trim Dn</TooltipText>	<MouseFlags>LeftSingle+DownRepeat</MouseFlags>	<CallbackCode>	  (>K:ELEV_TRIM_DN)	</CallbackCode>  </MouseRect></PartInfo><PartInfo>  <Name>trim_aileron_trim_left</Name>  <MouseRect>	<Cursor>Hand</Cursor>	<TooltipText>Elev Trim Up</TooltipText>	<MouseFlags>LeftSingle+DownRepeat</MouseFlags>	<CallbackCode>	  (>K:AILERON_TRIM_LEFT)	</CallbackCode>  </MouseRect></PartInfo><PartInfo>  <Name>trim_aileron_trim_right</Name>  <MouseRect>	<Cursor>Hand</Cursor>	<TooltipText>Elev Trim Dn</TooltipText>	<MouseFlags>LeftSingle+DownRepeat</MouseFlags>	<CallbackCode>	  (>K:AILERON_TRIM_RIGHT)	</CallbackCode>  </MouseRect></PartInfo>


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556

Interests: Gauge Programming - 3d Modeling for Milviz

Share this post


Link to post
Share on other sites
Guest Maltish

MANY MANY Thanks Bill .. Also for the "code snippet" pasting, I'll remember thatLet me try these out and get back to you Speak to you soon with luck ;)Graham (Maltish) Brief explanation for Malt-ish, ex British now proudly living in Malta

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
  • Donation Goals

    AVSIM's 2020 Fundraising Goal

    Donate to our annual general fundraising goal. This donation keeps our doors open and providing you service 24 x 7 x 365. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. We reset this goal every new year for the following year's goal.


    53%
    $13,405.00 of $25,000.00 Donate Now
×
×
  • Create New...