homepage

Advanced question: How to make a profile modular for either Cougar or Warthog

Posted By: HomeFries

Advanced question: How to make a profile modular for either Cougar or Warthog - 03/06/15 05:51 AM

You may be familiar with my DCS World TARGET Profile for the Cougar. I would like to make this profile Warthog compatible but with the complexity of the code I don't want to maintain two versions of the profile. I would actually like to make it modular with the primary controller selectable in declarations, and keeping if/else statements to a minimum. Having the profile compatible with both the Warthog and Cougar at the same time would be ideal for people with both controllers, but I need to get over the first hump.

I'm hoping for a straight-up solution to the problem; namely, I want to use the variables FLCS and TQS (I can't use Joystick and Throttle because those are the Warthog names) and have them assigned to either HCougar or Joystick/Throttle with a couple of lines in the file.

Here is the concept, though I get error messages no matter what I try:
Code:
include "target.tmh"

int FLCS;
int TQS;

//program startup
int main()
{
    if(Init(&EventHandle)) return 1; // declare the event handler, return on error
	
	//add initialization code here
FLCS=HCougar;
TQS=HCougar;


			MapAxis(&FLCS, JOYX, DX_X_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
			MapAxis(&FLCS, JOYY, DX_Y_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
			
			MapKey(&FLCS, S2, DX2);
			
			MapAxis(&TQS, THROTTLE, DX_Z_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
			
			MapKey(&TQS, T6, DX24);
}

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

}

I have also tried
FLCS=&HCougar;
TQS=&HCougar;
but got an error in target.tmh line 282

Any help would be greatly appreciated.

EDIT: I realize that the throttle nomenclature is completely different, but even making this work for the stick would be great.
Posted By: Aullido

Re: Advanced question: How to make a profile modular for either Cougar or Warthog - 03/16/15 04:08 AM

As you said the button nomenclature is different. You can have both throttles working at the same time, maybe you will need only a little axis configuration. Send me an PM and I will try to help you, I am working on a script for IL-2 4.12.2 and HSFX right now.
Posted By: HomeFries

Re: Advanced question: How to make a profile modular for either Cougar or Warthog - 03/16/15 06:28 PM

Thanks, Aullido. PM sent.

FYI, what I would like to do is monumentally more complicated than a couple of axes (which could be done with if/else staements). I used the axis commands as an example to keep things simple and on point.
© 2024 SimHQ Forums