Jump to content
Sign in to follow this  
COBS

Help with 2 Digit Thumbwheels

Recommended Posts

I am trying to create the followinginstrument. 316capture_01092009_17015.jpg I am trying to create 2 thumbwheels .(1) UNITS thumbwheel.(2) TENS thumbwheel. These two numbers are then combined to create any number from 00 to 99.Then the resultant number is forced to be the new active flight plan leg by clicking theload button, it then replaces and displays in the current flight plan leg window. I need help with code for the unit and tens thumbwheel portion of the instrument,or samples of similar code. I would be grateful for any help. CheersKarol

Share this post


Link to post
Share on other sites

This is what I had in my notes, Karol. I wrote it for standby course and heading inputs, but never tested it with a gauge.

<--Increment Tens-->(L:DigitTens, number) 90 >=  if{ 0 (>L:DigitTens, number)  }  els{(L:DigitTens, number) 10 ++  (>L:DigitTens, number) } <--Decrement Tens-->(L:DigitTens, number) 0 <=  if{ 90 (>L:DigitTens, number)  }  els{(L:DigitTens, number) 10 --  (>L:DigitTens, number) } <--Increment Units-->(L:DigitUnits, number) 9 >=  if{ 0 (>L:DigitUnits, number)  }  els{(L:DigitUnits, number) 1 ++  (>L:DigitUnits, number) } <--Decrement Units-->(L:DigitUnits, number) 0 <=  if{ 9 (>L:DigitUnits, number)  }  els{(L:DigitUnits, number) 1 --  (>L:DigitUnits, number) } <--Load-->(L:DigitTens, number) (L:DigitUnits, number) ++  (>L:DigitFinal, number)

Don't forget to check my spacing as I pulled the Hundreds out when I typed it! I still haven't figured out how to cut/copy/paste inside this doggone editor. It may not update fast enough to use a click repeat for fast "Thumbing" thru 9 or 0...Don

Share this post


Link to post
Share on other sites

Sorry , I should have said xml. Thanks Don , I will experiment with your code. CheersKarol

Share this post


Link to post
Share on other sites

You also didn't state whether this is for FS9 or FSX, 2d gauge or 3d model XML... In any event, here is XML script for a 3d modeled set of thumbwheels that I used for the T-38A's transponder Mode 1 selector. It is a non-functional mode in FSX of course, but can easily be adapted to your proposed use and translated to FS9 XML schema for either 2d or 3d use:

  <PartInfo>	<Name>T38_Xpdr_Mode1_1s</Name>	<AnimLength>10</AnimLength>	<Animation>  	<Parameter>    	<Code>      	(L:T38_Xpdr_Mode1_1s,enum)    	</Code>  	</Parameter>	</Animation>	<MouseRect>  	<Cursor>Hand</Cursor>  	<TooltipText>Mode1 1s</TooltipText>  	<MouseFlags>LeftSingle+RightSingle+Wheel</MouseFlags>  	<CallbackCode>    	(M:Event) 'RightSingle' scmp 0 == if{ (L:T38_Xpdr_Mode1_1s,enum) -- 0 max (>L:T38_Xpdr_Mode1_1s,enum) }    	(M:Event) 'LeftSingle' scmp 0 ==  if{ (L:T38_Xpdr_Mode1_1s,enum) ++ 9 min (>L:T38_Xpdr_Mode1_1s,enum) }    	(M:Event) 'WheelUp' scmp 0 == if{ (L:T38_Xpdr_Mode1_1s,enum) ++ 0 max (>L:T38_Xpdr_Mode1_1s,enum) }    	(M:Event) 'WheelDown' scmp 0 == if{ (L:T38_Xpdr_Mode1_1s,enum) -- 9 min (>L:T38_Xpdr_Mode1_1s,enum) }  	</CallbackCode>	</MouseRect>  </PartInfo>  <PartInfo>	<Name>T38_Xpdr_Mode1_10s</Name>	<AnimLength>10</AnimLength>	<Animation>  	<Parameter>    	<Code>      	(L:T38_Xpdr_Mode1_10s,enum)    	</Code>  	</Parameter>	</Animation>	<MouseRect>  	<Cursor>Hand</Cursor>  	<TooltipText>Mode1 10s</TooltipText>  	<MouseFlags>LeftSingle+RightSingle+Wheel</MouseFlags>  	<CallbackCode>    	(M:Event) 'RightSingle' scmp 0 == if{ (L:T38_Xpdr_Mode1_10s,enum) -- 0 max (>L:T38_Xpdr_Mode1_10s,enum) }    	(M:Event) 'LeftSingle' scmp 0 ==  if{ (L:T38_Xpdr_Mode1_10s,enum) ++ 9 min (>L:T38_Xpdr_Mode1_10s,enum) }    	(M:Event) 'WheelUp' scmp 0 == if{ (L:T38_Xpdr_Mode1_10s,enum) ++ 9 min (>L:T38_Xpdr_Mode1_10s,enum) }    	(M:Event) 'WheelDown' scmp 0 == if{ (L:T38_Xpdr_Mode1_10s,enum) -- 0 max (>L:T38_Xpdr_Mode1_10s,enum) }  	</CallbackCode>	</MouseRect>  </PartInfo>

