Username:

Password:

Pages: [1]
  Print  
Author Topic: What I've been working on - Warthog Macro and Joystick file  (Read 6820 times)
TX-Gunslinger
BLACK 2
Administrator
Hero Member
*****
Offline Offline

Posts: 2213


View Profile
« on: March 13, 2011, 11:11:27 pm »

Hey Chukar - does this look anything like your setup?  If you can use these - just select the text and dump it in the editor.

Here's the Macro file first.


// -----------TX-GUNSLINGER'S IL-2 T.A.R.G.E.T Macros File Version 1.0--------------------

define Center_TrackIR            USB[0x45]      //F12

// ===================Il2-Sturmovik-1946 Section========================
// Aircraft Controls

define Level_Stabilizer            USB[0x36]         // ,
define Rudder_Neutral            USB[0x38]         // /
define Elevator_Trim_Negative      L_CTL+USB[0x51]      //L_CTL+DARROW
define Elevator_Trim_Neutral      L_SHIFT+USB[0x52]   //L_SHIFT+UARROW
define Elevator_Trim_Positive      L_CTL+USB[0x52]      //L_CTL+UARROW
define Aileron_Trim_Left         L_CTL+USB[0x50]      //L_CTL+LARROW
define Aileron_Trim_Neutral         L_SHIFT+USB[0x50]   //L_SHIFT+LARROW
define Aileron_Trim_Right         L_CTL+USB[0x4F]      //L_CTL+RARROW

define Rudder_Trim_Left            L_CTL+USB[0x1D]      //L_CTL+Z
define Rudder_Trim_Neutral         L_SHIFT+USB[0x1D]   //L_SHIFT+Z
define Rudder_Trim_Right         L_CTL+USB[0x1B]      //L_CTL+X

define Toggle_Engine            USB[0x0C]         //i
define Boost_WEP_Toggle            USB[0x1A]         //w

define Prop_Pitch_Auto            L_SHIFT+USB[0x27]   //L_SHIFT+0
define Increase_Prop_Pitch         USB[0x2E]         //=
define Decrease_Prop_Pitch         USB[0x2D]         //-

define Increase_Mixture            L_CTL+USB[0x21]      //L_CTL+4
define Decrease_Mixture            L_CTL+USB[0x20]      //L_CTL+3
define Magneto_Next               L_SHIFT+USB[0x11]   //L_SHIFT+N
define Magneto_Previous            L_SHIFT+USB[0x13]   //L_SHIFT+P

define Supercharger_Next_Stage      L_CTL+USB[0x1E]      //L_CTL+1
define Supercharger_Prev_Stage      L_CTL+USB[0x1F]      //L_CTL+2

define Select_Engine_1            USB[0x1E]         //1
define Select_Engine_2            USB[0x1F]         //2

define Select_Unselect_Eng1         USB[0x22]         //5
define Select_Unselect_Eng2          USB[0x23]         //6

define Fire_Extinguisher         L_SHIFT+USB[0x09]   //L_SHIFT+F
define Feather_Propeller         L_CTL+USB[0X09]      //L_CTL+F

define Flaps_Up                  USB[0x09]         //f
define Flaps_Down               USB[0x19]         //v
define Landing_Gear_Toggle         USB[0x0A]         //g
define Raise_Gear_Manually         USB[0x56]         //Keypad -
define Lower_Gear_Manually         USB[0x57]         //Keypad +
define Cowl_or_Armor_Flaps_Rad      USB[0x15]         //r
define Airbrake                  L_CTL+USB[0x24]      //L_CTL+7
define Wheel_Brakes               USB[0x05]         //b
define Lock_Tail_Wheel            L_CTL+USB[0x25]      //L_CTL+8
define Jettison_Droptanks         L_CTL+USB[0x17]      //L_CTL+T

define Arresting_Hook            L_SHIFT+USB[0x0b]   //L_SHIFT+H         
define Toggle_Chocks            L_SHIFT+USB[0x06]   //L_SHIFT+'c'
define Toggle_Canopy            L_CTL+USB[0x26]      //L_CTL+9
// WEAPONS
define Weapon_1                  USB[0x28]         //Enter (machine guns)
define Weapon_2                  USB[0x2A]         //Backspace (cannons)
define Weapon_3                  USB[0x2C]         //Space (Rockets)               
define Weapon_4                  L_ALT+USB[0x2C]    //Alt+SPC (Bombs)
define Weapon_1_2               L_ALT+USB[0x2A]     //Alt+Backspace
define Toggle_Gunpods_OnOff         USB[0x1D]         //z
// GUNSIGHT/BOMBSIGHT CONTROLS (none mapped)
// GUNNER CONTROLS (handled by my Mouse)
//Views
define Pilot_or_Gunner_Position      USB[0x06]         //c
define Wide_View               USB[0x4E]         //Page Down
define Normal_View               USB[0x4D]         //End
define Gunsight_Zoom_View         USB[0x4C]         //Delete
define Cockpit_View               USB[0x3A]         //F1
define No_Cockpit_View            L_CTL+USB[0x3A]      //Control+F1
define External_View            USB[0x3B]         //F2
define Next_Friendly_View         L_SHIFT+USB[0x3B]   //Shift+F2
define Next_Enemy_View            L_CTL+USB[0x3B]      //Control+F2
define Fly_by_View               USB[0x3C]         //F3

