Jump to content

Recommended Posts

Posted

Anyone have macros setup for the keyboard combos?  Especially looking for the ctrl-alt-shift ones that require CHAIN'd delays.  Have some examples from the Wet Bandit's script, but they're bound directly to keys instead of a nice macro file.

 

Any advanced Warthog scripts welcome too, always looking for good ideas to add.

Posted

Well here's a few I used in my script.  Not a complete collection, I'm still discovering which commands need these.  Feel free to use, I copied some from other scripts.

define FlightRecord CHAIN(DOWN+ LCTL, DOWN+ 'r', D(), UP+ LCTL, UP+ 'r')
define GunsightShade CHAIN( DOWN+L_ALT, D(), DOWN+'f', D(), UP+'f', D(), UP+L_ALT)
define AutopilotRightPress CHAIN( DOWN+L_SHIFT, D(), DOWN+'x')
define AutopilotRightRelease CHAIN( UP+'x', D(), UP+L_SHIFT)
define AutopilotLeftPress CHAIN( DOWN+L_SHIFT, D(), DOWN+'z')
define AutopilotLeftRelease CHAIN( UP+'z', D(), UP+L_SHIFT)
define AutopilotLevel CHAIN( DOWN+L_SHIFT, D(), DOWN+'a', D(), UP+'a', D(), UP+L_SHIFT)
define NavLights CHAIN( DOWN+R_CTL, D(), DOWN+'l', D(), UP+'l', D(), UP+R_CTL)
define Boost CHAIN( DOWN+L_SHIFT, D(), DOWN+'b', D(), UP+'b', UP+L_SHIFT)
define Supercharger CHAIN( DOWN+L_SHIFT, D(), DOWN+'s', D(), UP+'s', UP+L_SHIFT)

define FlapsUp CHAIN(DOWN+L_SHIFT, D(), DOWN+'f')
define FlapsDown DOWN+'f'
define FlapsRelease CHAIN(UP+L_SHIFT, UP+'f')
define FlapsUpInc CHAIN( DOWN+L_SHIFT, D(), DOWN+'f', D(2500), UP+'f', D(), UP+L_SHIFT)
define FlapsUpFull CHAIN( DOWN+L_SHIFT, D(), DOWN+'f', D(15000), UP+'f', D(), UP+L_SHIFT)
define FlapsDownInc CHAIN( DOWN+'f', D(2500), UP+'f')
define FlapsDownFull CHAIN( DOWN+'f', D(15000), UP+'f')

define Speedbrake CHAIN( DOWN+R_ALT, D(), DOWN+'b', D(), UP+'b', UP+R_ALT)
define TailwheelLock CHAIN( DOWN+L_SHIFT, D(), DOWN+'g', D(), UP+'g', UP+L_SHIFT)

define WaterRadOpen CHAIN( DOWN+R_CTL, D(), DOWN+'=')
define WaterRadOpenRel CHAIN(UP+R_CTL, UP+'=')
define WaterRadClose CHAIN( DOWN+R_CTL, D(), DOWN+'-')
define WaterRadCloseRel CHAIN(UP+R_CTL, UP+'-')

define OilRadOpen CHAIN( DOWN+R_WIN, D(), DOWN+'=')
define OilRadOpenRel CHAIN(UP+R_WIN, UP+'=')
define OilRadClose CHAIN( DOWN+R_WIN, D(), DOWN+'-')
define OilRadCloseRel CHAIN(UP+R_WIN, UP+'-')

 

  • 3 weeks later...
Posted

Darkcyde, do you have a TM profile yet? Its almost impossible to find a good one, with complex comands.

DCS has thousands of them, but IL2BOS .... :-(

I´ve found some, but they are too old or too simple.

 

Please, share yours if you dont mind. I lack of any programming skills and I see you know script language. I´m sure a lot of people is in my same situation.

 

Thanks in advance!

  • 2 weeks later...
Posted (edited)

I guess I can throw up what I have.  Not much effort into fixing the comments or cleaning things up.  It's a snapshot of my current script, things might need fixing, YMMV.  It's based on Pand's script http://www.thewetbandits.org/smf/index.php?topic=39.0

 

Il2.tmc

//################################################################################
//
//    IL2-BOS_Pand.tmc
//    for
//    IL-2 Sturmovik: Battle of Stalingrad
//
//    by Justin "Pandemonium" Powell (a.k.a. Pand)
//
//    Controllers:    Thrustmaster Warthog Stick, Throttle, Rudder Pedals
//                    Left MFD, Right MFD, Saitek Throttle Quadrant
//
//################################################################################
include "target.tmh" // Default system import
include "IL2-BOS_macros.ttm"

//declare
int TrimReset, TrimStickLock, TrimStickUnlock;

// Macros for Trim, use variable because define doesn't like EXECs.
int InitMacros(){
    TrimReset = EXEC("TrimDXAxis(DX_X_AXIS, SET(0));TrimDXAxis(DX_Y_AXIS, SET(0));");
    TrimStickUnlock = EXEC(
        "TrimDXAxis(DX_X_AXIS, CURRENT);"
        "TrimDXAxis(DX_Y_AXIS, CURRENT);"
        "LockAxis(&Joystick, JOYX, 0);"
        "LockAxis(&Joystick, JOYY, 0);"
        "DXAxis(DX_X_AXIS, AxisVal(Joystick[JOYX], &axdata));"
        "DXAxis(DX_Y_AXIS, AxisVal(Joystick[JOYY], &axdata));"
    );
    TrimStickLock = EXEC(
        "LockAxis(&Joystick, JOYX, 1);"
        "LockAxis(&Joystick, JOYY, 1);"
    );
}

//program startup
int main()
{
//    Exclude Devices not present
    Exclude(&HCougar);
    Exclude(&T16000);
    Exclude(&T16000L);
    Exclude(&LMFD);
    Exclude(&RMFD);
    Exclude(&TWCSThrottle);
    Exclude(&TFRPRudder);
    
    if(Init(&EventHandle)) return 1; // declare the event handler, return on error

//################################################################################
//    SPECIAL SETTINGS
//################################################################################

    SetKBRate(32, 50);
    SetKBLayout(KB_ENG);
    SetShiftButton(&Joystick, S3, 0, 0, 0, 0);

//initialize LED status all "OFF" 
    ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED1-LED2-LED3-LED4-LED5)); //set LEDs OFF 
    ActKey(PULSE+KEYON+LED(&LMFD, LED_ONOFF, LED_CURRENT-LED1-LED2)); //set left MFD LEDs  OFF 
    ActKey(PULSE+KEYON+LED(&RMFD, LED_ONOFF, LED_CURRENT-LED1-LED2)); //set right MFD LEDs  OFF 

