Jump to content

Target script dual action


dureiken

Recommended Posts

You need to use the CHAIN() command like the following:

MapKey(&Joystick, H3D, CHAIN(DX13, PULSE+R_SHIFT+'h')); 

This will press DX13, as well as Pulse R_SHIFT+'h' pretty much simultaneously.  DX13 will be held down as long as H3D is held but R_SHIFT+'h' will be momentary. Read up on CHAIN() and using D() in CHAIN() if you want to control delays between when the keys are pressed.  You can use D(100), for example between any items in the CHAIN() to cause a 100ms delay.  

  • Like 1
Link to comment
Share on other sites

On 4/27/2022 at 11:58 PM, Drakoz said:

You need to use the CHAIN() command like the following:

MapKey(&Joystick, H3D, CHAIN(DX13, PULSE+R_SHIFT+'h')); 

This will press DX13, as well as Pulse R_SHIFT+'h' pretty much simultaneously.  DX13 will be held down as long as H3D is held but R_SHIFT+'h' will be momentary. Read up on CHAIN() and using D() in CHAIN() if you want to control delays between when the keys are pressed.  You can use D(100), for example between any items in the CHAIN() to cause a 100ms delay.  

DX13 is DMS down for me, so I want to be able to make long press.

I tested

MapKey(&Joystick, H3D, CHAIN(DX13, PULSE+R_SHIFT+'h')); 

DX13 works, not Rshift+h

MapKey(&Joystick, H3D, PULSE+R_SHIFT+'h', DX13); 

Rshift+h works, not DX13

 

if you can help me 🙂 thanks

Link to comment
Share on other sites

Here is a complete script with a couple extra commands to test with.  This worked fine for me.  

I am testing this with the Thrustmaster TARGET Event Tester to see the keyboard commands (it shows press and release times - much better for testing), and for checking for the DX button presses, I used the Windows "Game Controllers" control panel (press the Windows key, type "Game Controllers" and it will list "Set up USB game controllers".  Run that tool.  Run your script.  The controller "Thrustmaster Combined" should show up in the Game Controllers List.  Double click on it, and you'll see all the DX buttons.  Of course, you can use the TARGET Device Analyzer as well for this.  Sometimes Device Analyzer has problems in Windows 10, though, but it worked fine for this script on my system today.  

Note, any button that is not defined in a TARGET script will send its default DirectX button.  But when defined in a MapKey command it will no longer send the default DirectX DX button.  Hence why we must define DX13 in the example below.  Just FYI if you didn't know.

So in the example below, H3R should send DX12 as that is its normal default - I didn't define H3R.  But H3U, H3D, and H3L will only send DX13 when commanded.  And in the example below, that will only occur with H3D and H3L.

If this isn't working in game, try it using the Event Tester, Game Controller control panel, or the TARGET Device Analyzer.  It should work. I have often seen people have trouble getting something to work in DCS, but worked fine in external test programs.  Then only to discover DCS wasn't configured properly.  So simplify your testing.  If it doesn't work in DCS right away, use the external test programs.  

And for sure, you must use CHAIN() to map two commands to a single button.  So yes, the following will never work:

MapKey(&Joystick, H3D, PULSE+R_SHIFT+'h', DX13); 

 

Here is my complete and tested script.  

include "target.tmh"

//program startup
int main()
{
	if(Init(&EventHandle)) return 1; // declare the event handler, return on error
	
	MapKey(&Joystick, H3D, CHAIN(DX13, PULSE+R_SHIFT+'h')); 
	MapKey(&Joystick, H3U, CHAIN('a', PULSE+R_SHIFT+'h')); 
	MapKey(&Joystick, H3L, DX13); 
}

//event handler
int EventHandle(int type, alias o, int x)
{
    DefaultMapping(&o, x);
}

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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