define Chase_View               USB[0x41]         //F8
define Toggle_Gunsight            L_SHIFT+USB[0x3A]   //Shift+F1
define Seat_Position            L_CTL+USB[0x18]      //Control+U
define Toggle_Il2_Comms            USB[0x2B]         //Tab
define Toggle_Autopilot            USB[0x04]         //A
define Toggle_Level_Autopilot      L_SHIFT+USB[0x04]   //Shift+A
define Bail_Out                  L_CTL+USB[0x08]      //Control+E
define Cockpit_Lights            L_CTL+USB[0x0F]      //Control+L
define Nav_Lights               L_CTL+USB[0x11]      //Control+N
define Landing_Lights            L_SHIFT+USB[0x0F]   //Shift+L
define Wingtip_Smoke            USB[0x17]         //T
define Toggle_Map               USB[0x10]         //M
define Chat                     USB[0x35]         //`
define Online_Rating            USB[0x16]         //S
define Online_Rating_Page2         USB[0x14]         //Q
define Toggle_Speed_Bar            L_CTL+USB[0x05]      //Control+B
define Toggle_Icon_Type            L_SHIFT+USB[0x0C]   //Shift+I
define Toggle_Mirrors            L_SHIFT+USB[0x10]   //Shift+M
define Next_Beacon               L_SHIFT+USB[0x05]   //Shfit+B
define Previous_Beacon            L_CTL+USB[0x13]      //Control+P
define Compass_Heading_Plus         L_CTL+USB[0x0b]      //Control+H
define Compass_Heading_Minus      L_CTL+USB[0x10]      //Control+M
define Jettison_Stores            L_CTL+USB[0x22]      //Control+5
define Quick_Start/Save_Track      L_CTL+USB[0x15]      //Control+R
define Radio_Mute_Key            L_ALT+USB[0x11]      //Control+N
define Radio_Channels_Switch      L_CTL+USB[0x06]      //Control+C
define Mute                     USB[0x11]         //N


Logged

Black 2 TX Flight Leader
TX-Gunslinger
BLACK 2
Administrator
Hero Member
*****
Offline Offline

Posts: 2213


View Profile
« Reply #1 on: March 13, 2011, 11:13:49 pm »

Now for the beauty - the Target Script File Smiley  Almost done, but a little more tweaking and ergonomic testing to finish up towards the bottom.  This has been developed for ease of transition to CoD.


////////////////////////////////////////////////////////////
//      Target Script File (TMC)
////////////////////////////////////////////////////////////
//      Simulator: Il2 Sturmovik 46 V 4.10
//      Date: 06_03_2011
//      Prepared By: TX_Gunslinger
//      http://txsquadron.com
//////////////////////////////////////////////////////////////


//:
//1. Customized


include "target.tmh"
include "Il2-46-u2nxt-warthog.ttm"
int main()
{
//Exclude non-existant devices
   Exclude(&Joystick);
   Exclude(&T16000);
   Exclude(&LMFD);
   Exclude(&RMFD);

   if(Init(&EventHandle)) return 1;
   SetKBRate(32, 50);
   SetKBLayout(KB_ENG);

//Map Joystick Axis
   MapAxis(&HCougar, JOYX, DX_X_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
   SetSCurve(&HCougar, JOYX, 0, 0, 0, 0, 0);
   MapAxis(&HCougar, JOYY, DX_Y_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
   SetSCurve(&HCougar, JOYY, 0, 0, 0, 0, 0);
//Map Rudder Axis (through Cougar connector)
   MapAxis(&HCougar, RUDDER, DX_Z_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
   SetSCurve(&HCougar, RUDDER, 0, 0, 0, 0, 0);
//Now that Axis are mapped - setup EXEC for X,Y,Z Trim on S4
   MapKeyIO(&HCougar, S4,
   EXEC("TrimDXAxis(DX_Z_AXIS, SET(0)); TrimDXAxis(DX_X_AXIS, SET(0));   TrimDXAxis(DX_Y_AXIS, SET(0));"),
   EXEC("LockDXAxis(DX_Z_AXIS, 1);    LockDXAxis(DX_X_AXIS, 1);   LockDXAxis(DX_Y_AXIS, 1);"
        "TrimDXAxis(DX_Z_AXIS, CURRENT);TrimDXAxis(DX_X_AXIS, CURRENT);   TrimDXAxis(DX_Y_AXIS, CURRENT);",
        "LockDXAxis(DX_Z_AXIS, 0);    LockDXAxis(DX_X_AXIS, 0);   LockDXAxis(DX_Y_AXIS, 0);"));
   
   
//Map Old Cougar Throttle AXIS - now in Silver Box
   MapAxis(&HCougar, THROTTLE, DX_XROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
   SetSCurve(&HCougar, THROTTLE, 0, 0, 0, 0, 0);

//ANT_ELEV is NON-FUNTIONAL DUE TO KNOWN SOFTWARE BUG IN TARGET
   //MapAxis(&HCougar, ANT_ELEV, 0, AXIS_NORMAL, MAP_ABSOLUTE);
   //SetSCurve(&HCougar, ANT_ELEV, 0, 0, 0, 0, 0);
   //KeyAxis(&HCougar, ANT_ELEV, 0, AXMAP1(8,PULSE+Cowl_or_Armor_Flaps_Rad,PULSE+Cowl_or_Armor_Flaps_Rad));
   
   MapAxis(&HCougar, MAN_RNG, DX_YROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
   SetSCurve(&HCougar, MAN_RNG, 0, 0, 0, 0, 0);

//Set Cougar Joystick S3 as U/D shift control AND Warthog Boat Switch as U/M/D Layers
   //U/M/D Layers effect ONLY Weapons.  BSF = U Layer while BSB = D Layer
   //Boat Switch Back places Cannon on S2 switch (for fighters only0 - S2 = Cannon TG1 = MG
   //Boat Switch Middle configures S2 to drop one bomb (unshifted or /U)
   //Boat Switch Forward configures S2 to repeat bombs until S2 released   
   SetShiftButton(&HCougar, S3, &Throttle, BSF, BSB,0);

//Triggers on Cougar - Controlled by WARTHOG BOAT SWITCH
   MapKeyIOUMD(&HCougar, TG1, Weapon_1, Weapon_1, Weapon_2, Weapon_1, Weapon_2, Weapon_1);
   MapKeyIOUMD(&HCougar, TG2, Weapon_1, Weapon_1, 0, Weapon_1_2, 0, Weapon_1_2);
   MapKeyIO(&HCougar, S1, PULSE+Toggle_Gunsight, PULSE+No_Cockpit_View);

   MapKeyIOUMD(&HCougar, S2,
   PULSE+Weapon_3,  //Boat Switch Forward, S3 pressed and held              Rockets     - Switch Forward = "Release all Bombs"
   REXEC(1, 40, "ActKey(KEYON+PULSE+Weapon_4);"),  //Boat Switch Forward    Bombs
   PULSE+Weapon_3,  //Boat Switch Middle, S3 pressed and held             Rockets   - Switch Middle = Normal - Single Bomb release per S2 actuation
   PULSE+Weapon_4,  //Boat Switch Middle                                Bombs   
   PULSE+Weapon_3,  //Boat Switch Back, S3 pressed and held               Rockets   - Switch Back = Sturmjager mode.  Wgfr-21 and Cannons
   Weapon_2);       //Boat Switch Back                                    Cannon

//Hat1 - FINE TRIM NON REPEAT - small adjustments for work in concert with trim sliders - routine left in as option
   //MapKeyIO(&HCougar, H1U, PULSE+Rudder_Trim_Neutral,PULSE+Elevator_Trim_Negative);
   //MapKeyIO(&HCougar, H1D, PULSE+Aileron_Trim_Neutral, PULSE+Elevator_Trim_Positive);
   //MapKeyIO(&HCougar, H1L, PULSE+Aileron_Trim_Left, PULSE+Rudder_Trim_Left);
   //MapKeyIO(&HCougar, H1R, PULSE+Aileron_Trim_Right, PULSE+Rudder_Trim_Right);
   
//Hat1 - FINE TRIM REPEAT - Auto Fine Trim Routine
   MapKeyIO(&HCougar, H1U,PULSE+Rudder_Trim_Neutral ,REXEC(2,60,"ActKey(KEYON+PULSE+Elevator_Trim_Negative);"));
     MapKeyIO(&HCougar, H1D,PULSE+Aileron_Trim_Neutral, REXEC(3, 60, "ActKey(KEYON+PULSE+Elevator_Trim_Positive);"));
     MapKeyIO(&HCougar, H1L,REXEC(4, 60, "ActKey(KEYON+PULSE+Aileron_Trim_Left);") ,REXEC(5,60,"ActKey(KEYON+PULSE+Rudder_Trim_Left);"));
     MapKeyIO(&HCougar, H1R,REXEC(6, 60, "ActKey(KEYON+PULSE+Aileron_Trim_Right);"), REXEC(7, 60, "ActKey(KEYON+PULSE+Rudder_Trim_Right);"));

// Hat 2 - Unmapped - FOR COMMS

//Hat 3 - VIEWS
//Trackir Centre
   MapKeyIO(&HCougar, H3U,External_View,Center_TrackIR);
//H3R Zoom View Sequence
   MapKeyIOUMD(&HCougar, H3R, PULSE+Next_Friendly_View, SEQ( PULSE+Gunsight_Zoom_View, PULSE+Wide_View, PULSE+Normal_View), PULSE+Next_Friendly_View, SEQ( PULSE+Gunsight_Zoom_View, PULSE+Wide_View, PULSE+Normal_View), PULSE+Next_Friendly_View, SEQ( PULSE+Gunsight_Zoom_View, PULSE+Wide_View, PULSE+Normal_View));
//H3D Chase and "Six Checker" for enabled external views - 2nd Line is key release which returns view to cockpit
   MapKeyIO(&HCougar, H3D, PULSE+Fly_by_View, PULSE+Chase_View);
   MapKeyRIO(&HCougar, H3D, PULSE+Cockpit_View, PULSE+Cockpit_View);
//H3L Cockpit and External Enemy View
   MapKeyIOUMD(&HCougar, H3L, PULSE+Next_Enemy_View, PULSE+Cockpit_View, PULSE+Next_Enemy_View, PULSE+Cockpit_View, PULSE+Next_Enemy_View, PULSE+Cockpit_View);
//Hat 4 - FLAPS/TAILWHEEL/CANOPY/CHOCKS
   MapKeyIO(&HCougar, H4U, PULSE+Seat_Position, PULSE+Flaps_Up);
   MapKeyIO(&HCougar, H4R, PULSE+Arresting_Hook, PULSE+Toggle_Canopy);
   MapKeyIO(&HCougar, H4D, PULSE+Lock_Tail_Wheel, PULSE+Flaps_Down);
//Hat 4 Left unshifted is open - currently double assigned to Chocks
   MapKeyIO(&HCougar, H4L, PULSE+Toggle_Chocks, PULSE+Toggle_Chocks);

//COUGAR THROTTLE - Transplanted to Project Box

//T2/3/4 are not assigned shifted values
   MapKeyIO(&HCougar, T2, PULSE+Cockpit_Lights, PULSE+Cockpit_Lights);
   MapKeyIO(&HCougar, T3, PULSE+Toggle_Mirrors, PULSE+Toggle_Mirrors);
   MapKeyIO(&HCougar, T4, PULSE+Pilot_or_Gunner_Position, PULSE+Pilot_or_Gunner_Position);
//T5 is OPEN -
//T6 is PROP PITCH AUTO - with slider controlling prop pitch
   MapKey(&HCougar, T6, PULSE+Prop_Pitch_Auto);
//Jettison Tanks/Stores and Emergency Switch
   MapKeyIO(&HCougar, T7, PULSE+Fire_Extinguisher, PULSE+Jettison_Stores);
   MapKeyIO(&HCougar, T8, PULSE+Bail_Out, PULSE+Jettison_Droptanks);
//Electric Prop Pitch Routine (HS-129)
   MapKey(&HCougar, T10, REXEC(8, 50, "ActKey(KEYON+PULSE+Increase_Prop_Pitch);"));
     MapKey(&HCougar, T9, REXEC(9, 50, "ActKey(KEYON+PULSE+Decrease_Prop_Pitch);"));

//WARTHOG THROTTLE

//MSP Switch = in flight Map toggle
   MapKey(&Throttle, MSP, PULSE+Toggle_Map);
   
//SPDF Switch = Airbrake   
   MapKey(&Throttle, SPDF, PULSE+Airbrake);
//SPDB Switch (Momentary) = Wheel Brakes   
   MapKey(&Throttle, SPDB, PULSE+Wheel_Brakes);
//Coolie Switch Forward - Radiator *Note Il2 Radiator function only moves in one direction i.e. forward.  This sequence is the only option for accessing AUTO Radiator function
//found in many aircraft.  Mapping Radiator to a direct X rotary does not allow access to the "Auto" radiator function.
   MapKey(&Throttle, CHF, Cowl_or_Armor_Flaps_Rad);
//Coolie Switch Back - Yes, duplicate of the forward position.  This is in prepartion for Il2 "Cliffs of Dover" in which a more functional radiator is anticipated.
   MapKey(&Throttle, CHB, Cowl_or_Armor_Flaps_Rad);
//Three Way switch on the left side of Throttle is setup to control external lights
   MapKeyIOUMD(&Throttle, PSF, PULSE+Nav_Lights);

   MapKeyIOUMD(&Throttle, PSB, PULSE+Landing_Lights);
//LTB is Engine Boost or WEP
   MapKeyIOUMD(&Throttle, LTB, PULSE+Boost_WEP_Toggle);
//EFL Left and Right are setup as engine select switches - current setup is optimized for single and twin engine aircraft
   MapKey(&Throttle, EFLNORM, PULSE+Select_Engine_1);
   MapKey(&Throttle, EFRNORM, PULSE+Select_Engine_2);
//***MUST FIND BETTER USE OF THIS SWITCH - IN COD PROBABLY CARB HEAT
   MapKey(&Throttle, APUON, PULSE+Boost_WEP_Toggle);
   MapKey(&Throttle, APUOFF, PULSE+Boost_WEP_Toggle);
   MapKeyR(&Throttle, APUOFF, PULSE+Boost_WEP_Toggle);
//Landing Gear
   MapKeyIOUMD(&Throttle, LDGH, Landing_Gear_Toggle);
   
//Auto Manual Gear routine for aircraft with Manual Landing gear (I-16, F4F, etc)
   MapKey(&Throttle, FLAPD, REXEC(10, 50, "ActKey(KEYON+PULSE+Lower_Gear_Manually);"));
     MapKey(&Throttle, FLAPU, REXEC(11, 50, "ActKey(KEYON+PULSE+Raise_Gear_Manually);"));

   MapKeyIOUMD(&Throttle, EACON, PULSE+L_CTL+'r', PULSE+L_CTL+'r', PULSE+L_CTL+'r', PULSE+L_CTL+'r', PULSE+L_CTL+'r', PULSE+L_CTL+'r');
   MapKeyRIOUMD(&Throttle, EACON, PULSE+L_CTL+'r', PULSE+L_CTL+'r', PULSE+L_CTL+'r', PULSE+L_CTL+'r', PULSE+L_CTL+'r', PULSE+L_CTL+'r');
   MapKeyIOUMD(&Throttle, APPAT, DOWN+L_SHIFT+'a', DOWN+L_SHIFT+'a', DOWN+L_SHIFT+'a', DOWN+L_SHIFT+'a', DOWN+L_SHIFT+'a', DOWN+L_SHIFT+'a');
   MapKeyRIOUMD(&Throttle, APPAT, UP+L_SHIFT+'a', UP+L_SHIFT+'a', UP+L_SHIFT+'a', UP+L_SHIFT+'a', UP+L_SHIFT+'a', UP+L_SHIFT+'a');
   MapKeyIOUMD(&Throttle, APALT, PULSE+',', PULSE+',', PULSE+',', PULSE+',', PULSE+',', PULSE+',');
   MapKeyRIOUMD(&Throttle, APALT, PULSE+',', PULSE+',', PULSE+',', PULSE+',', PULSE+',', PULSE+',');
   MapKeyIOUMD(&Throttle, EOLIGN, PULSE+'i', PULSE+'i', PULSE+'i', PULSE+'i', PULSE+'i', PULSE+'i');
   MapKeyIOUMD(&Throttle, EORIGN, PULSE+'i', PULSE+'i', PULSE+'i', PULSE+'i', PULSE+'i', PULSE+'i');
   MapKeyIOUMD(&Throttle, EFLOVER, PULSE+'5', PULSE+'5', PULSE+'5', PULSE+'5', PULSE+'5', PULSE+'5');
   MapKeyIOUMD(&Throttle, EFROVER, PULSE+'6', PULSE+'6', PULSE+'6', PULSE+'6', PULSE+'6', PULSE+'6');

   MapKeyIOUMD(&Throttle, EACOFF, PULSE+L_CTL+'r', PULSE+L_CTL+'r', PULSE+L_CTL+'r', PULSE+L_CTL+'r', PULSE+L_CTL+'r', PULSE+L_CTL+'r');
   MapKeyRIOUMD(&Throttle, EACOFF, PULSE+L_CTL+'r', PULSE+L_CTL+'r', PULSE+L_CTL+'r', PULSE+L_CTL+'r', PULSE+L_CTL+'r', PULSE+L_CTL+'r');
   MapKeyIOUMD(&Throttle, CSU, L_CTL+'3', L_CTL+'3', L_CTL+'3', L_CTL+'3', L_CTL+'3', L_CTL+'3');
   MapKeyIOUMD(&Throttle, CSD, PULSE+L_CTL+'4', PULSE+L_CTL+'4', PULSE+L_CTL+'4', PULSE+L_CTL+'4', PULSE+L_CTL+'4', PULSE+L_CTL+'4');
   MapKeyIOUMD(&Throttle, CSR, PULSE+L_CTL+'1', PULSE+L_CTL+'1', PULSE+L_CTL+'1', PULSE+L_CTL+'1', PULSE+L_CTL+'1', PULSE+L_CTL+'1');
   MapKeyIOUMD(&Throttle, CSL, PULSE+L_CTL+'2', PULSE+L_CTL+'2', PULSE+L_CTL+'2', PULSE+L_CTL+'2', PULSE+L_CTL+'2', PULSE+L_CTL+'2');
   MapAxis(&Throttle, SCX, 0, AXIS_NORMAL, MAP_ABSOLUTE);
   SetSCurve(&Throttle, SCX, 0, 0, 0, 0, 0);
   MapAxis(&Throttle, SCY, 0, AXIS_NORMAL, MAP_ABSOLUTE);
   SetSCurve(&Throttle, SCY, 0, 0, 0, 0, 0);
   MapAxis(&Throttle, THR_RIGHT, DX_THROTTLE_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
   SetSCurve(&Throttle, THR_RIGHT, 0, 0, 0, 0, 0);
   MapAxis(&Throttle, THR_LEFT, DX_ZROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
   SetSCurve(&Throttle, THR_LEFT, 0, 0, 0, 0, 0);
   MapAxis(&Throttle, THR_FC, DX_SLIDER_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
   SetSCurve(&Throttle, THR_FC, 0, 0, 0, 0, 0);

}
int EventHandle(int type, alias o, int x)
{
   DefaultMapping(&o, x);
}
Logged

Black 2 TX Flight Leader
TX-Gunslinger
BLACK 2
Administrator
Hero Member
*****
Offline Offline

Posts: 2213


View Profile
« Reply #2 on: March 13, 2011, 11:18:34 pm »

Again, not completely finished, but close enough for someone else to use if desired.....

Provides:

1. Auto Manual Landing Gear
2. Sturmjager - Normal - "Dump all bombs on target" modes for the red S2 switch
3. Rapid prop pitch changes for up+down actuation (required on new Hs-129)
4. Integrates Cougar Throttle as additional rotaries and switches (in my case - inside the aluminum project box I posted pics of)
5. Many, many ergonomic considerations.
6. Use of raw USB macro's in the Macro file for ease of use by non-English or U.S. Users.

S!

Gunny
Logged

Black 2 TX Flight Leader
TX-Chukar
BLACK 3
TX-Member
Hero Member
*****
Offline Offline

Posts: 536



View Profile
« Reply #3 on: March 14, 2011, 09:55:32 pm »

  Some nice ideas Gunny.  The auto bomb drop is genius and I am a bomber pilot and I didn't think of that one, DOH!   I like the wheel brakes on the SPDB too, a much better spot than the one I was using. 

  Its funny to see some similar code only written another way.  An example is I used a EXEC command to set the LASTE switch to change the function of S2 between rockets and bombs while you used the BSF as a second switch to do the same thing.  Thinking the same way just found a different way to do it.

   This is the first real IL2 script I have seen Gunny thanks for posting.   I only wish that IL2 had a standard functions list so that swapping profiles would be easier.  Anyway it's some nice work.

  I still have some tweaking to do on mine as well.  I would like to go back and make use of the REXC command as you did, I didn't get that one at first.   

Here is what I have so far.   The "LP" stands for Long Press.

////////////////////////////////////////////////////////////////


include "target.tmh"
include "Chukars_IL-2_1946_Macros.ttm"
int main()
{
if(Init(&EventHandle)) return 1;


MapAxis(&Joystick, JOYX, DX_X_AXIS);
MapAxis(&Joystick, JOYY, DX_Y_AXIS);
MapAxis(&Throttle, THR_LEFT, DX_THROTTLE_AXIS);
MapAxis(&Throttle, THR_RIGHT, DX_Z_AXIS);
MapAxis(&Throttle, SCX, DX_XROT_AXIS);
MapAxis(&Throttle, SCY, DX_YROT_AXIS);
MapAxis(&Throttle, THR_FC, DX_SLIDER_AXIS);
MapAxis(&HCougar, RUDDER, DX_ZROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);

SetSCurve(&HCougar, RUDDER, 0, 6, 0, 2, 0);


SetShiftButton(&Joystick, S3, &Throttle, BSF, BSB);      // Set S3 as I/O and Boat Switch as U/M/D


//----------------------------------------------------------------------------------------------------
//                     JOYSTICK
//----------------------------------------------------------------------------------------------------

MapKeyIO(&Joystick, TG1, Cannons, Machineguns);      // S3 In Cannons, Out machnine guns
MapKey(&Joystick, TG2, Cannons);


MapKeyIO(&Joystick, S1, Online_rating, PULSE+Map );

//  S2 is Bomb or Rockets depending on LASTE,  Path=Rockets, ALT=Bombs, Alt/Heading = no funcion

MapKey(&Joystick, S4, Teamspeak );

// H1 is trim control         

//   UP  S3  in               =
//   DN  S3  in               = sets all trim to neutral
//   LF   S3  in               = aileron trim left
//      RT  S3  in               = aileron trim right

//  UP  S3 out               = elevator trim positive
//  DN  S3 out               = elevator trim negative
//  LF  S3 out               = rudder trim left
//  RT  S3 out               = rudder trim right

//  UP  S3 out (LP)       Long press       = lock trim to current axis position
//  DN  S3 out (LP)   Long press       = unlocks axis from the trim lock


MapKeyIO(&Joystick, H1U, 0,
      TEMPO ( Elevator_trim_positive, EXEC("TrimDXAxis(DX_ZROT_AXIS, CURRENT);TrimDXAxis(DX_X_AXIS, CURRENT);TrimDXAxis(DX_Y_AXIS, CURRENT);"),1000));
MapKeyIO(&Joystick, H1D, CHAIN( PULSE+Elevator_trim_neutral, D(), PULSE+Rudder_trim_neutral, D(), PULSE+Aileron_trim_neutral ),
      TEMPO ( Elevator_trim_negative, EXEC("TrimDXAxis(DX_ZROT_AXIS, SET (0));TrimDXAxis(DX_X_AXIS, SET(0));TrimDXAxis(DX_Y_AXIS, SET(0));"), 1000));
MapKeyIO(&Joystick, H1L, Aileron_trim_left, Rudder_trim_left );
MapKeyIO(&Joystick, H1R, Aileron_trim_right, Rudder_trim_right );


//         HAT 2
MapKeyIO(&Joystick, H2U, 0, TEMPO( Increase_prop_pitch, Level_stabilizer, 500 ));       // + Prop pitch, (LP) Level stabizer
MapKeyIO(&Joystick, H2D, 0, Decrease_prop_pitch );                     // - Prop pitch
MapKeyIO(&Joystick, H2L, 0, Tinted_reticle_dimmer );                      // Tinted reticle or bomb sight view
MapKeyIO(&Joystick, H2R, 0, TEMPO( Cowl_or_armor_flaps, Bomb_sight_mode_auto, 500 ));   // radiator, (LP) Auto Bomb sight hold

//         HAT 3
MapKeyIO(&Joystick, H3U, 0 , Teamspeak_Whisper_Two);                        // Teamspeak ch2
MapKeyIO(&Joystick, H3D, 0 , PULSE+Toggle_gunsight );                        // Gunsight mode
MapKeyIO(&Joystick, H3L, 0 , PULSE+Mirror );                              // Mirror
MapKeyIO(&Joystick, H3R, 0 , TEMPO ( Pilot_or_gunner_position, Teamspeak_Whisper_One, 800 ));   // Pilot Gunner, (LP) Teamspeak ch 1

//         HAT 4                            BSF   S3
MapKeyIOUMD(&Joystick, H4U, 0, Flaps_up,// U IN/Out =   0                          /  Flaps up
                            0, Flaps_up,                  // M       =   0                  /  Flaps up
                            Jump_to_cockpit_1_pilot, Flaps_up );      // D       =  Jump_to_cockpit_1    /  Flaps up
MapKeyIOUMD(&Joystick, H4D, 0, Flaps_down,            // U In/Out =   0                     /  Flaps down
                            0, Flaps_down,                // M      =   0            /  Flaps down
                            Jump_to_cockpit_2, Flaps_down );      // D      =  Jump to cockpit 2   /  Flaps down
MapKeyIOUMD(&Joystick, H4L, 0, 0,                  // U In/Out =   0             /   0
                            0, 0,                     // M      =   0             /   0
                            Jump_to_cockpit_3, 0 );            // D      =  Jump to cockpit 3   /   0
MapKeyIOUMD(&Joystick, H4R, 0, Gear_up_down,         // U In/Out =   0                 /   0
                            0, 0,                      // M      =   0            /   0
                            Toggle_seat_position, 0 );          // D           =  Toggle seat pos.,
                           
MapKey(&Joystick, H4P, TrackIR_center);               // Teamspeak main

//----------------------------------------------------------------------------------------------------
//                     THROTTLE
//----------------------------------------------------------------------------------------------------

//          PINKY SWITCH                          PS Foward         /        Backwards
MapKey(&Throttle, PSF, PULSE+Jettison_drop_tanks);         
MapKey(&Throttle, PSM, 0);                           //  Jettison Drop tanks      /  Bomb bay doors            
MapKey(&Throttle, PSB, PULSE+Bomb_bay_doors);
MapKeyR(&Throttle, PSB, PULSE+Bomb_bay_doors);

//         LTB                                 S3 In         /      S3 Out
MapKeyIO(&Throttle, LTB, Engine_on_off, 0 );                  //    Engines on/off       /

//         SLEW CONTROL                           S3 In         /      S3 Out
MapKeyIO(&Throttle, SC, PULSE+Select_all_engines, Wheel_brakes );           //   All engines selected   /  Wheel brakes

//         COOLIE SWITCH
MapKeyIOUMD(&Throttle, CSU, 0,
                     Select_engine_1,
                     0,
                     0,
                      CHAIN ( D(200), Increase_sight_altitude),
                      CHAIN ( D(300), Increase_sight_distance ));

MapKeyIOUMD(&Throttle, CSD, 0,
                          Select_engine_2,
                      0,
                      0,
                                                    CHAIN ( D(200), Decrease_sight_altitude),
                      CHAIN ( D(300), Decrease_sight_distance ));
                      
MapKeyIOUMD(&Throttle, CSL, 0,
                     Select_engine_3,
                      0,
                      0,
                      0,
                      CHAIN ( D(1000), Increase_sight_velocity ));

MapKeyIOUMD(&Throttle, CSR, 0,
                     Select_engine_4,
                      0,
                      0,
                      0,
                      CHAIN ( D(1000), Decrease_sight_velocity ));   
//            MIC
MapKey(&Throttle, MSP, Boost_WEP);

MapKeyUMD(&Throttle, MSU, 0,
                    0,
                    CHAIN ( D(200), Increase_sight_altitude));

MapKeyUMD(&Throttle, MSD, 0,
                    0,
                    CHAIN ( D(200), Decrease_sight_altitude));

MapKeyUMD(&Throttle, MSL, PULSE+Gunsight_view,
                    PULSE+Gunsight_view,
                    PULSE+Gunsight_view);
                  
MapKeyUMD(&Throttle, MSR, SEQ (Normal_view, Wide_view ),
                    SEQ (Normal_view, Wide_view ),
                    SEQ (Normal_view, Wide_view ));

//            SPEED BRAKE
MapKey(&Throttle, SPDF, PULSE+Airbrake );
MapKey(&Throttle, SPDM, PULSE+Airbrake );
MapKey(&Throttle, SPDB, PULSE+Airbrake );



//            CHINA HAT
MapKeyIO(&Throttle, CHF, PULSE+Decrease_mixture,
                  PULSE+Supercharger_next_stage); 
                  
MapKeyIO(&Throttle, CHM, 0);
                  
MapKeyIO(&Throttle, CHB, PULSE+Increase_mixture,
                   PULSE+Supercharger_prev_stage);





//----------------------------------------------------------------------------------------------------
//                     THROTTLE  BASE
//----------------------------------------------------------------------------------------------------



MapKey(&Throttle, EFLNORM, PULSE+Open_close_canopy);
MapKeyR(&Throttle, EFLNORM, PULSE+Open_close_canopy);
//MapKey(&Throttle, EFLOVER, 0);
MapKey(&Throttle, EFRNORM, PULSE+Quick_Save_Track);
MapKeyR(&Throttle, EFRNORM, PULSE+Quick_Save_Track);
//MapKey(&Throttle, EFROVER, 0);                  

MapKey(&Throttle, EOLIGN, CHAIN (PULSE+Select_engine_1, D(500), PULSE+Fire_extinguisher )); // Hold to initiate fire extinguisher on eng 1
MapKey(&Throttle, EORIGN, CHAIN (PULSE+Select_engine_2, D(500), PULSE+Fire_extinguisher )); // Hold to initiate fire extinguisher on eng 2

MapKey(&Throttle, EOLMOTOR, CHAIN (PULSE+Select_engine_1, D(100), PULSE+Feather_prop ));  // Feather prop eng 1
MapKey(&Throttle, EORMOTOR, CHAIN (PULSE+Select_engine_2, D(100), PULSE+Feather_prop ));  // Feather prop eng 2

MapKey(&Throttle, APUON, PULSE+Cockpit_lights);
MapKeyR(&Throttle, APUON, PULSE+Cockpit_lights);
//MapKey(&Throttle, APUOFF, 0);

MapKey(&Throttle, LDGH, Speed_bar);

MapKey(&Throttle, FLAPU, PULSE+Wingtip_Smokes);
MapKeyR(&Throttle, FLAPU, PULSE+Wingtip_Smokes);
MapKey(&Throttle, FLAPM, 0);
MapKey(&Throttle, FLAPD, PULSE+Nav_Lights);
MapKeyR(&Throttle, FLAPD, PULSE+Nav_Lights);

MapKey(&Throttle, IDLELON, CHAIN(PULSE+Select_engine_1, D(100), PULSE+Engine_on_off ));
MapKey(&Throttle, IDLELOFF, CHAIN (PULSE+Select_engine_1, D(100), PULSE+Engine_on_off ));
MapKey(&Throttle, IDLERON, CHAIN (D (100),PULSE+Select_engine_2, D(100), PULSE+Engine_on_off ));
MapKey(&Throttle, IDLEROFF, CHAIN (PULSE+Select_engine_2, D(100), PULSE+Engine_on_off ));


MapKey(&Throttle, EACON, PULSE+Arresting_hook);
MapKeyR(&Throttle, EACON, PULSE+Arresting_hook);
//MapKey(&Throttle, EACOFF, 0 );
   
MapKey(&Throttle, RDRNRM, PULSE+Chocks);
MapKeyR(&Throttle, RDRNRM, PULSE+Chocks);
//MapKey(&Throttle, RDRDIS, 0);

MapKey(&Throttle, APENG, Eject_Pilot);
MapKey(&Throttle, APDIS, 0 );

MapKey(&Throttle, APPAT, EXEC("MapKey(&Joystick, S2, PULSE+Rockets );"));
MapKey(&Throttle, APAH, EXEC("MapKey(&Joystick, S2, 0 );"));
MapKey(&Throttle, APALT, EXEC("MapKey(&Joystick, S2, PULSE+Bombs );"));



}
int EventHandle(int type, alias o, int x)
{
DefaultMapping(&o, x);


Logged
TX-Gunslinger
BLACK 2
Administrator
Hero Member
*****
Offline Offline

Posts: 2213


View Profile
« Reply #4 on: March 14, 2011, 11:54:14 pm »

Whoa - way cool Chukar.

I hadn't tried to use the TEMPO command (for LP) - now I can think about it.  Also analyzing your Bombsight mapping - as I have a free throttle Hat.  Since I have not to date used the Bombsight all that much - I have had it on yet another USB device - a 20 key X-Keys pad.  Can't decide yet if I'll break it out again.

Your comms are quite interesting also.  I like have you have PTT and Whispers separated.

When you said " I only wish that IL2 had a standard functions list so that swapping profiles would be easier" - I'm not sure exactly what you mean.  Tell me more, ok?

Thanks

Gunny
Logged

Black 2 TX Flight Leader
TX-Chukar
BLACK 3
TX-Member
Hero Member
*****
Offline Offline

Posts: 536



View Profile
« Reply #5 on: March 15, 2011, 11:24:04 am »

I was just referring how IL2 left a lot of the Key Mappings open.  The result is that everybody’s key bindings are very different.
Logged
TX-Gunslinger
BLACK 2
Administrator
Hero Member
*****
Offline Offline

Posts: 2213


View Profile
« Reply #6 on: March 15, 2011, 01:03:40 pm »

Right on.  Yes, it's a pain.  Flexible but a pain.

What I've done in the past is placed a copy of my IL2/Users/settings file in with my profiles.  That way folks can just drop it in to their directory, if willing - and away they go.

It's like the more flexibility you get - the more complex it is.

With target even.  So you are using your Warthog Joystick and Throttles, I'm using My Cougar Joystick and Throttle and Warthog throttle.

It's almost impossible to make a standard configuration to give away, unless for example I take the time to create profiles that I'm not configured for.

Pain....

S!

Gunny
Logged

Black 2 TX Flight Leader
TX-Chukar
BLACK 3
TX-Member
Hero Member
*****
Offline Offline

Posts: 536



View Profile
« Reply #7 on: March 15, 2011, 07:56:48 pm »

 You're right, I forgot about dropping your settings file in the game.


 Here is another one, setting the Idle detent switch in the throttle to start/stop your engines.  No great advantage, I use just because I can.  


MapKey(&Throttle, IDLELON, CHAIN(PULSE+Select_engine_1, D(100), PULSE+Engine_on_off ));
MapKey(&Throttle, IDLELOFF, CHAIN (PULSE+Select_engine_1, D(100), PULSE+Engine_on_off ));
MapKey(&Throttle, IDLERON, CHAIN (D (100),PULSE+Select_engine_2, D(100), PULSE+Engine_on_off ));
MapKey(&Throttle, IDLEROFF, CHAIN (PULSE+Select_engine_2, D(100), PULSE+Engine_on_off ));
Logged
Pages: [1]
  Print  
 
Jump to: