qbcat Posted February 16, 2016 Posted February 16, 2016 (edited) so this is the part of my script which makes me crazy, the goal is to assign to the BOAT SWITCH the control of the 3 layers UP MIDDLE and DOWN: SetShiftButton(&Joystick,S3,&Throttle,BSF,BSB,UDTOGGLE); and assign the LTB button to input a "J" in up layer, a "G" in mid layer and "B" in down layer MapKeyUMD(&Throttle, LTB,PULSE+'j',PULSE+'g',PULSE+'b'); okay, it doesn't works! start in middle position, ok output is G, switch to forward position ok the output is J, return to middle position and.... the outpu is always J !!! switch to back position and output is B okay, switch back to middle position and output is always B !!!:(:( It seems that the middle position is not declared, what I can do? ****EDIT: SetShiftButton(0, 0, &Throttle, BSF, BSB,0); this way it works !!! Edited February 16, 2016 by qbcat resolved CPU:i5-8400@2,8GHz|GPU: GTX-1080Ti 11gb | RAM:48GB|Monitor LG38"" wide 3840x1600 | 2xSabrent SSD 2T Rocket NVMe PCIe M.2 2280| VKB GladiatorMKII Kosmosima| *** Perché volare? Semplice. Non sono felice a meno che non ci sia un po’ di spazio tra me e la terra. ***
Swaty Posted February 16, 2016 Posted February 16, 2016 Hello, what are you flying? Here is my profile for Bf-109. You might find some useful lines! include "target.tmh" int primer; int main() { if(Init(&EventHandle)) return 1; // declare the event handler, return on error SetKBRate(25,33); /////////////////////////////---COMMON LINES FOR ALL MODULES---//////////////////////////////////////////////////// ///////////////////////////---SHIFT Buttons---//////////////// ///////////////////////////---Configure I/O and U/M/D states---//////////////// SetShiftButton(&Joystick, S3, &Throttle, BSB, BSF); ///////////////////////////---Axis mapping Warthog Joystick---//////////////// MapAxis(&Joystick, JOYX, DX_X_AXIS, AXIS_NORMAL, MAP_ABSOLUTE); MapAxis(&Joystick, JOYY, DX_Y_AXIS, AXIS_NORMAL, MAP_ABSOLUTE); MapAxis(&Throttle, THR_LEFT, DX_XROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE); MapAxis(&Throttle, THR_RIGHT, DX_Z_AXIS, AXIS_NORMAL, MAP_ABSOLUTE); // Disable DX_ZROT_AXIS for Rudder because conflict with Rudder (same id) //MapAxis(&Throttle, SCX, DX_XROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE); MapAxis(&Throttle, SCY, DX_YROT_AXIS, AXIS_NORMAL, MAP_RELATIVE); MapAxis(&Throttle, THR_FC, DX_SLIDER_AXIS, AXIS_NORMAL, MAP_ABSOLUTE); ///////////////////////////---Axis Mapping Cougar---//////////////// MapAxis(&HCougar, THROTTLE, DX_Z_AXIS, AXIS_NORMAL, MAP_ABSOLUTE); MapAxis(&HCougar, MAN_RNG, DX_SLIDER_AXIS, AXIS_NORMAL, MAP_ABSOLUTE); MapAxis(&HCougar, ANT_ELEV, DX_THROTTLE_AXIS, AXIS_NORMAL, MAP_ABSOLUTE); MapAxis(&HCougar, RDR_X, DX_XROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE); MapAxis(&HCougar, RDR_Y, DX_YROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE); MapAxis(&HCougar, RUDDER, DX_ZROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE); ///////////////////////////---Axis Trimming [HAT 1]---//////////////// ///////////////////////////---X(S3 OUT) AND Z (Rudder) S3(IN)---//////////////// MapKeyIO(&Joystick, H1L, REXEC(0, 100,"TrimDXAxis(DX_ZROT_AXIS, -5);"),//Z REXEC(0, 100,"TrimDXAxis(DX_X_AXIS, -5);"));//X MapKeyIO(&Joystick, H1R, REXEC(1, 100,"TrimDXAxis(DX_ZROT_AXIS, 5);"),//Z REXEC(0, 100,"TrimDXAxis(DX_X_AXIS, 5);"));//X ///////////////////////////---Y---//////////////// MapKey(&Joystick, H1U, REXEC(1, 100, "TrimDXAxis(DX_Y_AXIS, -5);")); MapKey(&Joystick, H1D, REXEC(1, 100, "TrimDXAxis(DX_Y_AXIS, 5);")); ///////////////////////////---Cancel all Trims and Lock X-Y-Z---//////////////// MapKeyIO(&Joystick, S4, EXEC("TrimDXAxis(DX_X_AXIS, CURRENT);TrimDXAxis(DX_Y_AXIS, CURRENT); TrimDXAxis(DX_ZROT_AXIS, CURRENT);"),// Locks X- Y- Z to current position (just like Ka-50) EXEC("TrimDXAxis(DX_X_AXIS, SET(0));TrimDXAxis(DX_Y_AXIS, SET(0));TrimDXAxis(DX_ZROT_AXIS, SET(0));")); // Cancel All trims ( X- Y - Z ) ///////////////////////////---END OF COMMON LINES---///////////////// ////////////////---ON THE GROUND or CLOSE TO!---//////////////// ////////////////---Taxiing - Take off - Landing---////////////// ////////////////---Brakes---///////////////////// ////////////////---Wheel Brakes when D (Both)---//////////////// MapKeyUMD(&Throttle, SPDB, PULSE+'0', PULSE+'0', 'w'); ////////////////---Left and Right Wheel brakes S3 is pressed (IN)---//////////////// KeyAxis(&HCougar, RUDDER, 'i',AXMAP2(3,L_CTL+'w',PULSE+'0',L_ALT+'w')); ////////////////---Flaps (D) and cockpit illumination (U and M) MapKeyIOUMD(&Throttle,FLAPU, L_SHIFT+'n', R_SHIFT+'n', L_SHIFT+'n', R_SHIFT+'n', L_CTL+'f', L_CTL+'f'); MapKeyIOUMD(&Throttle,FLAPD, L_CTL+'n', R_CTL+'n', L_CTL+'n', R_CTL+'n', L_SHIFT+'f', L_SHIFT+'f'); ////////////////---Tail Wheel lock/unlock---//////////////// MapKeyIOUMD(&Joystick,H4P, PULSE+'0', PULSE+'0', PULSE+'0', PULSE+'0', CHAIN( DOWN+R_SHIFT, D(), DOWN+'t', D(), UP+'t', D(), UP+R_SHIFT), PULSE+'0'); ////////////////---Canopy Open Close---//////////////// MapKeyUMD(&Throttle,PSF, PULSE+'0', PULSE+'0', CHAIN( DOWN+L_CTL, D(), DOWN+'c', D(), UP+'c', D(), UP+L_CTL)); MapKeyUMD(&Throttle,PSB, PULSE+'0', PULSE+'0', CHAIN( DOWN+L_SHIFT, D(), DOWN+'c', D(), UP+'c', D(), UP+L_SHIFT)); ////////////////---Gears UP/Down---//////////////// MapKeyUMD(&Throttle,LDGH, PULSE+'0', PULSE+'0', PULSE+'g'); ////////////////---Engine Control---/////////////////// ////////////////---Start Up Procedure---//////////////// ////////---Pump Primer ( One press pumbs 5 times)---////////// primer = CHAIN( DOWN++INS,D(800), UP+INS,D(800), DOWN++INS,D(800), UP+INS,D(800), DOWN++INS,D(800), UP+INS,D(800), DOWN++INS,D(800), UP+INS,D(800), DOWN++INS,D(800), UP+INS,D(800));; MapKeyUMD(&Throttle, APENG, CHAIN( DOWN+L_SHIFT, D(), DOWN+'b', D(), UP+'b', D(), UP+L_SHIFT), CHAIN( DOWN+L_CTL, D(), DOWN+'b', D(), UP+'b', D(), UP+L_CTL), REXEC(0, 1000, "ActKey(KEYON+primer);")); /////////////////---Booster Pumps---//////////////// MapKeyUMD(&Throttle,MSL, PULSE+'0', PULSE+'0', CHAIN( DOWN+L_CTL, D(), DOWN+'t', D(), UP+'t', D(), UP+L_CTL)); MapKeyUMD(&Throttle,MSR, PULSE+'0', PULSE+'0', CHAIN( DOWN+L_SHIFT, D(), DOWN+'t', D(), UP+'t', D(), UP+L_SHIFT)); //////////////// Run inertial Starter (Ground Crew)(China Hat)//////////////// ////////////////---Governor Automation---//////////////// // Press for 1 Sec for Governor Automation and HOLD for Ground Crew MapKeyIO(&Throttle, CHB, CHAIN(PULSE+'\\', D(),PULSE+F8, D(),PULSE+F4),//////////////// Run inertial Starter PULSE+'s'/////// Governor Automatation ); ////////////////---Magnetos---//////////////// MapKeyUMD(&Throttle,MSU, PULSE+'0', PULSE+'0', CHAIN( DOWN+L_SHIFT, D(), DOWN+USB[0x4D], D(), UP+USB[0x4D], D(), UP+L_SHIFT)); MapKeyUMD(&Throttle,MSD, PULSE+'0', PULSE+'0', CHAIN( DOWN+L_CTL, D(), DOWN+USB[0x4D], D(), UP+USB[0x4D], D(), UP+L_CTL)); ////////////////---Start Engine (China Hat)---//////////////// // Press for 1 Sec to open cover and HOLD to start engine MapKeyUMD(&Throttle, CHF, PULSE+'0', PULSE+'0', TEMPO (HOME, L_WIN+HOME)); ////////////////---MW Boost System---/////////////// MapKeyIO(&Throttle, LTB, PULSE+'e', PULSE+'0'); ////////////////---Booster Pumps---/////////////// MapKeyIOUMD(&Throttle,MSL, CHAIN( DOWN+L_SHIFT, D(), DOWN+'a', D(), UP+'a', D(), UP+L_SHIFT), CHAIN( DOWN+L_CTL, D(), DOWN+'t', D(), UP+'t', D(), UP+L_CTL), CHAIN( DOWN+L_SHIFT, D(), DOWN+'a', D(), UP+'a', D(), UP+L_SHIFT), CHAIN( DOWN+L_CTL, D(), DOWN+'t', D(), UP+'t', D(), UP+L_CTL), CHAIN( DOWN+L_SHIFT, D(), DOWN+'a', D(), UP+'a', D(), UP+L_SHIFT), CHAIN( DOWN+L_CTL, D(), DOWN+'t', D(), UP+'t', D(), UP+L_CTL)); MapKeyIOUMD(&Throttle,MSR, CHAIN( DOWN+L_SHIFT, D(), DOWN+'a', D(), UP+'a', D(), UP+L_SHIFT), CHAIN( DOWN+L_SHIFT, D(), DOWN+'t', D(), UP+'t', D(), UP+L_SHIFT), CHAIN( DOWN+L_SHIFT, D(), DOWN+'a', D(), UP+'a', D(), UP+L_SHIFT), CHAIN( DOWN+L_SHIFT, D(), DOWN+'t', D(), UP+'t', D(), UP+L_SHIFT), CHAIN( DOWN+L_SHIFT, D(), DOWN+'a', D(), UP+'a', D(), UP+L_SHIFT), CHAIN( DOWN+L_SHIFT, D(), DOWN+'t', D(), UP+'t', D(), UP+L_SHIFT)); /////////////////---Coolant Controls---//////////////// //MapKeyUMD(&Throttle,CSL, //MapKeyUMD(&Throttle,CSR, /////////////////--- Engine Cut-Off (toggle)---//////////////// MapKeyUMD(&Throttle, IDLERON, PULSE+'0', PULSE+'0', 'm'); MapKeyUMD(&Throttle, IDLERON, PULSE+'0', PULSE+'0', 'm'); ////////////////--- Switch Panel--- //////////////// ////////////////---Generator---/////////////// MapKeyIOUMD(&Throttle, EOLIGN, PULSE+'v', PULSE+'v', PULSE+'v', PULSE+'v', PULSE+'v', PULSE+'v') ; ////////////////---Battery---/////////////// MapKeyIOUMD(&Throttle, EORIGN, PULSE+'b', PULSE+'b', PULSE+'b', PULSE+'b', PULSE+'b', PULSE+'b'); ////////////////---Ignition---/////////////// MapKeyIOUMD(&Throttle,EOLMOTOR, PULSE+'i', PULSE+'i', PULSE+'i', PULSE+'i', PULSE+'i', PULSE+'i'); MapKeyRIOUMD(&Throttle,EOLMOTOR, PULSE+'i', PULSE+'i', PULSE+'i', PULSE+'i', PULSE+'i', PULSE+'i'); ////////////////---Fuel Pumps---//////////////// MapKeyIOUMD(&Throttle, EORMOTOR, CHAIN( DOWN+R_ALT, D(), DOWN+'0', D(), UP+'0', D(), UP+R_ALT), CHAIN( DOWN+R_ALT, D(), DOWN+'0', D(), UP+'0', D(), UP+R_ALT), CHAIN( DOWN+R_ALT, D(), DOWN+'0', D(), UP+'0', D(), UP+R_ALT), CHAIN( DOWN+R_ALT, D(), DOWN+'0', D(), UP+'0', D(), UP+R_ALT), CHAIN( DOWN+R_ALT, D(), DOWN+'0', D(), UP+'0', D(), UP+R_ALT), CHAIN( DOWN+R_ALT, D(), DOWN+'0', D(), UP+'0', D(), UP+R_ALT)); MapKeyRIOUMD(&Throttle, EORMOTOR, CHAIN( DOWN+R_ALT, D(), DOWN+'0', D(), UP+'0', D(), UP+R_ALT), CHAIN( DOWN+R_ALT, D(), DOWN+'0', D(), UP+'0', D(), UP+R_ALT), CHAIN( DOWN+R_ALT, D(), DOWN+'0', D(), UP+'0', D(), UP+R_ALT), CHAIN( DOWN+R_ALT, D(), DOWN+'0', D(), UP+'0', D(), UP+R_ALT), CHAIN( DOWN+R_ALT, D(), DOWN+'0', D(), UP+'0', D(), UP+R_ALT), CHAIN( DOWN+R_ALT, D(), DOWN+'0', D(), UP+'0', D(), UP+R_ALT)); ////////////////---IFF---//////////////// MapKeyIOUMD(&Throttle,EFLNORM, PULSE+'9', PULSE+'9', PULSE+'9', PULSE+'9', PULSE+'9', PULSE+'9'); MapKeyRIOUMD(&Throttle,EFLNORM, PULSE+'9', PULSE+'9', PULSE+'9', PULSE+'9', PULSE+'9', PULSE+'9'); ////////////////---Radio---//////////////// MapKeyIOUMD(&Throttle,EFRNORM, PULSE+'8', PULSE+'8', PULSE+'8', PULSE+'8', PULSE+'8', PULSE+'8'); MapKeyRIOUMD(&Throttle,EFRNORM, PULSE+'8', PULSE+'8', PULSE+'8', PULSE+'8', PULSE+'8', PULSE+'8'); ////////////////---Navigation Lights[HAT 4]---//////////////// //////////////// Right Wheel Brake---//////////////// MapKeyIO(&Joystick, H4R, PULSE+'u', L_ALT+'w'//// Right Wheel Brake ); ///////////////---Cockpit Lights [HAT 4]---//////////////// ////////////////---Left Wheel Brake---//////////////// MapKeyIO(&Joystick, H4L, PULSE+ 'l', L_CTL+'w' ///// Left Wheel Brake ); ////////////////Views --Zoom In-Out [HAT3] //////////////// /////// Press for 1 Sec to FULL Zoom IN and HOLD for Slow MapKey(&Joystick, H3U, TEMPO (CHAIN( DOWN+R_SHIFT, D(), DOWN+USB[0x55], D(), UP+USB[0x55], D(), UP+R_SHIFT), //Full Zoom In USB[0x55])); //Zoom In Slow ///////Press for 1 Sec to ULL Zoom OUT and HOLD for Slow MapKey(&Joystick, H3D, TEMPO (CHAIN( DOWN+R_SHIFT, D(), DOWN+USB[0x54], D(), UP+USB[0x54], D(), UP+R_SHIFT), // Full Zoom Out USB[0x54])); //Zoom Out Slow MapKeyIO(&Joystick, H3L, USB[0x58],// Reset Zoom USB[0x5D]);// Center View ////////////////---Track IR Control---//////////////// MapKeyIO(&Joystick, H3R, PULSE+F9, //Track IR On/Off PULSE+F11); //Track IR Center ////////////////--- Gunsight Fold ---//////////////// MapKey(&Throttle,APPAT, PULSE+L_CTL+'o'); MapKey(&Throttle,APALT, PULSE+L_SHIFT+'o'); ////////////////---Weapons---//////////////// ////////////////---Machine Guns-Cannon---/////////////// ////////////////---TG1 and TG2---/////////////// MapKeyIO(&Joystick, TG1, R_ALT+SPC , ENT ); // S3 Pressed only Cannon -S3 Out only MG MapKey(&Joystick, TG2, CHAIN(ENT, R_ALT+SPC)); //Both ////////////////---Guns Safety Lever (toggle)//////////////// MapKeyIOUMD(&Throttle,EACON, CHAIN( DOWN+L_SHIFT, D(), DOWN+SPC, D(), UP+SPC, D(), UP+L_SHIFT), CHAIN( DOWN+L_SHIFT, D(), DOWN+SPC, D(), UP+SPC, D(), UP+L_SHIFT), CHAIN( DOWN+L_SHIFT, D(), DOWN+SPC, D(), UP+SPC, D(), UP+L_SHIFT), CHAIN( DOWN+L_SHIFT, D(), DOWN+SPC, D(), UP+SPC, D(), UP+L_SHIFT), CHAIN( DOWN+L_SHIFT, D(), DOWN+SPC, D(), UP+SPC, D(), UP+L_SHIFT), CHAIN( DOWN+L_SHIFT, D(), DOWN+SPC, D(), UP+SPC, D(), UP+L_SHIFT)); MapKeyRIOUMD(&Throttle,EACON, CHAIN( DOWN+L_SHIFT, D(), DOWN+SPC, D(), UP+SPC, D(), UP+L_SHIFT), CHAIN( DOWN+L_SHIFT, D(), DOWN+SPC, D(), UP+SPC, D(), UP+L_SHIFT), CHAIN( DOWN+L_SHIFT, D(), DOWN+SPC, D(), UP+SPC, D(), UP+L_SHIFT), CHAIN( DOWN+L_SHIFT, D(), DOWN+SPC, D(), UP+SPC, D(), UP+L_SHIFT), CHAIN( DOWN+L_SHIFT, D(), DOWN+SPC, D(), UP+SPC, D(), UP+L_SHIFT), CHAIN( DOWN+L_SHIFT, D(), DOWN+SPC, D(), UP+SPC, D(), UP+L_SHIFT)); ////////////////---BOMBS---/////////////// ////////////////---Drop Bombs - Rockets---/////////////// MapKey(&Joystick,S2, CHAIN( DOWN+R_SHIFT, D(), DOWN+SPC, D(), UP+SPC, D(), UP+R_SHIFT)); ////////////////---Gunsight Brightness [ HAT 2 ]////////////////--- MapKeyIO(&Joystick, H2U, CHAIN( DOWN+R_SHIFT, D(), DOWN+'o', D(), UP+'o', D(), UP+R_SHIFT),// Gunsight Brightness INCREASE CHAIN( DOWN+L_ALT, D(), DOWN+'o', D(), UP+'o', D(), UP+L_ALT)// Gunsight Smoked ); MapKeyIO(&Joystick, H2D, CHAIN( DOWN+R_CTL, D(), DOWN+'o', D(), UP+'o', D(), UP+R_CTL),// Gunsight Brightness DECREASE L_ALT+SPC // Charge MK 108 ); ///////////////---Kneeboard HAT 2 [L and R]---/////////////// MapKeyIO(&Joystick, H2L, CHAIN( DOWN+R_SHIFT, D(), DOWN+'k', D(), UP+'k', D(), UP+R_SHIFT),// Kneeboard On/OFF '[');//Previous Page MapKeyIO(&Joystick, H2R, CHAIN( DOWN+R_CTL, D(), DOWN+'k', D(), UP+'k', D(), UP+R_CTL),//Kneeboard Current Position ']' //Next Page ); ///////////////--- Cockpit /Map View---/////////////// MapKeyIO(&Throttle,SC, PULSE+F10, PULSE+F1 ); ///////////////---Bomb Fusing Selector---/////////////// MapKeyIOUMD(&Throttle, APENG, CHAIN( DOWN+L_SHIFT, D(), DOWN+'b', D(), UP+'b', D(), UP+L_SHIFT),// Bomb Fusing Selector NEXT MODE CHAIN( DOWN+L_CTL, D(), DOWN+'b', D(), UP+'b', D(), UP+L_CTL),// Bomb Fusing Selector PREVIOYS MODE CHAIN( DOWN+L_SHIFT, D(), DOWN+'b', D(), UP+'b', D(), UP+L_SHIFT),// Bomb Fusing Selector NEXT MODE CHAIN( DOWN+L_CTL, D(), DOWN+'b', D(), UP+'b', D(), UP+L_CTL),// Bomb Fusing Selector PREVIOUS MODE REXEC(0, 1000, "ActKey(KEYON+primer);"), REXEC(0, 1000, "ActKey(KEYON+primer);")); } //event handler int EventHandle(int type, alias o, int x) { DefaultMapping(&o, x); //add event handling code here } [sIGPIC][/sIGPIC] My Pit
qbcat Posted February 16, 2016 Author Posted February 16, 2016 Oh my gosh! thank you kindly! I'm flying on a su25t, but there seems to be many interesting lines in your script! CPU:i5-8400@2,8GHz|GPU: GTX-1080Ti 11gb | RAM:48GB|Monitor LG38"" wide 3840x1600 | 2xSabrent SSD 2T Rocket NVMe PCIe M.2 2280| VKB GladiatorMKII Kosmosima| *** Perché volare? Semplice. Non sono felice a meno che non ci sia un po’ di spazio tra me e la terra. ***
hoochiekoo Posted February 17, 2016 Posted February 17, 2016 Have you already set which button assign for switch to up layer, middle layer and down layer. When you want to active up layer you have to switch to up layer before you can active the command on that button. As attached I test to set three command on LTB button in three layer and it work as you can see in the event test screen.
hoochiekoo Posted February 17, 2016 Posted February 17, 2016 I use PSF button for up layer switch and PSB for down layer switch and no button for middle layer since when you don't switch to up or down layer TARGET will always treat as you're in middle layer.
Recommended Posts