It is a trivial task to take the two L:vars, add them together, and display the result:

(L:T38_Xpdr_Mode1_10s,enum) 10 * (L:T38_Xpdr_Mode1_1s,enum) + (>L:Xpdr_Mode1_Sum,enum)


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

Fr. Bill Its xml for 2D gauge in FSX.Thank you , that's perfect. I have two questions.1. What is the xml schema that you are using above ?2. How do I track down the subject T-38 ? RegardsKarol

Share this post


Link to post
Share on other sites
Fr. Bill Its xml for 2D gauge in FSX.Thank you , that's perfect. I have two questions.1. What is the xml schema that you are using above ?2. How do I track down the subject T-38 ? RegardsKarol
Karol, the schema is FSX XML for the modeldef.xml file. It is what is compiled and embedded into a .mdl file by the modeler. Between FS9 and FSX, there are actually four distinct XML schemas:
  1. FS9 XML for 2d gauges
  2. FS9 XML for 3d (makeMDL.parts.xml) models
  3. FSX XML for 2d gauges (ACES gauge tool)
  4. FSX XML for 3d (modeldef.xml) models

Of the above, I personally use only #1, #2, and #4 since #3 is excessively verbose and for the most part doesn't really offer enough in the way of "unique features" to make it worth while. After all, #1 works just fine in both FS9 and FSX! The T-38A is a payware release from Milviz: http://milviz.com


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

Fr. Bill , Thanks for the insight , I presume # 3 is the same as in the ESP SDK. The T-38 has been added to my wish list. Cheers Karol

Share this post


Link to post
Share on other sites

Fr. Bill Got it to work , once again thank you , I'm very pleased with the final instrument.Below is a cut down version covering the tread topic. CheersKarol