//################################################################################
//    AXIS MAP
//################################################################################

    MapAxis(&Joystick, JOYX, DX_X_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
    SetSCurve(&Joystick, JOYX, 
        0,         //Left Deadzone %
        0,         //Center Deadzone %
        0,         //Right Deadzone %
        0,         //Linearity Curve
        0);     //Scale
    
    MapAxis(&Joystick, JOYY, DX_Y_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
    SetSCurve(&Joystick, JOYY, 
        0,         //Left Deadzone %
        0,         //Center Deadzone %
        0,         //Right Deadzone %
        0,         //Linearity Curve
        0);        //Scale
    
    MapAxis(&Throttle, SCX, MOUSE_X_AXIS, AXIS_NORMAL, MAP_RELATIVE);
    SetSCurve(&Throttle, SCX, 
        0,         //Left Deadzone %
        10,     //Center Deadzone %
        0,         //Right Deadzone %
        0,         //Linearity Curve
        -6);    //Scale
        
    MapAxis(&Throttle, SCY, MOUSE_Y_AXIS, AXIS_NORMAL, MAP_RELATIVE);
    SetSCurve(&Throttle, SCY, 
        0,         //Left Deadzone %
        10,     //Center Deadzone %
        0,         //Right Deadzone %
        0,         //Linearity Curve
        -6);    //Scale    
        
    MapAxis(&Throttle, THR_LEFT, DX_ZROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
    SetSCurve(&Throttle, THR_LEFT, 
        0,         //Left Deadzone %
        0,         //Center Deadzone %
        0,         //Right Deadzone %
        0,         //Linearity Curve
        0);        //Scale
//    SetJCurve(&Throttle, THR_LEFT, 
//        65,     //At this % of the physical travel
//        100);    //This is the value of the logical axis
    
    MapAxis(&Throttle, THR_RIGHT, DX_Z_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
        SetSCurve(&Throttle, THR_RIGHT, 
        0,         //Left Deadzone %
        0,         //Center Deadzone %
        0,         //Right Deadzone %
        0,         //Linearity Curve
        0);        //Scale
//    SetJCurve(&Throttle, THR_RIGHT,
//        65,     //At this % of the physical travel
//        100);    //This is the value of the logical axis
        
    MapAxis(&Throttle, THR_FC, DX_YROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
    SetSCurve(&Throttle, THR_FC,
        0,         //Left Deadzone %
        0,         //Center Deadzone %
        0,         //Right Deadzone %
        0,         //Linearity Curve
        0);        //Scale
        
    SetSCurve(&TFRPRudder, TRUDDER,
        0,         //Left Deadzone %
        0,         //Center Deadzone %
        0,         //Right Deadzone %
        2,         //Linearity Curve
        0);        //Scale
    SetSCurve(&TFRPRudder, TRPLEFT,
        0,         //Left Deadzone %
        0,         //Center Deadzone %
        0,         //Right Deadzone %
        0,         //Linearity Curve
        0);        //Scale
    SetSCurve(&TFRPRudder, TRPRIGHT,
        0,         //Left Deadzone %
        0,         //Center Deadzone %
        0,         //Right Deadzone %
        0,         //Linearity Curve
        0);        //Scale
    

//  Map Keys
    InitMacros();
    MapJoystick();
    MapThrottle();

}  //End Main

//################################################################################
//    STICK CONFIGURATION COMMANDS
//################################################################################
int MapJoystick() {

// LED's on for Game mode mapping
Backlight(2);

//    TRIGGER (Trigger)
    MapKeyIO(&Joystick, TG1, 
        DX2,                                                                    //Fire Cannon
        DX1);                                                                    //Fire MG
    MapKey(&Joystick, TG2, SPC);                                                //Fire MG & Cannon

//    MMCB (Master Mode Control Btn)
    MapKeyIO(&Joystick, S1, 
        GunsightShade,            //Gunsight Shade
        PULSE+'r');                                                                //Fire Rockets

//    WR (Weapon Release)
    MapKeyIO(&Joystick, S2, 
        PULSE+'b',                                                                 //Release Bomb
        DX2);                                                                    //Fire Cannon

//    NWS (Nose Wheel Steering)
    MapKey(&Joystick, S3, TEMPO(TailwheelLock, 0, 250)); //Hold for Shift

//    PADDLE (Paddle Switch)
    MapKey(&Joystick, S4, DX5);                                                    //Shift Button

//    Hat 1 - TRIM (Coolie)
    MapKeyIO(&Joystick, H1U, 
        L_CTL+'t',                                    //Reset Trims
        UARROW);                                    //Trim Stabalizer/Elevator Nose Forward
    MapKeyIO(&Joystick, H1R, 
        RARROW,                                                            //Trim Aileron Right
        L_CTL+'x');                                                                //Trim Rudder Right
    MapKeyIO(&Joystick, H1D,
        0,    
        DARROW);                                    //Trim Stabalizer/Elevator Nose Forward
    MapKeyIO(&Joystick, H1L, 
        LARROW,                                                            //Trim Aileron Left
        L_CTL+'z');                                                                //Trim Rudder Left    

//    Hat 2 - TMS (Grid)
    MapKeyIO(&Joystick, H2U, 
        TrimReset,    //Reset DIRECT X Axis (X&Y) Trims
        TrimStickLock);//Variable Trim DIRECT X Axis (X&Y)
    MapKeyR(&Joystick, H2U,    TrimStickUnlock);
    
    MapKey(&Joystick, H2R, AutopilotRightPress);                //Autopilot Right Turn Press
    MapKeyR(&Joystick, H2R, AutopilotRightRelease);                    //Autopilot Right Turn Release
    MapKey(&Joystick, H2L, AutopilotLeftPress);                //Autopilot Left Turn Press
    MapKeyR(&Joystick, H2L, AutopilotLeftRelease);                    //Autopilot Left Turn Release
    MapKeyIO(&Joystick, H2D, 
        PULSE+'a',                                                                //Toggle AI Autopilot
        AutopilotLevel);     //Toggle Autopilot Mode Level

//    Hat 3 - DMS (Castle)
    MapKeyIO(&Joystick, H3U, 
        PULSE+ESC,                                                                //Menu
        PULSE+'p');                                                                        //Pause
    MapKeyIO(&Joystick, H3R, 
        0,                                                                        //unassigned
        PULSE+'h');                                                                        //unassigned
    MapKeyIO(&Joystick, H3D, 
        PULSE+TAB,                                                                        //Lobby
        PULSE+'o');                                                                        //Map/Objectives
    MapKeyIO(&Joystick, H3L, 
        PULSE+'m',                                                                // Map Mode
        PULSE+'i');                                                                        //unassigned

//    Hat 4 - CMS (Side Thumb)
    MapKey(&Joystick, H4U, UARROW);
    MapKey(&Joystick, H4R, RARROW);
    MapKey(&Joystick, H4D, DARROW);
    MapKey(&Joystick, H4L, LARROW);
    MapKey(&Joystick, H4P, ENT);

}  //End MapJoystick()
//################################################################################
//    THROTTLE CONFIGURATION COMMANDS
//################################################################################

int MapThrottle() {
//    THROTTLE IDLE DETENTS
    MapKey(&Throttle, IDLELON, 0);                                                //unassigned
    MapKeyR(&Throttle, IDLELON, 0);                                                //unassigned
    MapKey(&Throttle, IDLERON, 0);                                                //unassigned
    MapKeyR(&Throttle, IDLERON, 0);                                                //unassigned

//    PINKY SWITCH
    MapKey(&Throttle, PSF, NavLights);     // Toggle NAV Lights    
    MapKeyR(&Throttle, PSF, 0);                                                                //unassigned
    MapKey(&Throttle, PSB, NavLights);    // Toggle NAV Lights                                                    //unassigned
    MapKeyR(&Throttle, PSB, NavLights); // Toggle NAV Lights    

//    LTB
    MapKeyIO(&Throttle, LTB, 
        0,
        DX3);  //VR Center

//    SLEW (Microstick Press)
    MapKeyIO(&Throttle, SC, 
        DX4,                                                                     //VR Zoom
        DX3);                                                                     //VR center

//    COOLIE Hat
    MapKey(&Throttle, CSU, WaterRadOpen);
    MapKeyR(&Throttle, CSU, WaterRadOpenRel);
    MapKey(&Throttle, CSD, WaterRadClose);
    MapKeyR(&Throttle, CSD, WaterRadCloseRel);
    MapKey(&Throttle, CSR, OilRadOpen);
    MapKeyR(&Throttle, CSR, OilRadOpenRel);
    MapKey(&Throttle, CSL, OilRadClose);
    MapKeyR(&Throttle, CSL, OilRadCloseRel);
        
//    MIC (Microphone)
    MapKeyIO(&Throttle, MSL, 
        0,
        '`');                                                                    //Transmit    
    MapKeyIO(&Throttle, MSU, 
        0,                                                                        //Transmit Strike Common
        R_CTL+KP7);
    MapKeyIO(&Throttle, MSR, 
        0,
        R_CTL+KP9);                                                                //Transmit Whisper
    MapKeyIO(&Throttle, MSD, 
        0,
        R_CTL+KP9);                                                                //Transmit Whisper
    MapKeyIO(&Throttle, MSP, 
        0,
        USB[84]);                                                                //Transmit Twitch (KP/)

    
//    SPEED BRAKE
    MapKey(&Throttle, SPDF, Speedbrake);    //Extend Speed Brake
    MapKeyR(&Throttle, SPDF, EXEC("if (!Joystick[S3]) ActKey(KEYON+Speedbrake);"));    //Shift disables to fix wrong state
    MapKey(&Throttle, SPDB, Speedbrake);    //Extend Speed Brake
    MapKeyR(&Throttle, SPDB, Speedbrake);    //Retract Speed Brake

//    BOAT SWITCH                                                    
    MapKeyIO(&Throttle, BSB, 
        0,
        Supercharger);
    MapKeyR(&Throttle, BSB, EXEC("if (!Joystick[S3]) ActKey(KEYON+Supercharger);")); //Shift disables
    MapKeyIO(&Throttle, BSF, 
        0,
        Boost);
    MapKeyRIO(&Throttle, BSF, EXEC("if (!Joystick[S3]) ActKey(KEYON+Boost);")); //Shift disables

//    CHINA HAT                                                    
    MapKeyIO(&Throttle, CHF,
        CHAIN( PULSE+L_CTL+'2', D(3000), PULSE+L_CTL+SPC, D(500), PULSE+L_CTL+'`'),        //Fire Green Flare        
        CHAIN( PULSE+L_CTL+'1', D(3000), PULSE+L_CTL+SPC, D(500), PULSE+L_CTL+'`'));    //Fire Red Flare
    MapKeyR(&Throttle, CHF, 0);                                                            //unassigned
    MapKeyIO(&Throttle, CHB,
        0,                                                                                //unassigned        
        CHAIN( PULSE+L_CTL+'3', D(3000), PULSE+L_CTL+SPC, D(500), PULSE+L_CTL+'`'));    //Fire White Flare
    MapKeyR(&Throttle, CHB, 0);                                                            //unassigned

//    ENG FUEL FLOW
    MapKey(&Throttle, EFLNORM, 0);                                                //unassigned
    MapKey(&Throttle, EFLOVER, 0);                                                //unassigned
    MapKey(&Throttle, EFRNORM, 0);                                                //unassigned
    MapKey(&Throttle, EFROVER, 0);                                                //unassigned
    
//    ENG OPER IGN    
    MapKey(&Throttle, EOLIGN, PULSE+R_CTL+'1');                                    //Engine 1 Start Procedure
    MapKey(&Throttle, EORIGN, PULSE+R_CTL+'2');                                    //Engine 2 Start Procedure

//    ENG OPER MOTOR/NORM
    MapKey(&Throttle, EOLMOTOR, 0);                                                //unassigned
    MapKey(&Throttle, EORMOTOR, 0);                                                //unassigned
    
//    APU START
    MapKey(&Throttle, APUON, 0);
//    APU OFF
    MapKey(&Throttle, APUOFF, 0);

//     FLAPS SWITCH
    MapKey(&Throttle, FLAPU, FlapsUp);
    //MapKeyR(&Throttle, FLAPU, 0);                                                //null
    MapKey(&Throttle, FLAPM, FlapsRelease);
    //MapKeyR(&Throttle, FLAPM, 0);                                                //null
    MapKey(&Throttle, FLAPD, FlapsDown);
    //MapKeyR(&Throttle, FLAPD, 0);                                                //null
    
//    L/G WARN
    MapKeyIO(&Throttle, LDGH, 
        TailwheelLock,         //Tailwheel lock
        PULSE+'g');                                                                //Toggle Gear

//    EAC SWITCH
    MapKeyIO(&Throttle, EACON,
        PULSE+L_CTL+'e',                                                         //Bail Out
        PULSE+R_ALT+'c');                                                        //Toggle Canopy
    MapKeyIO(&Throttle, EACOFF,
        PULSE+L_CTL+'e',                                                         //Bail Out
        PULSE+R_ALT+'c');                                                        //Toggle Canopy
    
//    RDR ALTM SWITCH
    MapKeyIO(&Throttle, RDRNRM, 
        PULSE+'l',                                                                //Toggle Cockput Lights
        NavLights);            //Toggle NAV Lights
    MapKeyIO(&Throttle, RDRDIS, 
        PULSE+'l',                                                                //Toggle Cockput Lights
        NavLights);            //Toggle NAV Lights

//    AUTOPILOT ENGAGE/DISENGAGE
    MapKeyIO(&Throttle, APENG, 
        PULSE+'a',                                                                //Toggle AI Autopilot
        AutopilotLevel);     //Toggle Autopilot Mode Level
    
//    AUTOPILOT SWITCH
    MapKey(&Throttle, APPAT, AutopilotRightPress);                //Autopilot Right Turn Press
    MapKeyR(&Throttle, APPAT, AutopilotRightRelease);                    //Autopilot Right Turn Release
    MapKey(&Throttle, APALT, AutopilotLeftPress);                //Autopilot Left Turn Press
    MapKeyR(&Throttle, APALT, AutopilotLeftRelease);                    //Autopilot Left Turn Release
    
    
//################################################################################
//    Left MFD Configuration Commands
//################################################################################
    MapKey(&LMFD, OSB01, 0);                                                    //unassigned
    MapKey(&LMFD, OSB02, 0);                                                    //unassigned
    MapKey(&LMFD, OSB03, 0);                                                    //unassigned
    MapKey(&LMFD, OSB04, 0);                                                    //unassigned
    MapKey(&LMFD, OSB05, 0);                                                    //unassigned
    MapKey(&LMFD, SYMU, 0);                                                        //unassigned
    MapKey(&LMFD, SYMD, 0);                                                        //unassigned
    MapKey(&LMFD, OSB06, CHAIN( PULSE+L_CTL+'1', D(500), MOUSE_LEFT));            //Fire Red Flare
    MapKey(&LMFD, OSB07, CHAIN( PULSE+L_CTL+'2', D(500), MOUSE_LEFT));            //Fire Green Flare
    MapKey(&LMFD, OSB08, CHAIN( PULSE+L_CTL+'3', D(500), MOUSE_LEFT));            //Fire Yellow Flare
    MapKey(&LMFD, OSB09, CHAIN( PULSE+L_CTL+'4', D(500), MOUSE_LEFT));            //Fire White Flare
    MapKey(&LMFD, OSB10, PULSE+L_CTL+'`');                                         //Toggle Personal Weapon
    MapKeyIO(&LMFD, CONU, 
        PULSE+L_CTL+'e',                                                         //Bail Out
        PULSE+R_ALT+'c');                                                        //Toggle Canopy
    MapKeyIO(&LMFD, COND,
        PULSE+L_CTL+'e',                                                         //Bail Out
        PULSE+R_ALT+'c');                                                        //Toggle Canopy
    MapKey(&LMFD, OSB11, 0);                                                    //unassigned
    MapKey(&LMFD, OSB12, PULSE+'l');                                                            //Toggle Cockput Lights
    MapKey(&LMFD, OSB13, CHAIN( DOWN+R_SHIFT, D(), DOWN+'l', D(), UP+'l', D(), UP+R_SHIFT));    //Toggle Landing Lights
    MapKey(&LMFD, OSB14, CHAIN( DOWN+R_CTL, D(), DOWN+'l', D(), UP+'l', D(), UP+R_CTL));        //Toggle NAV Lights
    MapKey(&LMFD, OSB15, 0);                                                    //unassigned
    MapKey(&LMFD, BRTU, 0);                                                        //unassigned
    MapKey(&LMFD, BRTD, 0);                                                        //unassigned
    MapKey(&LMFD, OSB16, 0);                                                    //unassigned
    MapKey(&LMFD, OSB17, R_CTL+KP3);                                            //Move Channel - Green    
    MapKey(&LMFD, OSB18, R_CTL+KP2);                                            //Move Channel - Blue
    MapKey(&LMFD, OSB19, R_CTL+KP1);                                            //Move Channel - Red
    MapKey(&LMFD, OSB20, R_CTL+KP0);                                            //Move Channel - Tower
    MapKey(&LMFD, GAINU, 0);                                                    //unassigned
    MapKey(&LMFD, GAIND, 0);                                                    //unassigned

//################################################################################
//    Right MFD Configuration Commands
//################################################################################
    //MapKey(&RMFD, OSB01, 0);                                                    //unassigned
    //MapKey(&RMFD, OSB02, 0);                                                    //unassigned
    //MapKey(&RMFD, OSB03, 0);                                                    //unassigned
    //MapKey(&RMFD, OSB04, 0);                                                    //unassigned
    //MapKey(&RMFD, OSB05, 0);                                                    //unassigned
    //MapKey(&RMFD, SYMU, 0);                                                    //unassigned
    //MapKey(&RMFD, SYMD, 0);                                                    //unassigned
    //MapKey(&RMFD, OSB06, 0);                                                    //unassigned
    //MapKey(&RMFD, OSB07, 0);                                                    //unassigned
    //MapKey(&RMFD, OSB08, 0);                                                    //unassigned
    //MapKey(&RMFD, OSB09, 0);                                                    //unassigned
    //MapKey(&RMFD, OSB10, 0);                                                    //unassigned
    //MapKey(&RMFD, CONU, 0);                                                    //unassigned
    //MapKey(&RMFD, COND, 0);                                                    //unassigned
    //MapKey(&RMFD, OSB11, 0);                                                    //unassigned
    //MapKey(&RMFD, OSB12, 0);                                                    //unassigned
    //MapKey(&RMFD, OSB13, 0);                                                    //unassigned
    //MapKey(&RMFD, OSB14, 0);                                                    //unassigned
    //MapKey(&RMFD, OSB15, 0);                                                    //unassigned
    //MapKey(&RMFD, BRTU, 0);                                                    //unassigned
    //MapKey(&RMFD, BRTD, 0);                                                    //unassigned
    //MapKey(&RMFD, OSB16, 0);                                                    //unassigned
    //MapKey(&RMFD, OSB17, 0);                                                    //unassigned    
    //MapKey(&RMFD, OSB18, 0);                                                    //unassigned
    //MapKey(&RMFD, OSB19, 0);                                                    //unassigned    
    //MapKey(&RMFD, OSB20, 0);                                                    //unassigned
    //MapKey(&RMFD, GAINU, 0);                                                    //unassigned
    //MapKey(&RMFD, GAIND, 0);                                                    //unassigned

} //End MapThrottle()

//Function Backlight()
//Sets Throttle and MFD backlight level.  Throttle only has 5 discreet levels.
//Parameters:  Brightness level, 0-5  
//OR any value from 6-255 sets level directly
int Backlight(int LED_BRT){
    if (LED_BRT <= 5) {  //set level 0-5 for throttle
        GameOutput(&Throttle, OUT_ID_LED_INTENSITY, 43 * LED_BRT);
        GameOutput(&LMFD, OUT_ID_LED_INTENSITY, 43 * LED_BRT);
        GameOutput(&RMFD, OUT_ID_LED_INTENSITY, 43 * LED_BRT);
    }
    else {  //set exact level from 0-255
        if (LED_BRT > 255) LED_BRT = 255; //cap at 255 max
        GameOutput(&Throttle, OUT_ID_LED_INTENSITY, LED_BRT);
        GameOutput(&LMFD, OUT_ID_LED_INTENSITY, LED_BRT);
        GameOutput(&RMFD, OUT_ID_LED_INTENSITY, LED_BRT);
    }
}

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

IL2-BOS_macros.ttm

define Pause 'p'
define TimeAccel ']'
define TimeDecel '['
define FlightRecord CHAIN(DOWN+ LCTL, DOWN+ 'r', D(), UP+ LCTL, UP+ 'r')
define GunsightShade CHAIN( DOWN+L_ALT, D(), DOWN+'f', D(), UP+'f', D(), UP+L_ALT)
define AutopilotRightPress CHAIN( DOWN+L_SHIFT, D(), DOWN+'x')
define AutopilotRightRelease CHAIN( UP+'x', D(), UP+L_SHIFT)
define AutopilotLeftPress CHAIN( DOWN+L_SHIFT, D(), DOWN+'z')
define AutopilotLeftRelease CHAIN( UP+'z', D(), UP+L_SHIFT)
define AutopilotLevel CHAIN( DOWN+L_SHIFT, D(), DOWN+'a', D(), UP+'a', D(), UP+L_SHIFT)
define NavLights CHAIN( DOWN+R_CTL, D(), DOWN+'l', D(), UP+'l', D(), UP+R_CTL)
define Boost CHAIN( DOWN+L_SHIFT, D(), DOWN+'b', D(), UP+'b', UP+L_SHIFT)
define Supercharger CHAIN( DOWN+L_SHIFT, D(), DOWN+'s', D(), UP+'s', UP+L_SHIFT)

define FlapsUp CHAIN(DOWN+L_SHIFT, D(), DOWN+'f')
define FlapsDown DOWN+'f'
define FlapsRelease CHAIN(UP+L_SHIFT, UP+'f')
define FlapsUpInc CHAIN( DOWN+L_SHIFT, D(), DOWN+'f', D(2500), UP+'f', D(), UP+L_SHIFT)
define FlapsUpFull CHAIN( DOWN+L_SHIFT, D(), DOWN+'f', D(15000), UP+'f', D(), UP+L_SHIFT)
define FlapsDownInc CHAIN( DOWN+'f', D(2500), UP+'f')
define FlapsDownFull CHAIN( DOWN+'f', D(15000), UP+'f')

define Speedbrake CHAIN( DOWN+R_ALT, D(), DOWN+'b', D(), UP+'b', UP+R_ALT)
define TailwheelLock CHAIN( DOWN+L_SHIFT, D(), DOWN+'g', D(), UP+'g', UP+L_SHIFT)

define WaterRadOpen CHAIN( DOWN+R_CTL, D(), DOWN+'=')
define WaterRadOpenRel CHAIN(UP+R_CTL, UP+'=')
define WaterRadClose CHAIN( DOWN+R_CTL, D(), DOWN+'-')
define WaterRadCloseRel CHAIN(UP+R_CTL, UP+'-')

define OilRadOpen CHAIN( DOWN+R_WIN, D(), DOWN+'=')
define OilRadOpenRel CHAIN(UP+R_WIN, UP+'=')
define OilRadClose CHAIN( DOWN+R_WIN, D(), DOWN+'-')
define OilRadCloseRel CHAIN(UP+R_WIN, UP+'-')
Edited by DarKcyde
removed unused Include
Posted

Thanks so MUCH!!! I will test it inmediately!!!

Posted
Oh I forgot to mention how the Trim macros work.  It sets the joystick trim when you press it (TrimStickLock) but disables the joystick until you release it (TrimStickUnlock).  To use, press and hold trim, bring joystick back to center, then release trim button.  This keeps the plane steady, preventing the sudden doubling of input when the trim is applied.

 

Also, a few throttle switches can be disabled by pressing shift.  Use this to match up their physical state to the game state.

  • 4 months later...
fubar_2_niner
Posted

Hi DarKcyde

 

As requested here are the script errors I am getting when compiling your script:

 

Compile Error:File not found: usb_keys.tmh in il2.tmc at line 14

Compile Error:File not found: IL2-BOS_macros.ttm in il2.tmc at line 15

 

Compile Error:Type required in il2.tmc at line 471;

 

After reming those lines out the script compiles ok, however on running I get a further error;

 

Physical USB HID devices managed by script!
Currently plugged USB HID devices[3]:
1: "Joystick - HOTAS Warthog" - "USB\VID_044F&PID_0402&REV_0100"
2: "T-Rudder" - "USB\VID_044F&PID_B679&REV_0110"
3: "Throttle - HOTAS Warthog" - "USB\VID_044F&PID_0404&REV_0100"
USB HID device "Throttle - HOTAS Warthog"(USB\VID_044F&PID_0404\7&2FCE6599&0&3) selected
USB HID device "Joystick - HOTAS Warthog"(USB\VID_044F&PID_0402\7&2FCE6599&0&4) selected
Virtual HID devices managed by script!
Connecting virtual joystick...Done
Device name set to Thrustmaster Combined
Connecting virtual keyboard...Done
Connecting virtual mouse (absolute axes)...Done
Script stopped!

Runtime Error: Symbol not found: GunsightShade in MapJoystick ( line 173 in il2.tmc )

 

On another note, I have tried Pands edited script but still have problems in regard to mapping controls via BoX GUI. There is no reame/txt file to show what to map where ??

 

As you you can see I am running only TM Warthog HOTAS and TM pedals, no other controller hardware save TIR.

 

Any and all help much appreciated mate, this is by far the most promising script so far found, but I am completely floundered as to hot to get it working.

 

Best regards.

 

Fubar

 

Posted (edited)

> Compile Error:File not found: usb_keys.tmh in il2.tmc at line 14

That one is a custom file of mine, just delete the line.

 

>  Compile Error:File not found: IL2-BOS_macros.ttm in il2.tmc at line 15

 

>  GunsightShade is a macro from IL2-BOS_macros.ttm.

 

You'll need to uncomment the include at line 15..  It has all the macros this thread was about in the first place.  GunsightShade is in that file.

 

Edited by DarKcyde
update
fubar_2_niner
Posted

Hi DarKcyde

 

Followed your instructions. Deleted line 14. However line 15 is still giving me the same problems. Removed the // before include "IL2-BOS_macros.ttm"

 

I get the same error on compiling, I even tried removing the " " , before and after IL2-BOS_macros.ttm ; that gave me an ;

 

Compile Error:"filename" expected in il2.tmc at line 15.

 

Really not sure what is going on mate??

 

As always all help much appreciated.

 

Best regards.

 

Fubar

Posted

I have no idea what's going on there.  Don't remove the quotes.  This is C syntax, it is very picky.  You actually created the IL2-BOS_macros.ttm right?  In the same directory as the il2.tmc?

 

include "target.tmh" // Default system import
include "IL2-BOS_macros.ttm"

 

you could just put those defines in your main script file.  I hesitate to recommend that, it doesn't seem like you are familiar with joys of coding and computing.  You can do whatever you want... the script will just spit errors until you figure out how to fix it.  Assuming... basically anything... will bite you in the rear.  Check the script manual for examples and syntax.

fubar_2_niner
Posted
14 hours ago, DarKcyde said:

I have no idea what's going on there.  Don't remove the quotes.  This is C syntax, it is very picky.  You actually created the IL2-BOS_macros.ttm right?  In the same directory as the il2.tmc?

 

Duh what a dumbass, thanks for pointing out my stupid error DarKcyde! I forgot to create the macros.ttm :crazy:

 

Working on my own script at the moment, but I'll create that file and save it. I just know mine will go tits up at some point ;) 

 

Best regards.

 

Fubar

  • 10 months later...
Posted

Greetings, new to target and it's coming slow, so apologies if i say something idiotic.

 

So im having trouble getting mfd's working so I've been searching for script examples for hours now.  In this one here I noticed that the MFD's are excluded, yet there's still mappings defined...at least for the right one.  That's very confusing...does it work?

 

I just have the stock mappings like the ones in this scripts commented left.  Target runs fine, device analyzer shows button presses on the left on each mfd...so i think all's good, but as soon as i launch the game both mfd's quit registering button presses the device analyzer.  As well, they are not responsive in game.

 

Thx,

 

David

Posted

The MFD stuff was from the original script I started on.

 

If you remove the Excludes, the MFD's should work in the script.  These lines:

 

//Exclude(&LMFD);
//Exclude(&RMFD);

If it's not working, paste the log from Target when your script starts, it should show the MFD's being added to the script.

  • 4 months later...
Posted

I'm currently working on a TARGET script to limit the virtual Throttle output to max combat under normal conditions and this works great.

I'm also adding a "turbo" button that allows the virtual controller output to go to max throttle output, this works also the only issue I'm having is that the virtual throttle output does not update until after the physical throttle is moved and then it will output the correct axis output. i'm using the SetCustomCurve () function and have tried to use the AXIS() function to force the virtual controller to flush the value out with no success.

 

the relevant parts of the code are:

 

MapKey(&Throttle, LDGH, EXEC("safe_point = (((Throttle[THR_LEFT] + 32768) * 100) / 65535);printf(\"safe_point = %d \\xa\", safe_point); ")); //save the current throttle setting as the safe_point
    MapKeyR(&Throttle, LDGH, EXEC("Set_Safe(safe_point);")); //call to set throttle safe curve on release of button
    MapKey(&Throttle, SPDB, EXEC("Set_Emerg();")); //call for emerg power throttle curve
    MapKeyR(&Throttle, SPDB, EXEC("Set_Safe(safe_point);")); //call to set throttle safe curve on release of button

 

 

defined functions:

 

 

int Set_Safe(int sp)
{

    SetCustomCurve (&Throttle, THR_LEFT, LIST(0,0, 50,50, sp,sp, 100,sp)); //set the safe throttle point curve this is a dead band from sp to 100% throttle
    
SetCustomCurve (&Throttle, THR_RIGHT, LIST(0,0, 50,50, sp,sp, 100,sp));
    AXIS(DX_ZROT_AXIS, 10, 1000); 
//force the THR_LEFT output to the setpoint
    
AXIS(DX_THROTTLE_AXIS, 10, 1000); //force the THR_RIGHT output to the setpoint
    
printf("safe_point = %d \xa", sp);
}
    int Set_Emerg()
{
    SetCustomCurve (&Throttle, THR_LEFT, LIST(0,0, 50,50, 75,75, 100,100)); 
//enable emergency throttle curve by removing the dead band
    
SetCustomCurve (&Throttle, THR_RIGHT, LIST(0,0, 50,50, 75,75, 100,100));
    AXIS(DX_ZROT_AXIS, 10, 1000); //force the THR_LEFT output to 100%
    
AXIS(DX_THROTTLE_AXIS, 10, 1000); //force the THR_RIGHT output to 100%
   
 printf("safe_point = 100 \xa");
}

 

the AXIS functions are not giving me any errors but are also not changing the virtual controller output, any ideas?

Thanks

  • 2 weeks later...
[VAF]HomeFries
Posted (edited)

I have an integrated TARGET profile  that now has IL-2 BoX as a selectable option in beta.  One of the things I really like is a dynamic throttle curve that allows you to set your afterburner detent to the max continuous throttle setting on the fly.  There's obviously a lot of knowledge here, so if you guys are interested in beta testing, please PM me.  I'm looking to put the IL-2 component out for release by the end of September.

Edited by [BVS]HomeFries
  • Upvote 1
  • 8 months later...
JG51BlackC5
Posted
On 9/13/2019 at 7:49 AM, [BVS]HomeFries said:

I have an integrated TARGET profile  that now has IL-2 BoX as a selectable option in beta.  One of the things I really like is a dynamic throttle curve that allows you to set your afterburner detent to the max continuous throttle setting on the fly.  There's obviously a lot of knowledge here, so if you guys are interested in beta testing, please PM me.  I'm looking to put the IL-2 component out for release by the end of September.

 let me know if i can help, I will down load your TARGET profile and try it out.

  • 2 weeks later...
Posted
On 9/2/2019 at 7:34 PM, JG51_BlackC5 said:

I'm currently working on a TARGET script to limit the virtual Throttle output to max combat under normal conditions and this works great.

I'm also adding a "turbo" button that allows the virtual controller output to go to max throttle output, this works also the only issue I'm having is that the virtual throttle output does not update until after the physical throttle is moved and then it will output the correct axis output. i'm using the SetCustomCurve () function and have tried to use the AXIS() function to force the virtual controller to flush the value out with no success

 

 

I'm back to playing IL2, and I started configuring my HOTAS again.  I actually solved this very problem in my script!

 

//Params: &device, axis
//E.g. UpdateDX(&Joystick, JOYX) or (&Throttle,THR_LEFT).
int UpdateDX(alias o, int x) {
	GetAxisData(&o, x);
	axdata.val = AxisVal(o[x], &axdata);
	if(!!axdata.dxmap & !axdata.locked & !axdata.relative) DXAxis(axdata.dxmap, axdata.val);	
}

Call that after making any changes to an axis (like curves) and it'll instantly update, without moving the control.  I'm working on some cool ideas taken from Homefries code.  That stuff is amazing, but its become a giant beast of a profile that's just a bit too complex for my taste.  I'm stealing the twin throttles stuff though, been flying the P38 a lot.  First time I've actually cared to use the split throttle on this thing.  I'll post when its a bit more stable, ideas don't always work in game the way you expected.

fubar_2_niner
Posted (edited)
On 5/31/2020 at 9:42 PM, DarKcyde said:

 

I'm back to playing IL2, and I started configuring my HOTAS again.  I actually solved this very problem in my script!

 


//Params: &device, axis
//E.g. UpdateDX(&Joystick, JOYX) or (&Throttle,THR_LEFT).
int UpdateDX(alias o, int x) {
	GetAxisData(&o, x);
	axdata.val = AxisVal(o[x], &axdata);
	if(!!axdata.dxmap & !axdata.locked & !axdata.relative) DXAxis(axdata.dxmap, axdata.val);	
}

Call that after making any changes to an axis (like curves) and it'll instantly update, without moving the control.  I'm working on some cool ideas taken from Homefries code.  That stuff is amazing, but its become a giant beast of a profile that's just a bit too complex for my taste.  I'm stealing the twin throttles stuff though, been flying the P38 a lot.  First time I've actually cared to use the split throttle on this thing.  I'll post when its a bit more stable, ideas don't always work in game the way you expected.

 

 

Great news DarKcyde, indeed, altho great, HF's script is a mind blower for a humble dimwit like me ;)

Edited by fubar_2_niner
  • 2 weeks later...
Posted

Update to my function, it had a _really_ annoying bug when used with the throttles.

 

//Params: &device, axis
//E.g. UpdateDX(&Joystick, JOYX) or (&Throttle,THR_LEFT).
int UpdateDX(alias o, int x) {
	GetAxisData(&o, x);
	axdata.val = AxisVal(o[x], &axdata);
	if(&o == &Throttle & (x == THR_LEFT | x == THR_RIGHT)) axdata.val = -axdata.val;
	if(!!axdata.dxmap & !axdata.locked & !axdata.relative) DXAxis(axdata.dxmap, axdata.val);	
}

I've been doing lots of experiments to see what works for the new 5 steps of zoom.  Here's some code snippets

 

	KeyAxis(&Throttle, THR_FC, 0, AXMAP2(6,
		ZoomMax,
		Zoom3,
		Zoom2,
		Zoom1,
		ZoomMin,
		0
		));

That actually sucks to use, since you often want to zoom while in combat, the friction control is a bad choice.  Good code reference though.  I experimented with zoom on the trigger:

 

//	TRIGGER
	MapKeyIO(&Joystick, TG1, 
		Zoom2,					//Shift for zoom
		DX1);					//Fire MG
	MapKeyIO(&Joystick, TG2, 
		DX1, 					//Cannon + Zoom
		DX6);					//Fire MG & Cannon

Its also not bad on the mouse nub.  Mine is mapped to mouse movement, which is only used on map or menus, and rarely at that. 

	//Shift to disable zoom and use mouse axes
	KeyAxis(&Throttle, SCY, 'o', AXMAP2(5, Zoom1, ZoomMin, 0, Zoom3, ZoomMax));
	MapKeyIO(&Throttle, SC, 
		MOUSE_LEFT,
		Zoom2);

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...