Jump to content

TARGET Script Editor quick and dirty


SGT Coyle

Recommended Posts

First!

Make a Macro File (.ttm) of the module you want to map with TARGET.

Use this fantastic tool by Carlton2001  for that purpose.  Macro Generator

This tool converts the Keyboard Controls HTML, you create with DCS, to a Macro File you can use in TARGET. It contains every keyboard command that exists in the module.

 

Next,

Make a Script Template. It should include all Thrustmaster devices you intend to use.

This is the one I use for every module I own:

 

 









include "target.tmh"                //  Basic include for "target.tmh" has 32 DirectX button support
//include "DCS_XXXSim_Macro.ttm"    //    Place holder for macro file

//program startup
int main()
{    
   
   if(Init(&EventHandle)) return 1;     // declare the event handler, return on error
   
   //Excluded Devices        This block of code lists all the Thrustmaster devices compatible with TARGET at time of writing.  This is where you pick and choose what devices are programed or ignored by TARGET.
   //Configure(&Device name, MODE_EXCLUDED);
   Configure(&HCougar, MODE_EXCLUDED);
   Configure(&T16000, MODE_EXCLUDED);
   Configure(&T16000L, MODE_EXCLUDED);
   Configure(&TWCSThrottle, MODE_EXCLUDED);
   Configure(&TFRPRudder, MODE_EXCLUDED);
   //Configure(&Joystick, MODE_EXCLUDED);
   Configure(&JoystickF18, MODE_EXCLUDED);  //  Makes the A10C Joystick grip work better
   
//AXIS init        AXIS Mapping goes here....................................................
   MapAxis(&Joystick, JOYX, DX_X_AXIS);        //initialize default joy stick "X" axis
   MapAxis(&Joystick, JOYY, DX_Y_AXIS);        //initialize default joy stick "Y" axis
   
   MapAxis(&Throttle, THR_LEFT, DX_ZROT_AXIS);    //initialize default "Left" throttle axis
   MapAxis(&Throttle, THR_RIGHT, DX_Z_AXIS);    //initialize default "Right" throttle axis
   
   MapAxis(&Throttle, SCX, DX_XROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);        //initialize default Mini Stick  "X" axis
       SetCustomCurve(&Throttle, SCX, LIST(0,0, 45,50, 55,50, 100,100));    //creates a deadzone in the middle of the axis, between 45% and 55%.
       
   
   MapAxis(&Throttle, SCY, DX_YROT_AXIS, AXIS_REVERSED, MAP_ABSOLUTE);        //initialize default Mini Stick  "Y" axis
       SetCustomCurve(&Throttle, SCY, LIST(0,0, 45,50, 55,50, 100,100));    //creates a deadzone in the middle of the axis, between 45% and 55%.        
   
   
   MapAxis(&Throttle, THR_FC, DX_SLIDER_AXIS);    //    initialize default "Slider" axis
   
   
// Init Lights        Info on LED lighting  on page 18 of manual
   ActKey(PULSE+KEYON+LED(&Throttle, LED_INTENSITY, 129)); // set Throttle backlight power to low
   ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT+LED1)); //set LED 1 ON
   ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED2)); //set LED 2 OFF
   ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT+LED3)); //set LED 3 ON
   ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED4)); //set LED 4 OFF
   ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT+LED5)); //set LED 5 ON

   


//////////////////////////////////////////////////////////////////////    
//BUTTON PROGRAMING STARTS BELOW
//////////////////////////////////////////////////////////////////

//****************************************************************************************************
//_________________Stick PROGRAMING_____________________
//---//MapKey(&Throttle,,);
//---//MapKeyIO(&Throttle,,in layer, out layer);
//---//MapKey(&JoystickF18,, TEMPO( short, long, time));
//****************************************************************************************************

//MapKeyIOUMD(&Stick,,
//                            ,
//                            ,
//                            ,
//                            ,
//                            ,
//                            );
//****************************************************************************************************

//Trigger
//MapKey(&Joystick, TG1, 0);
//MapKey(&Joystick, TG2, 0);

//Buttons
//MapKey(&Joystick, S1, 0);
//MapKey(&Joystick, S2, 0);
//MapKey(&Joystick, S3, 0);
MapKey(&Joystick,S4,0);            // Shift State Temp I/O.  Zeroed out here to prevent DX conflicts  

