Skip to content

Instantly share code, notes, and snippets.

@kippuga
Last active November 23, 2024 11:35
Show Gist options
  • Save kippuga/6207301cf9ff3b8aafafcdf3e958ff26 to your computer and use it in GitHub Desktop.
Save kippuga/6207301cf9ff3b8aafafcdf3e958ff26 to your computer and use it in GitHub Desktop.
Thrustmaster T.A.R.G.E.T configuration script for my TCA Officer Pack HOTAS. This is meant to serve as an example script or something to base your own script on.

To keep the script profile running after you close the editor, click on "OPTIONS" and make sure the "DO NOT STOP SCRIPT WHEN THE EDITOR EXITS" option is checked like so – https://imgur.com/UZNHfsc

include "target.tmh"
//program startup
int main()
{
if(Init(&EventHandle)) return 1; // declare the event handler, return on error
//add initialization code here
// Duration (in milliseconds) for PULSE (used for simulated keypresses – see line 60)
// and the delay function D().
// For some reason (the default) 25ms keypress was not registering consistently
// in Star Citizen. Increasing to 100ms helped a lot.
SetKBRate(100, 33);
// Let's map the side stick axes
MapAxis(&A320Copilot, JOYX, DX_X_AXIS);
MapAxis(&A320Copilot, JOYY, DX_Y_AXIS);
MapAxis(&A320Copilot, RUDDER, DX_ZROT_AXIS); // <--- Twist axis //
MapAxis(&A320Copilot, THR, DX_SLIDER_AXIS, AXIS_REVERSED, MAP_ABSOLUTE);
// Throttle Quadrant 1&2:
// My setup is primarily for Star Citizen so we are
// only mapping the right throttle stick
MapAxis(&TCAQuadrant12, QT_LEFT, 0);
MapAxis(&TCAQuadrant12, QT_LEFT, DX_XROT_AXIS, AXIS_REVERSED, MAP_ABSOLUTE); // <--- Optional: you can use this for mining //
MapAxis(&TCAQuadrant12, QT_RIGHT, DX_THROTTLE_AXIS, AXIS_REVERSED, MAP_ABSOLUTE);
SetJCurve(&TCAQuadrant12, QT_RIGHT, 54, 20); // <--- Fix throttle axis center //
// Buttons on the head of the side stick
MapKey(&A320Copilot, TS1, DX1);
MapKey(&A320Copilot, TS2, DX2);
MapKey(&A320Copilot, TS3, DX3);
MapKey(&A320Copilot, TS4, DX4);
// Buttons on the base of the side stick
MapKey(&A320Copilot, B5, DX5);
MapKey(&A320Copilot, B6, DX6);
MapKey(&A320Copilot, B7, DX7);
MapKey(&A320Copilot, B8, DX8);
MapKey(&A320Copilot, B9, DX9);
MapKey(&A320Copilot, B10, DX10);
MapKey(&A320Copilot, B11, DX11);
MapKey(&A320Copilot, B12, DX12);
MapKey(&A320Copilot, B13, DX13);
MapKey(&A320Copilot, B14, DX14);
MapKey(&A320Copilot, B15, DX15);
MapKey(&A320Copilot, B16, DX16);
// Hat switches (4 btns / 8 way)
MapKey(&A320Copilot, H1U, DX17);
MapKey(&A320Copilot, H1R, DX18);
MapKey(&A320Copilot, H1D, DX19);
MapKey(&A320Copilot, H1L, DX20);
// Buttons on the throttle quadrant
MapKey(&TCAQuadrant12, QT_BTN1, DX21);
MapKey(&TCAQuadrant12, QT_BTN2, DX22);
MapKey(&TCAQuadrant12, QT_BTN3, PULSE+DX23); // <--- ENG 1 Switch: ON position //
MapKeyR(&TCAQuadrant12, QT_BTN3, PULSE+DX24); // <--- ENG 1 Switch: OFF position //
MapKey(&TCAQuadrant12, QT_BTN4, PULSE+DX25); // <--- ENG 2 Switch: ON position //
MapKeyR(&TCAQuadrant12, QT_BTN4, PULSE+DX26); // <--- ENG 2 Switch: OFF position //
MapKey(&TCAQuadrant12, QT_BTN5, DX27);
MapKey(&TCAQuadrant12, QT_BTN6, DX28);
MapKey(&TCAQuadrant12, QT_BTN7, DX29);
MapKey(&TCAQuadrant12, QT_BTN8, DX30);
}
//event handler
int EventHandle(int type, alias o, int x)
{
DefaultMapping(&o, x);
//add event handling code here
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment