Jump to content

TARGET/Programming issues with Key Combinatons


Recommended Posts

[VAF]HomeFries
Posted (edited)

Hi everyone,

 

I'm an experienced simmer and programmer, and I am in the process of adding an IL-2 BoS TARGET profile to my integrated DCS script.  I have a working profile, but I'm running into a problem where pressing key combinations often actuates the unmodified key.  For example, LWIN+B cycles bomb modes, but this macro in TARGET will more often than not just press B to drop the bomb.

 

Inserting delays between the modifier and active key, I have tried the following combinations with no luck:

define	IL2GB_BombModeCycle			CHAIN(USB_LEFTGUI,D(10),USB_B)
define	IL2GB_BombModeCycle			CHAIN(DOWN+USB_LEFTGUI,D(10),PULSE+USB_B,D(10),UP+USB_LEFTGUI)
define	IL2GB_BombModeCycle			CHAIN(DOWN+USB_LEFTGUI,D(20),PULSE+USB_B,D(20),UP+USB_LEFTGUI)

The last 2 entries are designed to press the modifier before the keystroke and release the modifier after the keystroke, and even with a delay of 20ms I can't get this to work.  Note: I'm using IvanWFR's custom header file for the USB_xxx entries,which translate them directly to USB hex codes.

 

I realize I could just use DirectX commands to get around this, but I'm hoping to maximize use of default keys so that I can release this profile to the public with minimal work required to get it running on someone else's system.

 

Has anybody experienced this, and does anybody have any solutions or suggestions?

 

Thanks in advance.

Edited by [BVS]HomeFries
fubar_2_niner
Posted (edited)
1 hour ago, [BVS]HomeFries said:

Hi everyone,

 

I'm an experienced simmer and programmer, and I am in the process of adding an IL-2 BoS TARGET profile to my integrated DCS script.  I have a working profile, but I'm running into a problem where pressing key combinations often actuates the unmodified key.  For example, LWIN+B cycles bomb modes, but this macro in TARGET will more often than not just press B to drop the bomb.

 

Inserting delays between the modifier and active key, I have tried the following combinations with no luck:


define	IL2GB_BombModeCycle			CHAIN(USB_LEFTGUI,D(10),USB_B)
define	IL2GB_BombModeCycle			CHAIN(DOWN+USB_LEFTGUI,D(10),PULSE+USB_B,D(10),UP+USB_LEFTGUI)
define	IL2GB_BombModeCycle			CHAIN(DOWN+USB_LEFTGUI,D(20),PULSE+USB_B,D(20),UP+USB_LEFTGUI)

The last 2 entries are designed to press the modifier before the keystroke and release the modifier after the keystroke, and even with a delay of 20ms I can't get this to work.  Note: I'm using IvanWFR's custom header file for the USB_xxx entries,which translate them directly to USB hex codes.

 

I realize I could just use DirectX commands to get around this, but I'm hoping to maximize use of default keys so that I can release this profile to the public with minimal work required to get it running on someone else's system.

 

Has anybody experienced this, and does anybody have any solutions or suggestions?

 

Thanks in advance.

Hi HomeFries,

 

Just finished this a few days ago, not had time to really put it thru the paces as yet. It may be a tad busy for your liking but it may give you a clue as to how to get things going..... Catch

 

Remember to rename the extension to a *.fcf file

 

Hope this helps.

 

Best regards.

 

fubar

 

PS using warthog HOTAS and T-Pendular rudder my end

Nex Box v3.101b.txt

Edited by fubar_2_niner
[VAF]HomeFries
Posted (edited)

Thanks for the reply, Fubar.

 

I was thinking that 20ms should be enough delay, but your profile uses 25ms.  I bumped mine up to 30ms and it worked better.  I still ended up remapping (B)ombs and (R)ockets to DirectX to prevent inadvertent firing when mode cycling is repeated in quick succession, but remapping two buttons is a small price to pay.

 

Best,

HF

 

P.S.  So how do you like the Pendular?

Edited by [BVS]HomeFries
fubar_2_niner
Posted