//DMS
//MapKeyIO(&Joystick,H3U, 0);
//MapKey(&Joystick,H3D, 0);
//MapKey(&Joystick,H3R, 0);
//MapKey(&Joystick,H3L, 0);
   
//TMS
//MapKey(&Joystick,H2U, 0);
//MapKey(&Joystick,H2D, 0);
//MapKey(&Joystick,H2R, 0);
//MapKey(&Joystick,H2L, 0);

//CMS
//MapKey(&Joystick,H4U, 0);
//MapKey(&Joystick,H4D, 0);
//MapKey(&Joystick,H4R, 0);
//MapKey(&Joystick,H4L, 0);

//MapKey(&Joystick,H4P,);

//Trim  
//MapKey(&Joystick,H1U, 0);
//MapKey(&Joystick,H1D, 0);
//MapKey(&Joystick,H1R, 0);
//MapKey(&Joystick,H1L, 0);




//****************************************************************************************************
//_________________Throttle PROGRAMING_____________________
//---//MapKey(&Throttle,,);
//---//MapKeyIO(&Throttle,,in layer, out layer);
//---//MapKey(&JoystickF18,, TEMPO( short, long, time));
//****************************************************************************************************
   
//Coolie Hat *************************            
//MapKey(&Throttle,CSD, 0);
//MapKey(&Throttle,CSU, 0);
//MapKey(&Throttle,CSR, 0);
//MapKey(&Throttle,CSL, 0);

//Slew                Currently assigned as axis control above *************************

//MapKey(&Throttle,,Slew_DWN);    
//MapKey(&Throttle,,Slew_UP);
//MapKey(&Throttle,,Slew_RT);
//MapKey(&Throttle,,Slew_LT);

//MapKey(&Throttle, SC, 0);    //  SlewControlPush  


//Left Throttle Button *************************
//MapKey(&Throttle,LTB,  0);

//Pinky Switch *************************
//MapKey(&Throttle,PSF, 0);
//MapKey(&Throttle,PSM, 0);
//MapKey(&Throttle,PSB, 0);

//MIC Switch *************************
//MapKey(&Throttle,MSR, 0);
//MapKey(&Throttle,MSL, 0);
//MapKey(&Throttle,MSU, 0);
//MapKey(&Throttle,MSD, 0);

//MapKey(&Throttle,MSP, 0);

//Speed Brake *************************
//MapKey(&Throttle,SPDF, 0);
//MapKey(&Throttle,SPDM, 0);
//MapKey(&Throttle,SPDB, 0);

//Boat Switch
//MapKey(&Throttle,BSF, 0);
//MapKey(&Throttle,BSM, 0);
//MapKey(&Throttle,BSB, 0);

//China Hat *************************
//MapKey(&Throttle,CHF, 0);
//MapKey(&Throttle,CHM, 0);
//MapKey(&Throttle,CHB, 0);

//****************************************************************************************************
//_________________Throttle Base PROGRAMING_____________________
//---//MapKey(&Throttle,,);
//---//MapKeyIO(&Throttle,,in layer, out layer);
//---//MapKey(&JoystickF18,, TEMPO( short, long, time));
//****************************************************************************************************
//Engine Fuel Flow LT/RT *************************
//MapKey(&Throttle, EFLNORM, 0); 
//MapKey(&Throttle, EFLOVER, 0);
//MapKey(&Throttle, EFRNORM, 0);
//MapKey(&Throttle, EFROVER, 0);

//Engine Operator LT/RT *************************
//MapKey(&Throttle, EOLIGN,  0);
//MapKey(&Throttle, EOLNORM,  0);
//MapKey(&Throttle, EOLMOTOR,  0);
//MapKey(&Throttle, EORIGN,  0);
//MapKey(&Throttle, EORNORM,  0);
//MapKey(&Throttle, EORMOTOR,  0);

//APU Switch *************************
//MapKey(&Throttle,APUON, 0);
//MapKey(&Throttle,APUOFF, 0);

//Landing Gear Button *************************
//MapKey(&Throttle,LDGH, 0);
//MapKey(&Throttle,LDGH, 0);
                       

//Autopilot Select Switch *************************
//MapKey(&Throttle,APPAT, 0);
//MapKey(&Throttle,APAH, 0);
//MapKey(&Throttle,APALT, 0);


//Autopilot Engage/Diengage *************************
//MapKeyIO(&Throttle,APENG, 0);

