Jump to content

Mouse click XML coding


okbob

Recommended Posts

Now I am trying to get an A/P gauge button to distinguish between a "click" (to perform one function) and a "press and hold for a moment" (to perform a different function).

 

I have tried "leftClick + leave" but without success. Although I did find this to be useful to show the button being down until released (like true mechanical buttons).

 

The Microsoft SDK is disturbingly silent on the mouse functions, and Nick Pike's great tutorials covers only the rudimentary use. I've even looked through the XML coding of other gauges posted in FlightSim but am not having any luck.

 

I would much obliged for any help you could give me to steer me in the right direction.

 

Thanks and happy Saturday, OkBob

Link to comment
Share on other sites

You could try something like this ,

 (M:Event) 'RightSingle' scmp 0 == if{ (L:Nu_Digit_0.01s, number) -- 0 max (> L:Nu_Digit_0.01s, number) }
   	(M:Event) 'LeftSingle' scmp 0 ==  if{ (L:Nu_Digit_0.01s, number) ++ 9 min (> L:Nu_Digit_0.01s, number) }
   	(M:Event) 'WheelUp' scmp 0 == if{ (L:Nu_Digit_0.01s, number) ++ 9 min (> L:Nu_Digit_0.01s, number) }
   	(M:Event) 'WheelDown' scmp 0 == if{ (L:Nu_Digit_0.01s, number) -- 0 max (> L:Nu_Digit_0.01s, number) }

0.01s
@Button4

 

you can make multi function buttons with visibilities included , such as this ,

    (L:DAT49 mode,enum) 0 == if{ (L:DAT49 unit,bool) ! (>L:DAT49 unit,bool) } 
       (L:DAT49 mode,enum) 2 == if{ (>K:NAV1_RADIO_SWAP) (>K:FREQUENCY_SWAP) } 
	   (L:DAT49 mode,enum) 4 == if{ (L:Display mode,enum) 0 == } if{ 'A' (>@c:IcaoSearchStartCursor) 
			(L:F111-DEST-4,number) chr (L:F111-DEST-3,number) chr 
			(L:F111-DEST-2,number) chr (L:F111-DEST-1,number) chr scat scat scat (>@c:IcaoSearchEnterChar) 
			0 (>@c:FlightPlanWaypointIndex)
			(@c:IcaoSearchMatchedIcaosNumber,number) 0 > 
				if{ (@c:IcaoSearchCurrentIcao) (>@c:FlightPlanNewWaypointICAO) } 
			1 (>@c:FlightPlanDirectToDestination)
               0 (>L:FPEntry, enum)
               0 (>L:F111-DEST-1,enum) 0 (>L:F111-DEST-2,enum) 0 (>L:F111-DEST-3,enum) 0 (>L:F111-DEST-4,enum)				

			'A' (>@c:IcaoSearchStartCursor)
			(L:F111-SEQA-4,number) chr (L:F111-SEQA-3,number) chr 
			(L:F111-SEQA-2,number) chr (L:F111-SEQA-1,number) chr scat scat scat (>@c:IcaoSearchEnterChar) 
			0 (>@c:FlightPlanWaypointIndex)
			(@c:IcaoSearchMatchedIcaosNumber,number) 0 > 
				if{ (@c:IcaoSearchCurrentICAO) (>@c:FlightPlanNewWaypointICAO) } 
			1 (>@c:FlightPlanAddWaypoint)
			0 (>L:FPEntry, enum)
			0 (>L:F111-SEQA-1,enum) 0 (>L:F111-SEQA-2,enum) 0 (>L:F111-SEQA-3,enum) 0 (>L:F111-SEQA-4,enum)	}			   
       (L:DAT49 mode,enum) 4 == (L:Display mode,enum) 1 == (L:TypEntry, enum) 0 == and and
             if{ (L:latitude best,number) (>@c:FlightPlanNewWaypointLatitude, degrees)
               (L:longitude best,number) (>@c:FlightPlanNewWaypointLongitude, degrees)
			'TGT' (L:F111_Wpt_Sum, number) near scat (>@c:FlightPlanNewWaypointIdent)			
			(L:F111_Wpt_Sum, number) (>@c:FlightPlanAddWaypoint)
			0 (>L:FPEntry, enum)
			0 (>C:fs9gps:IcaoSearchStopCursor) }
          (L:DAT49 mode,enum) 4 == (L:Display mode,enum) 1 == (L:TypEntry, enum) 1 == and and
             if{ 0 (>@c:FlightPlanWaypointIndex)
               (L:latitude best,number) (>@c:FlightPlanNewWaypointLatitude, degrees)
               (L:longitude best,number) (>@c:FlightPlanNewWaypointLongitude, degrees)
			'TGT' (L:F111_Wpt_Sum, number) near scat (>@c:FlightPlanNewWaypointIdent)
			1 (>@c:FlightPlanDirectToDestination)
               0 (>L:FPEntry, enum) }
       (L:DAT49 mode,enum) 4 == (L:Display mode,enum) 1 == (L:TypEntry, enum) 2 == and and
             if{ (L:latitude best,number) (>@c:FlightPlanNewWaypointLatitude, degrees)
               (L:longitude best,number) (>@c:FlightPlanNewWaypointLongitude, degrees)
			'TGT' (L:F111_Wpt_Sum, number) near scat (>@c:FlightPlanNewWaypointIdent)			
			(L:F111_Wpt_Sum, number) (>@c:FlightPlanAddWaypoint)
			(L:F111_Wpt_Sum, number) 1 + (>@c:FlightPlanDeleteWaypoint)				
			0 (>L:FPEntry, enum)
			0 (>C:fs9gps:IcaoSearchStopCursor) } 
	   (L:DAT49 mode,enum) 4 == (L:StandOff mode,enum) 4 == and 
			if{ 
			(L:DistMove,nmiles) 1 + (>L:DistMove,nmiles) (L:DistMove,nmiles) 301 == if{ 300 (>L:DistMove,nmiles) } 
			} 
	   (L:DAT49 mode,enum) 4 == (L:StandOff mode, enum) 2 == and  
		    if{ (L:latitude best,number) (>L:RequiredWaypointLatitude, degrees)
               (L:longitude best,number) (>L:RequiredWaypointLongitude, degrees)
			0 (>L:FPEntry, enum) }