I can thoroughly recommend the Pendular mate, best pedals  I've had. They are built like a tank and the build quality is superb. A tad pricey true but worth the money if you have some spare cash.

 

Best regards.

 

fubar

  • 2 months later...
[VAF]HomeFries
Posted (edited)

I finally figured it out!

 

It's not just a matter of having the modifier (e.g. LCTL) on before the key is pressed.  The modifier has to be on the whole time and released after the keypress is also released.  Otherwise, both the modified function and the unmodified function will be cycled.

 

Here's what I did:

1) Set

SetKBRate(75, 100);

on main() to allow a slightly longer keypress and delay than normal.

 

2) I use the following convention for macros.  Note that I include IvanWFR's util_usb.tmh header file to allow me to use "plain English" while directly calling USB codes for the following keys.

define	IL2GB_Airbrakes		CHAIN(DOWN+USB_RIGHTALT,D(25),PULSE+USB_B,D(100),UP+USB_RIGHTALT)		//R_ALT+USB_B

where I press the modifier (RALT) 25ms prior to pulsing the B key for 75ms, then 100ms later release the modifier (RALT).  This seems to work well for keys that don't need to be spammed (like deconflicting navigation lights and landing lights with cockpit lighting).

 

3) For modified keys that require frequent repeats or holds (e.g. radiator open/close), I do the following with the macros:

define	IL2GB_WaterRadiator_Close_P	CHAIN(DOWN+USB_RIGHTCONTROL,D(25),USB_HYPHEN)		//R_CTL+USB_HYPHEN
define	IL2GB_WaterRadiator_Open_P	CHAIN(DOWN+USB_RIGHTCONTROL,D(25),USB_EQUALSIGN)	//R_CTL+USB_EQUALSIGN

define	IL2GB_RCTL_R			CHAIN(D(100),UP+USB_RIGHTCONTROL)			//releases RCTL

Then do the following in the profile (e.g. in main() )

MapKey	(&RMFD,	GAIND,	IL2GB_WaterRadiator_Open_P);
MapKey	(&RMFD,	GAINU,	IL2GB_WaterRadiator_Close_P);
MapKeyR	(&RMFD,	GAIND,	IL2GB_RCTL_R);
MapKeyR	(&RMFD,	GAINU,	IL2GB_RCTL_R);

This has the effect of pressing and holding the modifier prior to holding the activation keypress, then only releasing the modifier 100ms after the button has been released.

 

Hope this helps!

Edited by [BVS]HomeFries
added link
Posted (edited)

Are you using the "Press/Release" modifier in the Pulse/Hold/Press/Release section?......   I usually do the Press LCTL....... b..... Release b....... Release LCTL and I have a hard time getting it to work sometimes for some commands, the bomb release, Wheels, Flaps, Autopilot functions are a bitch go get working correctly.  So I just usually change the flaps from modifier F to just X and that solves that problem, and change bomb release to a different keystroke and that solves that problem.  So you are saying use LCTL.... 25ms delay.... press b and then a 100ms delay and just release LCTL?.... you don't release the b stroke?

 

Hoss

 

edit:  I used the Press/Release above the event name/keystroke to get it to work with no problems. 

Button: FLAPU

Press/Release:  Press

Event Name:  Flaps Up

Key command:  L_SHIFT

Type: Hold

Delay: None

Add Event/Save Event

 

Still under event Flaps Up

Key command: f

Type: Hold

Delay: 75ms

Add Event/Save Event

 

Button FLAPU

Press/Release:  Release

Event Name: Flaps Up

Key Command: f

Type: Release

Delay: 50ms

Add Event/Save Event

 

Still under event Flaps Up

Key Command: L_SHIFT

Type: Release

Delay: 75ms

Add Event/Save Event

 

Of course Flaps down is just F so you're safe there, but it works now.  I did this for all of the ones I was having trouble with, if it doesn't have a hold function for it to work you can use Press under Type. 

 

Hope it helps.

 

 

Edited by 325th_Hoss
Experimentation
[VAF]HomeFries
Posted

Hi Hoss,

 

I actually use the script editor instead of the GUI, but yes, what you have is essentially the same logic.

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