//Radar Altimeter Mode *************************
//MapKey(&Throttle,RDRNRM, 0);
//MapKey(&Throttle,RDRDIS, 0);

//EAC On/Off *************************
//MapKey(&Throttle,EACON, 0);
//MapKey(&Throttle,EACOFF, 0);

//Flap *************************
//MapKey(&Throttle,FLAPU, 0);
//MapKey(&Throttle,FLAPM, 0);
//MapKey(&Throttle,FLAPD, 0);

//Throttle Idle Cutoff *************************
//MapKey(&Throttle,IDLEROFF, 0);
//MapKey(&Throttle,IDLERON, 0);
//MapKey(&Throttle,IDLELOFF, 0);
//MapKey(&Throttle,IDLELON, 0);

//****************************************************************************************************
//_________________LMFD PROGRAMING_____________________
//---//MapKey(&Throttle,,);
//---//MapKeyIO(&Throttle,,in layer, out layer);
//---//MapKey(&JoystickF18,, TEMPO( short, long, time));
//****************************************************************************************************

//MapKey(&LMFD,OSB1, );
//MapKey(&LMFD,OSB2, );
//MapKey(&LMFD,OSB3, );
//MapKey(&LMFD,OSB4, );
//MapKey(&LMFD,OSB5, );

//MapKey(&LMFD,OSB6, );
//MapKey(&LMFD,OSB7, );
//MapKey(&LMFD,OSB8, );
//MapKey(&LMFD,OSB9, );
//MapKey(&LMFD,OSB10, );

//MapKey(&LMFD,OSB11, );
//MapKey(&LMFD,OSB12, );
//MapKey(&LMFD,OSB13, );
//MapKey(&LMFD,OSB14, );
//MapKey(&LMFD,OSB15, );

//MapKey(&LMFD,OSB16, );
//MapKey(&LMFD,OSB17, );
//MapKey(&LMFD,OSB18, );
//MapKey(&LMFD,OSB19, );
//MapKey(&LMFD,OSB20, );

//MapKey(&LMFD,GAINU, );
//MapKey(&LMFD,GAIND, );

//MapKey(&LMFD,SYMU, );
//MapKey(&LMFD,SYMD, );

//MapKey(&LMFD,CONU, );
//MapKey(&LMFD,COND, );

//MapKey(&LMFD,BRTU, );
//MapKey(&LMFD,BRTD, );


//****************************************************************************************************
//_________________RMFD PROGRAMING_____________________
//---//MapKey(&Throttle,,);
//---//MapKeyIO(&Throttle,,in layer, out layer);
//---//MapKey(&JoystickF18,, TEMPO( short, long, time));
//****************************************************************************************************

//MapKey(&RMFD,OSB1, );
//MapKey(&RMFD,OSB2, );
//MapKey(&RMFD,OSB3, );
//MapKey(&RMFD,OSB4, );
//MapKey(&RMFD,OSB5, );

//MapKey(&RMFD,OSB6, );
//MapKey(&RMFD,OSB7, );
//MapKey(&RMFD,OSB8, );
//MapKey(&RMFD,OSB9, );
//MapKey(&RMFD,OSB10, );

//MapKey(&RMFD,OSB11, );
//MapKey(&RMFD,OSB12, );
//MapKey(&RMFD,OSB13, );
//MapKey(&RMFD,OSB14, );
//MapKey(&RMFD,OSB15, );

//MapKey(&RMFD,OSB16, );
//MapKey(&RMFD,OSB17, );
//MapKey(&RMFD,OSB18, );
//MapKey(&RMFD,OSB19, );
//MapKey(&RMFD,OSB20, );

//MapKey(&RMFD,GAINU, );
//MapKey(&RMFD,GAIND, );

//MapKey(&RMFD,SYMU, );
//MapKey(&RMFD,SYMD, );

//MapKey(&RMFD,CONU,);
//MapKey(&RMFD,COND,);

//MapKey(&RMFD,BRTU, );
//MapKey(&RMFD,BRTD, );

//*******************__  Do Not Edit Below This Line  __**********************
//***********************Or at your own risk at least*************************
}
int EventHandle(int type, alias o, int x)
{
DefaultMapping(&o, x);
}
//?????????????????????????????????????????????????????????????????????????????
 

 

