Re: TARGET + Warthog + TPR ne fonctionnent pas
Publié : sam. oct. 05, 2019 8:49 pm
par bebel
Merci pour les explications et la ligne de script (que j'ai insérée). Je teste avec le Device analyser dans le TARGET script editor: tout fonctionne. Dans le jeux, plus aucun axe à part la manette droite du throttle.
Copie du script de Noid:
include "target.tmh" //default Thrustmaster function
int Eject ;
int Jettison ;
int Chainled ;
int Primer ;
int main()
{
Configure(&LMFD,MODE_EXCLUDED);
Configure(&RMFD,MODE_EXCLUDED);
Configure(&HCougar,MODE_EXCLUDED);
Configure(&T16000,MODE_EXCLUDED);
Configure(&T16000L,MODE_EXCLUDED);
Configure(&TFRPRudder,MODE_EXCLUDED);
Configure(&TFRPHARudder, MODE_EXCLUDED);
if(Init(&EventHandle)) return 1; //event handler
//shift button
SetShiftButton(&Joystick,S4);
//set pulse and delay lengths
SetKBRate(50,100);
//LED init state
ActKey(PULSE+KEYON+LED(&Throttle, LED_INTENSITY, 214)); //set Throttle backlight power to 5/6
ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED0)); //set backlight OFF
ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED1)); //set LED 1 OFF
ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED2)); //set LED 2 OFF
ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED3)); //set LED 3 OFF
ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED4)); //set LED 4 OFF
ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED5)); //set LED 5 OFF
if(Throttle[EORNORM]) ActKey(PULSE+KEYON+LED(&Throttle,LED_ONOFF,LED_CURRENT+LED1));
if(Throttle[EORMOTOR]) ActKey(PULSE+KEYON+LED(&Throttle,LED_ONOFF,LED_CURRENT-LED1));
if(Throttle[EFLNORM]) ActKey(PULSE+KEYON+LED(&Throttle,LED_ONOFF,LED_CURRENT+LED2));
if(Throttle[EFLOVER]) ActKey(PULSE+KEYON+LED(&Throttle,LED_ONOFF,LED_CURRENT-LED2));
if(Throttle[FLAPU]) ActKey(PULSE+KEYON+LED(&Throttle,LED_ONOFF,LED_CURRENT-LED4));
if(Throttle[FLAPM]) ActKey(PULSE+KEYON+LED(&Throttle,LED_ONOFF,LED_CURRENT+LED4));
if(Throttle[FLAPD]) ActKey(PULSE+KEYON+LED(&Throttle,LED_ONOFF,LED_CURRENT-LED4));
if(Throttle[PSF]) ActKey(PULSE+KEYON+LED(&Throttle,LED_ONOFF,LED_CURRENT+LED5));
if(Throttle[PSM]) ActKey(PULSE+KEYON+LED(&Throttle,LED_ONOFF,LED_CURRENT-LED5));
if(Throttle[PSB]) ActKey(PULSE+KEYON+LED(&Throttle,LED_ONOFF,LED_CURRENT-LED5));
if(Throttle[EACON]) ActKey(PULSE+KEYON+LED(&Throttle,LED_ONOFF,LED_CURRENT+LED3));
if(Throttle[EACOFF]) ActKey(PULSE+KEYON+LED(&Throttle,LED_ONOFF,LED_CURRENT-LED3));
/////////////////////////////////////////
//Joystick and Throttle Axis Definitions/
/////////////////////////////////////////
MapAxis(&Joystick, JOYX, DX_X_AXIS);
MapAxis(&Joystick, JOYY, DX_Y_AXIS);
MapAxis(&Throttle, THR_LEFT, DX_ZROT_AXIS);
MapAxis(&Throttle, THR_RIGHT, DX_Z_AXIS);
//Shift slew to mouse with S4, Shift slider axe to 2nd slider with S4
MapKey(&Joystick, S4, EXEC("MapAxis(&Throttle,SCX,MOUSE_X_AXIS,AXIS_NORMAL,MAP_RELATIVE);"
"SetSCurve(&Throttle, SCX, 0, 10, 0, 0, -5);"
"MapAxis(&Throttle, SCY, MOUSE_Y_AXIS, AXIS_NORMAL, MAP_RELATIVE);"
"SetSCurve(&Throttle, SCY, 0, 10, 0, 0, -5);"
"MapAxis(&Throttle, THR_FC, DX_THROTTLE_AXIS);"
));
MapKeyR(&Joystick, S4, EXEC("MapAxis(&Throttle, SCX, DX_XROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);"
"SetSCurve(&Throttle, SCX, 0, 0, 0, 0, 0);"
"MapAxis(&Throttle, SCY, DX_YROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);"
"SetSCurve(&Throttle, SCY, 0, 0, 0, 0, 0);"
"MapAxis(&Throttle, THR_FC, DX_SLIDER_AXIS);"
));
//Slew
MapAxis(&Throttle, SCX, DX_XROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&Throttle, SCX, 0, 0, 0, 0, 0);
MapAxis(&Throttle, SCY, DX_YROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&Throttle, SCY, 0, 0, 0, 0, 0);
//Slew click
MapKeyIO(&Throttle,SC,MOUSE_LEFT,USB[0x5D]); //mouse click, usb code 'num5' for trackir center
//Free assign to throttle friction lever in DCS
MapAxis(&Throttle, THR_FC, DX_SLIDER_AXIS);
printf(" \xa");
printf(" --------[ NOiD Spitfire LF Mk.IX Profile 2.9 ]-------- \xa");
printf(" \xa");
//////////////////////////////
//Joystick Button Definitions/
//////////////////////////////
MapKey(&Joystick,TG1,USB[0x2C]); //usb code 'SPC' 1st trigger MG
MapKey(&Joystick,TG2,L_ALT+USB[0x0A]); //usb code 'g' 2nd trigger MG + Canons
MapKeyIO(&Joystick,S1,PULSE+L_ALT+USB[0x34],L_ALT+USB[0x33]); //usb code ''' refuel reload, ';' Canon
MapKey(&Joystick,S2,R_SHIFT+USB[0x2C]); // Bomb release usb code 'SPC'
MapKey(&Joystick,S3,USB[0x1A]); // BRAKES usb code 'w'
//trim
MapKey(&Joystick,H1U,USB[0x60]); //view up usb code 'num8'
MapKey(&Joystick,H1D,USB[0x5A]); //view down usb code 'num2'
MapKey(&Joystick,H1L,USB[0x5C]); //view left usb code 'num4'
MapKey(&Joystick,H1R,USB[0x5E]); //view right usb code 'num6'
//tms
MapKey(&Joystick,H2U,USB[0x54]); //usb code '*' zoom -
MapKey(&Joystick,H2D,USB[0x55]); //usb code '/' zoom +
MapKey(&Joystick,H2L,0); //
MapKey(&Joystick,H2R,0); //
//dms
MapKeyIO(&Joystick,H3U,R_SHIFT+USB[0x12],R_CTL+USB[0x33]); //HUD DISTANCE + usb code 'o', trim usb code ';'
MapKeyIO(&Joystick,H3D,R_CTL+USB[0x12],R_CTL+USB[0x37]); //HUD DISTANCE - usb code 'o', trim usb code '.'
MapKeyIO(&Joystick,H3L,L_SHIFT+USB[0x12],R_CTL+USB[0x36]); //HUD WINGSPAN + usb code 'o', trim usb code ','
MapKeyIO(&Joystick,H3R,L_CTL+USB[0x12],R_CTL+USB[0x38]); //HUD WINGSPAN - usb code 'o', trim usb code '/'
//cms
MapKey(&Joystick,H4U,L_SHIFT+USB[0x11]); //Interior light LEFT + usb code 'n'
MapKey(&Joystick,H4D,L_CTL+USB[0x11]); //Interior light LEFT - usb code 'n'
MapKey(&Joystick,H4L,R_SHIFT+USB[0x11]); //Interior light RIGHT + usb code 'n'
MapKey(&Joystick,H4R,R_CTL+USB[0x11]); //Interior light RIGHT - usb code 'n'
MapKeyIO(&Joystick,H4P,TEMPO(USB[0x43],PULSE+USB[0x29],500),TEMPO(L_ALT+L_CTL+USB[0x15],PULSE+USB[0x48],500)); //usb code 'F10' map -LONG PRESS: Escape, mirror usb code 'r' -LONG PRESS: Pause
//////////////////////////////
//Throttle Button Definitions/
//////////////////////////////
//Functions definitions
Chainled = CHAIN(
LED(&Throttle,LED_ONOFF,LED_CURRENT^LED5),
LED(&Throttle,LED_ONOFF,LED_CURRENT^LED4),
LED(&Throttle,LED_ONOFF,LED_CURRENT^LED3),
LED(&Throttle,LED_ONOFF,LED_CURRENT^LED2),
LED(&Throttle,LED_ONOFF,LED_CURRENT^LED1
)); //STARTER ON LED ANIMATION
Eject = CHAIN(PULSE+LED(&Throttle,LED_ONOFF,LED_CURRENT^LED0),PULSE+L_CTL+USB[0x08]); //Chain needed for the ejection sequence on button "LDGH"
Primer = CHAIN(DOWN+USB[0x49],D(700),UP+USB[0x49],D(700));
//MIC
MapKeyIO(&Throttle,MSU,L_CTL+L_SHIFT+USB[0x3A],L_CTL+L_ALT+USB[0x35]); //usb code 'F1' for trackirpause, usb code '²' teamspeack whisper
MapKey(&Throttle,MSD,USB[0x35]); //usb code '²' teamspeack/Radio 1 Simple Radio
MapKey(&Throttle,MSL,DX6); //FREE
MapKey(&Throttle,MSR,SEQ(PULSE+L_CTL+USB[0x1E],PULSE+L_CTL+USB[0x1F],PULSE+L_CTL+USB[0x20],PULSE+L_CTL+USB[0x21],PULSE+L_CTL+USB[0x35])); //RADIO Cycle usb code '1-4 + '''
MapKeyIO(&Throttle,MSP,R_ALT+USB[0x35],DX2); //L_ALT+USB[0x35] Radio 2 Simple Radio, comm menu (in DCS)
//speedbrake
MapKeyIO(&Throttle,SPDB,PULSE+L_ALT+USB[0x0F],PULSE+L_CTL+USB[0x06]); //Torch on/off usb code 'L', Close Canopy usb code 'c'
MapKey(&Throttle,SPDM,0);
MapKey(&Throttle,SPDF,PULSE+L_SHIFT+USB[0x06]); //Open Canopy usb code 'c'
//Boat switch
MapKey(&Throttle,BSB,DX10); //FREE
MapKey(&Throttle,BSF,DX9); //FREE
//China hat
MapKey(&Throttle,CHB,DX12); //FREE
MapKey(&Throttle,CHF,L_SHIFT+USB[0x2C]); //Safety ON/OFF usb code 'SPC'
//Pinkie
MapKey(&Throttle,PSB,0); //
MapKey(&Throttle,PSM,CHAIN(PULSE+L_CTL+USB[0x18],PULSE+LED(&Throttle,LED_ONOFF,LED_CURRENT-LED5))); // LED5 OFF usb code 'u'
MapKey(&Throttle,PSF,CHAIN(PULSE+L_SHIFT+USB[0x18],PULSE+LED(&Throttle,LED_ONOFF,LED_CURRENT+LED5))); // LED5 ON usb code 'u'
//Left ap button
MapKeyIO(&Throttle,LTB,REXEC(0, 90, "ActKey(KEYON+Eject);"),DX15); //Ejection sequence, LED Blink, FREE
//Coolie
MapKeyIO(&Throttle,CSU,TEMPO(PULSE+USB[0x3A],AXIS(MOUSE_Z_AXIS, 2, 100),500),PULSE+USB[0x2F]); //view cockpitt usb code 'F1' -LONG PRESS:SCROLLWHEEL UP, Kneeboard previous usb code '['
MapKeyIO(&Throttle,CSD,TEMPO(PULSE+USB[0x3B],AXIS(MOUSE_Z_AXIS, -2, 100),500),PULSE+USB[0x30]); //view external usb code 'F2' -LONG PRESS:SCROLLWHEEL DOWN, Kneeboard next usb code ']'
MapKeyIO(&Throttle,CSL,PULSE+USB[0x3C],DXHATLEFT); //view flyby usb code 'F3', FREE
MapKeyIO(&Throttle,CSR,PULSE+USB[0x3D],PULSE+R_SHIFT+USB[0x0E]); //view arcade usb code 'F4', Kneeboard on/off usb code 'k'
//base
MapKeyIO(&Throttle,EFLNORM,0,CHAIN(PULSE+L_SHIFT+USB[0x27],D(),PULSE+LED(&Throttle,LED_ONOFF,LED_CURRENT+LED2))); //fuel pump ON usb code '0' LED2 ON
MapKeyIO(&Throttle,EFRNORM,0,PULSE+L_SHIFT+USB[0x17]); //fuel valve ON usb code '0'
MapKeyIO(&Throttle,EFLOVER,0,CHAIN(PULSE+L_CTL+USB[0x27],D(),PULSE+LED(&Throttle,LED_ONOFF,LED_CURRENT-LED2))); //fuel pump OFF usb code 't' LED2 OFF
MapKeyIO(&Throttle,EFROVER,0,PULSE+L_CTL+USB[0x17]); //fuel valve OFF usb code 't'
MapKeyIO(&Throttle,APUON,0,PULSE+L_SHIFT+USB[0x0B]); //Filter ON usb code 'h'
MapKeyIO(&Throttle,APUOFF,0,PULSE+L_CTL+USB[0x0B]); // Filter OFF usb code 'h'
MapKey(&Throttle,LDGH,L_CTL+L_SHIFT+USB[0x06]); //usb code 'c' DROP CANOPY
MapKey(&Throttle,FLAPU,CHAIN(PULSE+L_SHIFT+USB[0x0A],D(),PULSE+LED(&Throttle,LED_ONOFF,LED_CURRENT-LED4))); //GEAR UP usb code 'g' LED4 OFF
MapKeyIO(&Throttle,FLAPM,0,CHAIN(PULSE+L_CTL+USB[0x0A],D(),PULSE+L_ALT+L_CTL+USB[0x06],PULSE+LED(&Throttle,LED_ONOFF,LED_CURRENT+LED4))); //GEAR DOWN DOOR CLOSED usb code 'g' 'c' LED4 ON
MapKey(&Throttle,FLAPD,CHAIN(PULSE+L_ALT+L_SHIFT+USB[0x06],PULSE+LED(&Throttle,LED_ONOFF,LED_CURRENT-LED4))); //DOOR OPEN usb code 'c' LED4 OFF
MapKeyIO(&Throttle,EACON,0,CHAIN(PULSE+L_SHIFT+USB[0x09],D(),PULSE+LED(&Throttle,LED_ONOFF,LED_CURRENT+LED3))); //FLAPS DOWN usb code 'f' LED3 ON
MapKeyIO(&Throttle,EACOFF,0,CHAIN(PULSE+L_CTL+USB[0x09],D(),PULSE+LED(&Throttle,LED_ONOFF,LED_CURRENT-LED3))); //FLAPS UP usb code 'f' LED3 OFF
MapKeyIO(&Throttle,RDRNRM,0,PULSE+L_CTL+USB[0x19]); //HUD ON usb code 'v'
MapKeyIO(&Throttle,RDRDIS,0,PULSE+L_ALT+USB[0x19]); //HUD OFF usb code 'v'
MapKey(&Throttle,APENG,L_CTL+L_SHIFT+USB[0x17]); //DROP TANK usb code 't'
MapKeyIO(&Throttle,APPAT,0,PULSE+R_ALT+USB[0x0C]); // COMPRESSOR M.S. usb code 'i'
MapKeyIO(&Throttle,APAH,0,CHAIN(PULSE+L_CTL+USB[0x10],D(),PULSE+L_ALT+USB[0x0C])); // MIX ON - COMPRESSOR AUTO usb code 'm' 'i'
MapKeyIO(&Throttle,APALT,0,PULSE+L_SHIFT+USB[0x10]); // MIX CUTOFF usb code 'm'
MapKey(&Throttle,IDLELON,CHAIN(DX30,D(),LED(&Throttle,LED_ONOFF,LED_CURRENT-LED0))); //Idle->off backlight OFF
MapKey(&Throttle,IDLERON,CHAIN(DX29,D(),LED(&Throttle,LED_ONOFF,LED_CURRENT-LED0))); //Idle->off backlight OFF
MapKey(&Throttle,IDLEROFF,CHAIN(LED(&Throttle,LED_ONOFF,LED_CURRENT+LED0),D(),PULSE+DX32)); //Off->Idle backlight ON
MapKey(&Throttle,IDLELOFF,CHAIN(LED(&Throttle,LED_ONOFF,LED_CURRENT+LED0),D(),PULSE+DX31)); //Off->Idle backlight ON
MapKey(&Throttle,EOLIGN,CHAIN(PULSE+L_SHIFT+USB[0x49],REXEC(0, 1500, "ActKey(KEYON+Primer);"))); //Fuel primer usb code 'inser'
MapKeyR(&Throttle,EOLIGN,PULSE+L_SHIFT+USB[0x49]); //Fuel primer usb code 'inser'
MapKey(&Throttle,EORIGN,CHAIN(
PULSE+R_CTL+USB[0x15],
D(),
PULSE+L_CTL+USB[0x15],
D(),
PULSE+LED(&Throttle,LED_ONOFF,LED_CURRENT+LED1),
PULSE+LED(&Throttle,LED_ONOFF,LED_CURRENT+LED2),
PULSE+LED(&Throttle,LED_ONOFF,LED_CURRENT+LED3),
PULSE+LED(&Throttle,LED_ONOFF,LED_CURRENT+LED4),
PULSE+LED(&Throttle,LED_ONOFF,LED_CURRENT+LED5),
D(),
DOWN+USB[0x4A],
DOWN+USB[0x4C],
REXEC(0,100,
"ActKey(KEYON+Chainled);"
)));//Demarreur cover OPEN usb code 'r', Demarreur ON usb code 'home' Survolteur cover OPEN usb code 'r', Survolteur ON usb code 'suppr' LED1-5 BLINK
MapKeyR(&Throttle,EORIGN,CHAIN(
UP+USB[0x4A],
UP+USB[0x4C],
D(),
PULSE+R_ALT+USB[0x15],
D(),
PULSE+L_ALT+USB[0x15],
D(),
EXEC(
"if(Throttle[EORNORM]) ActKey(PULSE+KEYON+LED(&Throttle,LED_ONOFF,LED_CURRENT+LED1));"
"if(Throttle[EORMOTOR]) ActKey(PULSE+KEYON+LED(&Throttle,LED_ONOFF,LED_CURRENT-LED1));"
"if(Throttle[EFLNORM]) ActKey(PULSE+KEYON+LED(&Throttle,LED_ONOFF,LED_CURRENT+LED2));"
"if(Throttle[EFLOVER]) ActKey(PULSE+KEYON+LED(&Throttle,LED_ONOFF,LED_CURRENT-LED2));"
"if(Throttle[FLAPU]) ActKey(PULSE+KEYON+LED(&Throttle,LED_ONOFF,LED_CURRENT-LED4));"
"if(Throttle[FLAPM]) ActKey(PULSE+KEYON+LED(&Throttle,LED_ONOFF,LED_CURRENT+LED4));"
"if(Throttle[FLAPD]) ActKey(PULSE+KEYON+LED(&Throttle,LED_ONOFF,LED_CURRENT-LED4));"
"if(Throttle[PSF]) ActKey(PULSE+KEYON+LED(&Throttle,LED_ONOFF,LED_CURRENT+LED5));"
"if(Throttle[PSM]) ActKey(PULSE+KEYON+LED(&Throttle,LED_ONOFF,LED_CURRENT-LED5));"
"if(Throttle[PSB]) ActKey(PULSE+KEYON+LED(&Throttle,LED_ONOFF,LED_CURRENT-LED5));"
"if(Throttle[EACON]) ActKey(PULSE+KEYON+LED(&Throttle,LED_ONOFF,LED_CURRENT+LED3));"
"if(Throttle[EACOFF]) ActKey(PULSE+KEYON+LED(&Throttle,LED_ONOFF,LED_CURRENT-LED3));"
)));//Demarreur cover CLOSED usb code 'r' Survolteur cover CLOSED usb code 'r'
MapKeyIO(&Throttle,EOLNORM,0,PULSE+R_ALT+USB[0x0A]); //Magneto 1 ON usb code 'h'
MapKeyIO(&Throttle,EORNORM,0,CHAIN(PULSE+R_ALT+USB[0x0B],D(),PULSE+LED(&Throttle,LED_ONOFF,LED_CURRENT+LED1))); //Magneto 2 ON usb code 'g' LED1 ON
MapKey(&Throttle,EOLMOTOR,PULSE+L_ALT+USB[0x0B]); //Magneto 1 OFF usb code 'h'
MapKey(&Throttle,EORMOTOR,CHAIN(PULSE+R_CTL+USB[0x0B],PULSE+LED(&Throttle,LED_ONOFF,LED_CURRENT-LED1))); //Magneto 2 OFF usb code 'h' LED1 OFF
}
int EventHandle(int type, alias o, int x)
{
DefaultMapping(&o, x);
}