(L:DAT49 mode,enum) 3 == if{ (>K:HEADING_BUG_INC) } @Button9

 

Cheers

Karol

Link to comment
Share on other sites

Karol, wow, those are awesome. It will take me some time to understand your second script, but I will put in the time to understand. As Isaac Newton said, "If I have seen further, it is by standing on the shoulders of giants."

Thanks again, OkBob

Link to comment
Share on other sites

Theoretically speaking, you should be able to do something like this:

 

- Mouseclick sets a bool variable to true

- Select element: as long as this variable is true, a counter is raised by 1

- Select element: if the counter exceeds a certain value, your "hold" action is triggered

- Releasing the button sets the bool to false. If the counter was below your threshold value, your "click" action is performed. Counter is reset to 0.

Link to comment
Share on other sites

These are the available mouse functions from the FSX SDK ,

**START

Event Name User action

RightSingle Single-clicks right mouse button

MiddleSingle Single-clicks middle mouse button

LeftSingle Single-clicks left mouse button

RightDouble Double-clicks right mouse button

MiddleDouble Double-clicks middle mouse button

LeftDouble Double-clicks left mouse button

RightDrag Moves mouse while holding down right mouse button

MiddleDrag Moves mouse while holding down middle mouse button

LeftDrag Moves mouse while holding down left mouse button

Move Moves mouse

Down_Repeat Holds down mouse button

RightRelease Releases right mouse button

MiddleRelease Releases middle mouse button

LeftRelease Releases left mouse button

Wheel_Flip Changes the direction the mouse wheel is rotating

Wheel_Skip

Wheel_Up Rolls the mouse wheel “up”

Wheel_Down Rolls the mouse wheel “down”

Move_Repeat

Leave

GetAll Triggers any mouse event

LeftAll Either single-clicks the left button, releases the left button, or moves the mouse while holding down the left mouse button

RightAll Either single-clicks the right button, releases the right button, or moves the mouse while holding down the right mouse button

MiddleAll Either single-clicks the middle button, releases the middle button, or moves the mouse while holding down the middle mouse button

Wheel Scrolls wheel up or down

** END

 

an example


       (M:Event) 'RightSingle' scmp 0 == if{ (HERE place code for first AP function) }
   	(M:Event) 'LeftSingle' scmp 0 ==  if{ (HERE place code for second AP function) }


HERE your brief description
@Button1

 

The RightSingle and LeftSingle in both the Macro and the Click kind , can be any of the

Mouse types listed in the above SDK extract .

 

I hope this is of some help .

 

Cheers

Karol

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...