The above file has all the mapping commands for every button on Left and Right MFDs, Throttle, and Stick, commented out. All that needs to be done is copy and paste the DCS command from the macro into the MapKey function you want and un-comment the line(To un-comment, remove the // from the beginning).

 

Page 15 of the Fast Scripts Basics explains the MapKey function and page 20 explains Macro File.

 

 

That's quick and dirty. Not complete, but the manual is really good and not very difficult to follow. I will add more to concerning more multiple functions per controller button soon.

 

 

Followup Posts:

 

 

If you have questions or comments about what is presented please PM me.

 

I'd like to keep the thread from bulging from individual one on one conversations. If something needs further explanation or clarification, I will edit appropriate post.
 


Edited by SGT Coyle
Fixed error in the tempate.tmc that threw error

Night Ops in the Harrier

IYAOYAS


 
Link to comment
Share on other sites

How to set this thing up?

 

  1. Use the "Create New File" (CTRL + N) option in the TARGET Script Editor (TSE), and select .tmc from the file types presented. This will then open the TSE text editor with default code. We will overwrite this.
  2. Copy and paste the Template.tmc from the OP into your text editor, overwriting all the default text present, and save as "TEMPLATE.tmc". Now you have a template in the .tmc format to use over and over again.
  3. Place the Macro file(.ttm) in the same directory as your previously saved .tmc. It may be useful to mention that setting up a profile directory for your scripts and macros would be a good idea. TSE will use the default directory created on install for all saves. C:\Program Files (x86)\Thrustmaster\TARGET\scripts. I'll cover organizing files later.

OK, almost there.

 

In the text editor, open the TEMPLATE.tmc, if not already open.

First edit, is to change line 3:

//include "DCS_XXXSim_Macro.ttm"    //    Place holder for macro file

to:

include "Place Name of Macro File.ttm"

The name of the file, including the .ttm extension goes between quotes the "xxx.ttm".

 

 

Save it!

Save the .tmc as "What ever you want.tmc". Now you've preserved your TEMPLATE.tmc for future modules and have a usable script to edit in.

 

Now TEST it!

At top of text editor click "Compile". At the bottom of the text edtor is an output window. Script errors will be listed there. If all goes well "Compile Succeeded" is there

 

 

If compiling is successful, then Run It!

Next to compile button is the Run button. Click it an watch the output window for errors. You don't need to to have your devices connected to run a test. Were only looking for errors in the files. If you did every thing right your ready to start editing. If you get errors post them here.

 

 

As always I hope this helps.


Edited by SGT Coyle

Night Ops in the Harrier

IYAOYAS


 
Link to comment
Share on other sites

Cut and Paste is the rule!

How to use the Macro file within the Script.

Open the your previously saved "what ever you want.tmc" in the script editor.

 

Compile it.

To the left you'll see a file list containing all the files required to make the script work.

You can open them in the editor by clicking on them. We are only concerning ourselves with the .tmc and the Macro you made earlier.

Looking at the macro in the TSE, you see a long list of "Defines" conveniently divided by section as they appear in the DCS controls page. The define for any command begins with "define" followed by a space or tab. Next is the actual command we want to map followed by space or tab (All one word, NO SPACES. Use underscores). Last is the Keyboard command or USB Code that is mapped in DCS.

Below is and example of the Macro I made for the F16C. The Macro Generator translates the keyboard commands into Modifiers and USB code. It also gives readable translation in the form of a comment, at the end of every define.

 

// Stick; HOTAS; Flight Control  ***************************************************************************************************************************

define TRIM_Button_LEFT_WING_DOWN       R_CTL+USB[0x36]    // "RCtrl - ,"
define TRIM_Button_NOSE_DOWN                R_CTL+USB[0x33]    // "RCtrl - ;"
define TRIM_Button_NOSE_UP                      R_CTL+USB[0x37]    // "RCtrl - ."
define TRIM_Button_RIGHT_WING_DOWN     R_CTL+USB[0x38]    // "RCtrl - /"

To illustrate the utilitarian nature of the macro file, I rewrote the example to show how you can use USB code, DirectX commands, and straight keyboard keys.

 

// Stick; HOTAS; Flight Control  ***************************************************************************************************************************

define  TRIM_Button_LEFT_WING_DOWN[b]   R_CTL+USB[0x36][/b]  // Right Control modifier plus the USB  code for comma
define  TRIM_Button_NOSE_DOWN[b]            R_CTL+';'[/b]   // Same as above except Modifier plus straight keyboard text always between apostrophe for semi-colon
define  TRIM_Button_NOSE_UP[b]                  DX1[/b]            // DirectX command. Explained later
define  TRIM_Button_RIGHT_WING_DOWN [b]RARROW[/b]     // Right Arrow key. No modifier

OK, so how does this help? Cut and paste is your friend.

If you cut TRIM_Button_LEFT_WING_DOWN and paste it into the command for the trim hat up in the .tmc file you made, you will get a Right Control + Comma command sent to DCS when you push the trim hat forward. The command looks like this

//Trim  
MapKey(&Joystick,H1U, TRIM_Button_NOSE_DOWN);            
MapKey(&Joystick,H1D, TRIM_Button_NOSE_UP);
MapKey(&Joystick,H1R, TRIM_Button_RIGHT_WING_DOWN);
MapKey(&Joystick,H1L, TRIM_Button_LEFT_WING_DOWN);

This makes reading the .tmc file much easier than having to read "R_CTL+USB[0x36]" and wondering WTF?

 

As always I hope this helps.


Edited by SGT Coyle

Night Ops in the Harrier

IYAOYAS


 
Link to comment
Share on other sites

So whats with the Template?

The Script Template in the OP is setup to make it faster to get up and flying with a new script.

 

With a generous use of comments I divided the Script into sections.

 

 

  • Axis controls
  • LED lighting
  • Stick controls
  • Throttle (Hand)controls
  • Throttle Base controls
  • Left MFD
  • Right MFD

Each section has a line of code for every button and switch position(Some are 2 pos, some are 3 pos). All lines that have a control associated, have been commented out like so:

Left Throttle Button ************************* This is Sub-Section
[b]//[/b][color=Red]MapKey[/color](&Throttle,LTB,  0); //  This minimum mapping code required 

You only need to un-comment the lines you want to map. To un-comment, just delete the slashes at the beginning of every line in front of "MapKey".

With in every section there's a few lines commented out as notes on how to do certain things.

//---//MapKey(&Throttle, [color=Red]Button to be mapped[/color], [color=Blue]Macro[/color]);  
//---//MapKeyIO(&Throttle,,[color=SeaGreen]in layer[/color], [color=Cyan]out layer[/color]);
//---//MapKey(&JoystickF18,, TEMPO( [color=Red]short[/color], [color=Purple]long[/color], [color=Blue]time[/color]));

These notes also make it easier to cut and paste if necessary. I'll cover what these mean later.

Night Ops in the Harrier

IYAOYAS


 
Link to comment
Share on other sites

Looking forward to try the template out> Thanks for all the work.

----------------

AKA_Clutter

 

Win 10 Pro, Intel i7 8700k @4.6 GHz, EVGA RTX 3080  FTW, Ultra 64 GB G.Skill DDR4 3600 RAM, Acer 27" flat screen, Oculus Rift S, HP Reverb G2, CH Fighterstick, Pro Throttle and Pro Rudder Pedals HOTAS, TM Warthog HOTAS, MFG Rudder Pedals, TrackIR 5 Pro w/Vector Expansion, PointCTRL.

Link to comment
Share on other sites

Question: In your template, you have

 

"//Configure(&Joystick, MODE_EXCLUDED);" I understand that this does NOT exclude that control from the script.

 

I don't see a corresponding line for the TM WH Throttle. Now since it is comment out, it probably doesn't matter. Is there a reason NOT to have

 

//Configure(&Throttle, MODE_EXCLUDED);

 

in the template?

 

TIA

----------------

AKA_Clutter

 

Win 10 Pro, Intel i7 8700k @4.6 GHz, EVGA RTX 3080  FTW, Ultra 64 GB G.Skill DDR4 3600 RAM, Acer 27" flat screen, Oculus Rift S, HP Reverb G2, CH Fighterstick, Pro Throttle and Pro Rudder Pedals HOTAS, TM Warthog HOTAS, MFG Rudder Pedals, TrackIR 5 Pro w/Vector Expansion, PointCTRL.

Link to comment
Share on other sites

Let's get scripting.

A couple Rules to remember:

MapKey(&Joystick, S1, Expand_FOV_Button_Depress);
 
  1. "MapKey" is a function to make a button do something. There are other functions, but "MapKey" is the topic today.
  2. Every function has variables between "( )". For every one of these "(", you need one of these ")".
  3. Variables are separated by",".
  4. Every function line needs ";" at the end.

Making buttons do things on the stick.

To map keyboard presses, DirectX Commands, or other functions to the buttons on the joystick, you use the "MapKey" function.

 

What you need for a MapKey function:

Function Name (
Device Name,
Button Name,
Key or Command to be passed);
 
  • Function Name = MapKey
  • Device Name = TSE designation for the TM Device you want to map proceded by "&". i.e. &Joystick = Standard TMWH Joystick Grip.
  • Button Name = Name of the button or switch you want to map. Button names can be found on the Device diagram located in documents folder in the TMSE directory
  • Key to be mapped = keyboard key to mapped between " ' ' " (single quotes).

The template in the OP breaks down the joystick mapping options by button name (Triggers, Buttons, TMS Hat, DMS Hat, TRIM Hat, and CMS Hat).

 

 

The individual sections are further broken down into commented out MapKey functions for the each button in the section.

Example:

//TMS   // Hat Name on the Stick
//MapKey(&Joystick,H2U, 0);  // Device Name
//MapKey(&Joystick,H2D, 0);  // Actual button on the Hat to be mapped
//MapKey(&Joystick,H2R, 0);  // Zero passed w/ no quotation to produce "nothing"
//MapKey(&Joystick,H2L, 'c'); //C in single quotes to passed to DCS as key press[
 

This is what it looks like with my macros form the Macro.ttm

//TMS
MapKey(&Joystick,H2U, Target_Management_Switch_Up);
MapKey(&Joystick,H2D, Target_Management_Switch_Down);
MapKey(&Joystick,H2R, Target_Management_Switch_Right);
MapKey(&Joystick,H2L, Target_Management_Switch_Left);
 

Macros don't need single quotes and are easier to read.

 

 

Go read pgs 15 and 16 in the manual.

 

 

Hope this helps.


Edited by SGT Coyle

Night Ops in the Harrier

IYAOYAS


 
Link to comment
Share on other sites

Very informative thread .. subscribed, just in case I try to learn TARGET once again :)

 

For work: iMac mid-2010 of 27" - Core i7 870 - 6 GB DDR3 1333 MHz - ATI HD5670 - SSD 256 GB - HDD 2 TB - macOS High Sierra

For Gaming: 34" Monitor - Ryzen 3600X - 32 GB DDR4 2400 - nVidia GTX1070ti - SSD 1.25 TB - HDD 10 TB - Win10 Pro - TM HOTAS Cougar - Oculus Rift CV1

Mobile: iPad Pro 12.9" of 256 GB

Link to comment
Share on other sites

Layers!

WTF!

 

 

TARGET SE gives us three layers:

UP

MIDDLE

DOWN

and two sub-layers for each:

IN

OUT

 

You have to tell TARGET what layers/sub-layers you want to use and if the those layers are going to be momentary or toggled. You also need to tell TARGET what buttons or switch is going to activate witch layer/sub-layer. You do this with the "SetShiftButton" function.

SetShiftButton(Device for Sub-Layer, Button Name for Sub-Layer, Device for Layer, Button Name for UP, Button Name for DOWN, Toggle Indicator);
 

As with "MapKey", you need to tell "SetShiftButton" what device your going to map an activating button to, and what button it is going to be.

Example:

SetShiftButton(&Joystick, S4, &Throttle, PSF, PSB);
 

Sub-layer is Pinky Lever on the Stick.

Pinky Switch Forward is UP layer and Pinky Switch Back is the DOWN layer, on the Throttle. All the these activations are momentary since we didn't declare any Toggle instructions.

Look at pages 21 and 22 in the manual for more examples.

 

To make a "MapKey" assignment you need to tell "MapKey" that you want to access the Layers and/or Sub-Layers. You don't have to use layers or sub-layers in your "MapKey".  Any instructions in "MapKey" will default to the MIDDLE / OUT  layer, if you don't tell it otherwise.

 

So here's a scenario where I use the Trim Hat to trim the A/C. I assign all six trim functions to the four way hat using the Sub-Layer of the default MIDDLE layer.

MapKey(&Joystick,H1U, Nose_Down);
MapKey(&Joystick,H1D, Nose_Up);
MapKeyIO(&Joystick,H1R, Rudder_Right, Right_Wing_Down);
MapKeyIO(&Joystick,H1L, Rudder_Left, Left_Wing_Down);
 

IO added to the end of the "MapKey" function tells TARGET the TRIM Hat Left/Right buttons have Sub-Layer assignments available, but the TRIM Hat Up/Down buttons do not. Furthermore the Sub-Layer functions are only active while I hold the Pinky lever on the stick in, since I didn't give any toggle instructions. Momentary by default.

 

 