<Gauge Name="TAC INS" Version="1.0">//By Karol Chlebowski @ 2011 **<Image Name="TAC_INS.bmp" ImageSizes="242,226"/><!-- Macro define -->   <!--==== PAGES ====-->  <Element>	<Visible>(A:Circuit general panel on, bool)</Visible> 	<!--SEQ  DISPLAY  Flight plan legs--><!--Active leg number--><Element>  	<Visible>(L:Story Canyon,enum) 0 ==</Visible>        	<Element>          	<Position X="210" Y="143"/>          	<Text X="32" Y="12" Bright="Yes" Length="2" Font="Arial" Color="0x34AAF7" Adjust="Center" VerticalAdjust="Center" Multiline="No" Fixed="No">            	<String>%((A:GPS FLIGHT PLAN WP INDEX, number))%!02d!%</String>          	</Text>        	</Element>	</Element><!--Number of legs in Flt Plan-->  <Element>  	<Visible>(L:Story Canyon,enum) 1 ==</Visible>        	<Element>          	<Position X="210" Y="143"/>          	<Text X="32" Y="12" Bright="Yes" Length="2" Font="Arial" Color="0x34AAF7" Adjust="Center" VerticalAdjust="Center" Multiline="No" Fixed="No">            	<String>%((A:GPS FLIGHT PLAN WP COUNT, number) 1 -)%!02d!%</String>          	</Text>        	</Element>	</Element> <!--Thumbwheel text display TENS and UNITS-->   <Element>          	<Position X="200" Y="177"/>          	<Text X="10" Y="10" Bright="Yes" Length="2" Font="Arial" Color="0xEFEFEF" Adjust="Center" VerticalAdjust="Center" Multiline="No" Fixed="No">            	<String>%((L:F111_Leg_10s, number))%!d!%</String>          	</Text>        	</Element>     <Element>          	<Position X="214" Y="177"/>          	<Text X="10" Y="10" Bright="Yes" Length="2" Font="Arial" Color="0xFFFFFF" Adjust="Center" VerticalAdjust="Center" Multiline="No" Fixed="No">            	<String>%((L:F111_Leg_1s, number))%!d!%</String>          	</Text>        	</Element><!-- Thumbwheel  SUM  zero colour  defines  SUM L:VAR -->     <Element>          	<Position X="108" Y="212"/>          	<Text X="20" Y="10" Bright="Yes" Length="3" Font="Arial" Color="0x000000" Adjust="Center" VerticalAdjust="Center" Multiline="No" Fixed="No">	<String>%((L:F111_Leg_10s, number) 10 * (L:F111_Leg_1s, number) + (> L:F111_Leg_Sum, number))%!02d!%</String>          	</Text>        	</Element><!--<String>%((L:F111_Leg_10s, number) 10 * (L:F111_Leg_1s, number) + )%!02d!%</String> --></Element><!--==== CONTROL BUTTONS====--><Mouse>   <Macro Name="Button1">(L:SACDAT mode,enum) 4 == (L:ChgWPt, number) (A:GPS FLIGHT PLAN WP COUNT, number) 0 >if{(A:GPS FLIGHT PLAN WP INDEX, number) -- (> L:ChgWPt, number)(L:ChgWPt, number) (> C:fs9gps:directToActivateLeg)(L:ChgWPt, number) (> C:fs9gps:FlightPlanWaypointIndex)(L:ChgWPt, number) (> C:fs9gps:FlightPlanDirectToWaypoint)(L:ChgWPt, number) (> C:fs9gps:FlightPlanActiveWaypoint) }</Macro>	<Area Left="150" Top="84" Width="23" Height="23"><Tooltip>Set PREV Leg</Tooltip>  	<Cursor Type="DownArrow"/>  	<Click Kind="LeftSingle">@Button1</Click>	</Area><Macro Name="Button2">(L:SACDAT mode,enum) 4 == (L:ChgWPt, number) (A:GPS FLIGHT PLAN WP COUNT, number) 0 - <if{(A:GPS FLIGHT PLAN WP INDEX, number) ++ (> L:ChgWPt, number)(L:ChgWPt, number) (> C:fs9gps:directToActivateLeg)(L:ChgWPt, number) (> C:fs9gps:FlightPlanWaypointIndex)(L:ChgWPt, number) (> C:fs9gps:FlightPlanDirectToWaypoint)(L:ChgWPt, number) (> C:fs9gps:FlightPlanActiveWaypoint) }</Macro>	<Area Left="176" Top="84" Width="23" Height="23"><Tooltip>Set NEXT Leg</Tooltip>  	<Cursor Type="UpArrow"/>  	<Click Kind="LeftSingle">@Button2</Click>	</Area>  <Area Left="124" Top="84" Width="23" Height="23">  <Tooltip>%SEQ Legs</Tooltip>  <Click>(L:Story Canyon,enum) ! (>L:Story Canyon,enum)</Click>  <Cursor Type="Hand" />  </Area><Macro Name="Button3">(M:Event) 'RightSingle' scmp 0 == if{ (L:F111_Leg_10s, number) -- 0 max (> L:F111_Leg_10s, number) }	(M:Event) 'LeftSingle' scmp 0 ==  if{ (L:F111_Leg_10s, number) ++ 9 min (> L:F111_Leg_10s, number) }	(M:Event) 'WheelUp' scmp 0 == if{ (L:F111_Leg_10s, number) ++ 9 min (> L:F111_Leg_10s, number) }	(M:Event) 'WheelDown' scmp 0 == if{ (L:F111_Leg_10s, number) -- 0 max (> L:F111_Leg_10s, number) }</Macro>	<Area Left="193" Top="175" Width="21" Height="25">  <Tooltip>Tens</Tooltip>  <Click Kind="LeftSingle+RightSingle+WheelUp+WheelDown">@Button3</Click>  <Cursor Type="Hand" />  </Area> <Macro Name="Button4">(M:Event) 'RightSingle' scmp 0 == if{ (L:F111_Leg_1s, number) -- 0 max (> L:F111_Leg_1s, number) }	(M:Event) 'LeftSingle' scmp 0 ==  if{ (L:F111_Leg_1s, number) ++ 9 min (> L:F111_Leg_1s, number) }	(M:Event) 'WheelUp' scmp 0 == if{ (L:F111_Leg_1s, number) ++ 0 max (> L:F111_Leg_1s, number) }	(M:Event) 'WheelDown' scmp 0 == if{ (L:F111_Leg_1s, number) -- 9 min (> L:F111_Leg_1s, number) }</Macro>   <Area Left="217" Top="175" Width="21" Height="25">  <Tooltip>Units</Tooltip>  <Click Kind="LeftSingle+RightSingle+WheelUp+WheelDown">@Button4</Click>  <Cursor Type="Hand" />  </Area>    <Macro Name="Button5">(L:SACDAT mode,enum) 4 == (L:ChgWPt, number) (A:GPS FLIGHT PLAN WP COUNT, number) 0 >if{	(L:F111_Leg_Sum, number) (> L:ChgWPt, number)(L:ChgWPt, number) (> C:fs9gps:directToActivateLeg)(L:ChgWPt, number) (> C:fs9gps:FlightPlanWaypointIndex)(L:ChgWPt, number) (> C:fs9gps:FlightPlanDirectToWaypoint)(L:ChgWPt, number) (> C:fs9gps:FlightPlanActiveWaypoint) }</Macro>	<Area Left="166" Top="193" Width="23" Height="25"><Tooltip>Set SEQ No</Tooltip>  	<Cursor Type="Hand" />  	<Click Kind="LeftSingle">@Button5</Click>	</Area></Mouse></Gauge>

Share this post


Link to post
Share on other sites

ERRATUM The " Units " mouse button in the above code will scroll outside the range 0 - 9 , it didn't bother me and I could live with it.However , I noticed it could be fixed. Below is replacement code that functions correctly when the Wheel is used. CheersKarol

<Macro Name="Button4">(M:Event) 'RightSingle' scmp 0 == if{ (L:F111_Leg_1s, number) -- 0 max (> L:F111_Leg_1s, number) } 	(M:Event) 'LeftSingle' scmp 0 ==  if{ (L:F111_Leg_1s, number) ++ 9 min (> L:F111_Leg_1s, number) } 	(M:Event) 'WheelUp' scmp 0 == if{ (L:F111_Leg_1s, number) ++ 9 min (> L:F111_Leg_1s, number) } 	(M:Event) 'WheelDown' scmp 0 == if{ (L:F111_Leg_1s, number) -- 0 max (> L:F111_Leg_1s, number) }</Macro>    <Area Left="217" Top="175" Width="21" Height="25">  <Tooltip>Units</Tooltip>  <Click Kind="LeftSingle+RightSingle+WheelUp+WheelDown">@Button4</Click>  <Cursor Type="Hand" />  </Area>

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.
×
×
  • Create New...