TARGET script editor questions
-
This post is deleted! -
Here’s mine if you want inspiration:
include "target.tmh" int main() { Configure(&HCougar, MODE_EXCLUDED); //Exclude all but WH Throttle Configure(&Joystick, MODE_EXCLUDED); Configure(&T16000, MODE_EXCLUDED); Configure(&LMFD, MODE_EXCLUDED); Configure(&RMFD, MODE_EXCLUDED); if(Init(&EventHandle)) return 1; SetKBRate(250, 50); SetKBLayout(KB_ENG); //Cursor Axes MapAxis(&Throttle, SCX, DX_X_AXIS); SetSCurve(&Throttle, SCX, 0, 10, 0, 0, 0); //LDZ, CDZ, RDZ, Curve, Scale MapAxis(&Throttle, SCY, DX_Y_AXIS,AXIS_REVERSED); SetSCurve(&Throttle, SCY, 0, 20, 0, 0, 0); //Throttle Axes //Left Throttle (4%-100% w/ 65-75 plateau @ 90%) MapAxis(&Throttle, THR_LEFT, DX_THROTTLE_AXIS); SetCustomCurve(&Throttle, THR_LEFT, LIST(0,4, 65,90, 75,90, 100,100)); //Cutoff Stepping MapKey (&Throttle, IDLELON, EXEC("TrimDXAxis(DX_THROTTLE_AXIS, 82);")); MapKeyR (&Throttle, IDLELON, EXEC("TrimDXAxis(DX_THROTTLE_AXIS, SET(0));")); //Right Throttle (Same profile as left) MapAxis(&Throttle, THR_RIGHT, DX_Z_AXIS); SetCustomCurve(&Throttle, THR_RIGHT, LIST(0,4, 65,90, 75,90, 100,100)); //Cutoff Stepping MapKey (&Throttle, IDLERON, EXEC("TrimDXAxis(DX_Z_AXIS, 82);")); MapKeyR (&Throttle, IDLERON, EXEC("TrimDXAxis(DX_Z_AXIS, SET(0));")); //Button-Driven Axes //Field of View MapKey(&Throttle, MSR, AXIS(DX_XROT_AXIS,-250,10)); MapKey(&Throttle, MSL, AXIS(DX_XROT_AXIS, 250,10)); //Range Knob MapKey(&Throttle, MSU, AXIS(DX_YROT_AXIS,-200,10)); MapKey(&Throttle, MSD, AXIS(DX_YROT_AXIS, 200,10)); //Antenna Elevation MapKey(&Throttle, CHF, AXIS(DX_ZROT_AXIS, 75,10)); MapKey(&Throttle, CHB, AXIS(DX_ZROT_AXIS,-75,10)); //Gear Lever KeyAxis(&Throttle, THR_FC, 0, AXMAP2(3, DX24, 0, DX5)); //Throttle Handle Binds MapKey(&Throttle, SC, DX1); //Cursor Enable MapKey(&Throttle, MSP, DX2); //Uncage MapKey(&Throttle, SPDF, DX7); //Speedbrake MapKey(&Throttle, SPDB, DX8); MapKey(&Throttle, BSF, DX9); //DGFT/MRM MapKey(&Throttle, BSB, DX10); MapKey(&Throttle, PSF, PULSE+LED(&Throttle, LED_INTENSITY, 0)); //Backlight Control MapKey(&Throttle, PSM, PULSE+LED(&Throttle, LED_INTENSITY, 43)); MapKey(&Throttle, PSB, PULSE+LED(&Throttle, LED_INTENSITY, 86)); MapKey(&Throttle, LTB, DX15); //Slap Switch MapKey(&Throttle, APUON, DX13); //Master Arm MapKey(&Throttle, APUOFF, PULSE+DX14); //Pulse to Allow Sim Use MapKey(&Throttle, LDGH, 'h'); //Gear Horn MapKey(&Throttle, CSU, DX29); //COMM Switch MapKey(&Throttle, CSR, DX30); MapKey(&Throttle, CSD, DX31); MapKey(&Throttle, CSL, DX32); MapKey(&Throttle, FLAPD, DX22); //AVTR Switch MapKey(&Throttle, FLAPU, DX23); MapKey(&Throttle, FLAPM, PULSE+DX3); MapKey(&Throttle, EFLNORM, PULSE+DX4); //Pitot Heat MapKey(&Throttle, EFLOVER, DX16); MapKey(&Throttle, EFRNORM, PULSE+DX18); //Radar Quiet MapKey(&Throttle, EFROVER, DX19); MapKey(&Throttle, EOLIGN, DX11); //MPO MapKey(&Throttle, EORIGN, DX12); //E-J MapKey(&Throttle, EACON, DX20); //Master Lights MapKey(&Throttle, EACOFF, PULSE+DX21); MapKey(&Throttle, RDRNRM, DX25); //Radar Altimeter MapKey(&Throttle, RDRDIS, PULSE+DX6); MapKey(&Throttle, APENG, DX26); //AP L (Cycle) MapKey(&Throttle, APPAT, DX27); //AP R Mode MapKey(&Throttle, APAH, PULSE+DX17); MapKey(&Throttle, APALT, DX28); } //event handler int EventHandle(int type, alias o, int x) { DefaultMapping(&o, x); //add event handling code here }
-
Thanks, Fred. Finally got it to work like I wanted.
-
I’ve encountered another problem. I want to map the emergency jettion button on the LG WRN Silence button on my throttle. Mapping L_CTL+‘j’ works fine only it doesnt require me to hold it to jettison as if it held the button in for me. The problem is i’d rather it don’t do that for safety reasons (lets say i hit the gear horn button by mistake) but i cant figure out why it does it! In the event tester it presses and releases just fine, why does the game think I’m holding the button?
-
TARGET is funny with combo key presses. Someone was having problems with the speedbrakes default buttons or some such. Use the device analyzer to see what the script is actually doing at runtime. I’ve never bothered to figure out how to remedy that because I don’t do the virtual keyboard thing if I can help it and if I must then I don’t use combo keys. I made the spring-loaded IGN switches Master Pitch Override and E-JETT respectively but they are DX# buttons.
Tangentially related if you want a layer of safety for pressing that button try the TEMPO command like:
MapKey(&Throttle, LDGH, TEMPO(0, DX1, 500)); -
Got it to work properly by changing the key to only j instead of ctrl-j. Once again, thanks for your help, Fred!
-
Got it to work properly by changing the key to only j instead of ctrl-j. Once again, thanks for your help, Fred!
If you can use e.g. the Boat Switch-button, you can use:
//BS
MapKey(&Throttle, BSF, CHAIN(DOWN + L_ALT, ‘2’) ); // VHF ON
MapKey(&Throttle, BSM, UP + L_ALT); // VHF OFFor e.g. as RangeKnob:
MapKey(&Throttle, BSF, CHAIN(DOWN + L_CTL, F4) ); // RangeKnob inc
MapKey(&Throttle, BSM, UP + L_CTL); // Stop inc/dec
MapKey(&Throttle, BSB, CHAIN(DOWN + L_CTL, F3) ); // RangeKnob decIn your case:
MapKey(&Throttle, BSF, CHAIN(DOWN + L_CTL, ‘j’) ); // Jettison all
MapKey(&Throttle, BSM, UP + L_CTL); // doneThese you can use with every button, which has a middle position…
And, these you can use e.g. also for the RangeKnob, AntennaTilt…, when you has set the axis in BMS to ‘keyboard’. But remember, when using the DOWN command, always using the UP command!
The only problem is, when using e.g. RangeKnob (in this way), that also FCR-range inc/dec.
In this case, and you do not like that behavior, you should use from the (combined) controller an axis in BMS, which can be used also with TARGET. Then only e.g. TGP zoom in/out, but FCR do not change.E.g. like that:
//CHINA HAT CH --------------------------------------------------------------------
// TGP zoom increase, SHIFT: AntennaTilt up
MapKeyIO(&Throttle, CHF, AXIS(DX_SLIDER_AXIS, 150, 20), AXIS(DX_THROTTLE_AXIS, -500, 20));
// TGP zoom decrease, SHIFT: AntennaTilt down
MapKeyIO(&Throttle, CHB, AXIS(DX_SLIDER_AXIS, -150, 20), AXIS(DX_THROTTLE_AXIS, 500, 20));
In BMS:
// Radar Antenna == Slider_Axis
// RangeKnob == Throttle_AxisAnd, yes, I also noticed that, as it looks in the ‘Event Tester’, it should work “from default”…but isn’t.
Why? Do not know (yet)…HTH
Earlybite -
“The only problem is, when using e.g. RangeKnob (in this way), that also FCR-range inc/dec.”
?? Range Knob does not change the range of the FCR.
-
“The only problem is, when using e.g. RangeKnob (in this way), that also FCR-range inc/dec.”
?? Range Knob does not change the range of the FCR.
Oh yes, it does…, if u use BMS Axis ‘keyboard’ and STRG F3/F4.
-
That’s not the range knob.