Now for a more complicated scenario also using the TRIM Hat button. First the example then the explanation.

MapKeyUMD(&Joystick,H1U, F1_Cockpit_view, Nose_Down, Cockpit_Camera_Move_Up);
MapKeyUMD(&Joystick, H1D, 0, Nose_Up, Cockpit_Camera_Move_Down);
MapKeyIOUMD(&Joystick,H1R, 0, F4_Chase_view, Rudder_Right, Right_Wing_Down, 0, F3_Fly_By_view);
MapKey(&Joystick,H1L, Left_Wing_Down);
 

First line "MapKeyUMD(&Joystick,H1U, Up layer Cockpit View, Middle layer Nose_Down, Down layer Cockpit_Camera_Move_Up);" MapKeyUMD tells the MapKey function that there is are UP, MIDDLE, and DOWN layer assignments in the function.

 

Second line is the same with exception of 0 in the UP layer position. A 0(zero) in a variable position will result in nothing. Nothing will be passed when in the UP layer and press H1 down.

 

Third line "MapKeyIOUMD(&Joystick,H1R, UP layer with sub-layer active, UP layer no sub-layer, MIDDLE layer sub-layer active, Middle layer no sub-layer, DOWN layer sub-layer active, DOWN layer no sub-layer active);"

As you can probably tell. When using Layers, the code can get rather messy and hard to read. Adding a little formatting to the text can make things much more clear:

MapKeyIOUMD(&Joystick,H1R,
           UP layer IN, UP layer OUT,
           MIDDLE layer IN, MIDDLE layer OUT,
           DOWN layer IN, DOWN layer OUT);
 

Fourth line is a standard single button assignment. No layers or sub-layers assignment in the function.

 

 

As you can see there are number of ways to interact with layers to multiple functions in a single button.

 

I hope this made sense.


Edited by SGT Coyle

Night Ops in the Harrier

IYAOYAS


 
Link to comment
Share on other sites

  • 3 months later...
How to set this thing up?

 

  1. Use the "Create New File" (CTRL + N) option in the TARGET Script Editor (TSE), and select .tmc from the file types presented. This will then open the TSE text editor with default code. We will overwrite this.
  2. Copy and paste the Template.tmc from the OP into your text editor, overwriting all the default text present, and save as "TEMPLATE.tmc". Now you have a template in the .tmc format to use over and over again.
  3. Place the Macro file(.ttm) in the same directory as your previously saved .tmc. It may be useful to mention that setting up a profile directory for your scripts and macros would be a good idea. TSE will use the default directory created on install for all saves. C:\Program Files (x86)\Thrustmaster\TARGET\scripts. I'll cover organizing files later.

OK, almost there.

 

In the text editor, open the TEMPLATE.tmc, if not already open.

First edit, is to change line 3:

//include "DCS_XXXSim_Macro.ttm"    //    Place holder for macro file

to:

include "Place Name of Macro File.ttm"

The name of the file, including the .ttm extension goes between quotes the "xxx.ttm".

 

 

Save it!

Save the .tmc as "What ever you want.tmc". Now you've preserved your TEMPLATE.tmc for future modules and have a usable script to edit in.

 

Now TEST it!

At top of text editor click "Compile". At the bottom of the text edtor is an output window. Script errors will be listed there. If all goes well "Compile Succeeded" is there

 

 

If compiling is successful, then Run It!

Next to compile button is the Run button. Click it an watch the output window for errors. You don't need to to have your devices connected to run a test. Were only looking for errors in the files. If you did every thing right your ready to start editing. If you get errors post them here.

 

 

As always I hope this helps.

 

"Copy and paste the Template.tmc from the OP into your text editor," Probably a stupid question but what is "OP"?

Link to comment
Share on other sites

"Copy and paste the Template.tmc from the OP into your text editor," Probably a stupid question but what is "OP"?

 

 

OP = Original Post

 

 

 

If you have questions or comments about what is presented please PM me.

 

I'd like to keep the thread from bulging from individual one to one conversations. If something needs further explanation or clarification, I will edit appropriate post.

 

 

 

Thanks


Edited by SGT Coyle

Night Ops in the Harrier

IYAOYAS


 
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...