Previous Thread
Next Thread
Print Thread
Rate This Thread
Hop To
#3142735 - 11/23/10 12:26 PM Master Arm - Can this be done  
Joined: Mar 2006
Posts: 102
Vierzinger Offline
Member
Vierzinger  Offline
Member

Joined: Mar 2006
Posts: 102
Denmark
I want to create a Master Arm for IL-2. screwy

My idear is that ALL weapon release buttons are disabled until I press the Chinahat.
This will enable ALL weaponbuttons for 3 minutes. After 3 minutes the are disabled again.
As a feature it would be nice that the LED's on the throttle would blink several times when enabled and again when the Master Arm fuction are disabled.


I am in deep, since I have a very limit experiance with real code.

As I see it I need to make a counter or some kind of clock that counts up. It will start with a value of 1 sec and add 1 second each run. It will loop the code until it will get the desired result.

pseudo code
Definitions
X=Time
Z=Function_Stop
Fuction_Stop = 180 (sek)


X+1== Z
IF Z NOT = Fuction_Stop Rerun code


I think I need help from people with some real coding skill biggrin


Will we EVER get a real Rainbow Six game again. One for the real Tactic fans? A WWII sim with a dynamic campagn. Games with deept?
Inline advert (2nd and 3rd post)

#3142784 - 11/23/10 01:57 PM Re: Master Arm - Can this be done [Re: Vierzinger]  
Joined: Oct 2010
Posts: 83
Nicu Offline
Junior Member
Nicu  Offline
Junior Member

Joined: Oct 2010
Posts: 83
Code:
include "target.tmh"

int main()
{
	if(Init(&EventHandle)) return 1;
	MapKey(&Throttle, CHF, EXEC("WeaponsEnable(); DeferCall(180000, &WeaponsDisable, enablecount);")); // on CHF, enable weapons, then defer WeaponsDisable call after 180000ms (180s)
}

int enablecount;
int WeaponsEnable()
{
	enablecount = enablecount + 1;	
	MapKey(&Joystick, TG1, PULSE+DX1); // map TG1 to pulse DX1 
	MapKey(&Joystick, TG2, PULSE+DX2); // map TG2 to pulse DX2
//	...
}

int WeaponsDisable(int p)
{
	if(p != enablecount) return 0; // take in account only the latest WeaponsEnable press
	MapKey(&Joystick, TG1, 0); // disable TG1
	MapKey(&Joystick, TG1, 0); // disable TG2
//	...
}


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



For the 180s delay I used DeferCall, which calls a function after a delay (in milliseconds).
You just need to fill up the WeaponsEnable() and WeaponsDisable() functions with your weapons mappings.

#3142797 - 11/23/10 02:11 PM Re: Master Arm - Can this be done [Re: Vierzinger]  
Joined: Oct 2010
Posts: 83
Nicu Offline
Junior Member
Nicu  Offline
Junior Member

Joined: Oct 2010
Posts: 83
Another solution, which uses CHAIN instead of DeferCall:

Code:
include "target.tmh"

int main()
{
	if(Init(&EventHandle)) return 1; // declare the event handler, return on error
	MapKey(&Throttle, CHF, CHAIN(EXEC("WeaponsEnable();"), D(180000), EXEC("WeaponsDisable();")));
}

int enablecount;
int WeaponsEnable()
{
	enablecount = enablecount + 1;
	MapKey(&Joystick, TG1, PULSE+DX1);
	MapKey(&Joystick, TG2, PULSE+DX2);
//	...
}

int WeaponsDisable()
{
	enablecount = enablecount - 1;
	if(enablecount) return 0;
	MapKey(&Joystick, TG1, 0);
	MapKey(&Joystick, TG2, 0);
//	...
}


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

#3142865 - 11/23/10 03:15 PM Re: Master Arm - Can this be done [Re: Vierzinger]  
Joined: Mar 2006
Posts: 102
Vierzinger Offline
Member
Vierzinger  Offline
Member

Joined: Mar 2006
Posts: 102
Denmark
God damm, you are fast!

May I ask whats the pros/cons of the different approaches?


Will we EVER get a real Rainbow Six game again. One for the real Tactic fans? A WWII sim with a dynamic campagn. Games with deept?
#3142882 - 11/23/10 03:42 PM Re: Master Arm - Can this be done [Re: Vierzinger]  
Joined: Oct 2010
Posts: 83
Nicu Offline
Junior Member
Nicu  Offline
Junior Member

Joined: Oct 2010
Posts: 83
Both works the same, but the second method is more basic (CHAIN - TARGET manual page 22 - is more common than DeferCall - manual page 38).
Normally, DeferCall should be used when no simpler solution can be found.
So I recommend using the CHAIN method.

#3142901 - 11/23/10 04:07 PM Re: Master Arm - Can this be done [Re: Vierzinger]  
Joined: Apr 2002
Posts: 17,733
Joe Offline
Veteran
Joe  Offline
Veteran

Joined: Apr 2002
Posts: 17,733
Bridgewater, NJ
As to the LED issue, LEDs can't yet be programmed via code. This feature has been promised at a later date, so that part will have to wait.

#3143195 - 11/23/10 10:11 PM Re: Master Arm - Can this be done [Re: Joe]  
Joined: Mar 2006
Posts: 102
Vierzinger Offline
Member
Vierzinger  Offline
Member

Joined: Mar 2006
Posts: 102
Denmark
Originally Posted By: Joe
As to the LED issue, LEDs can't yet be programmed via code. This feature has been promised at a later date, so that part will have to wait.


Damm. I thought we got a limit LED control with this issue.


Will we EVER get a real Rainbow Six game again. One for the real Tactic fans? A WWII sim with a dynamic campagn. Games with deept?
#3143281 - 11/24/10 01:20 AM Re: Master Arm - Can this be done [Re: Vierzinger]  
Joined: Mar 2006
Posts: 102
Vierzinger Offline
Member
Vierzinger  Offline
Member

Joined: Mar 2006
Posts: 102
Denmark
@NICU
When I try to integrate either scripts (CHAIN or DEFER) the code into my existing script I this error:

WARNING: you can declare compound key statements (SEQ, CHAIN, EXEC, TEMPO, AXIS) only inside main() call, and not during an event.

and the DX buttons in the code stops working

I must be doing something wrong.....

The code integration look like this and your code are marked with bold:
Quote:

include "target.tmh" //here we link this file to the file that contains the default Thrustmaster function code
include "IL2_V4_8.ttm"

int main()
{
if(Init(&EventHandle)) return 1; // declare the event handler, return on error
//script and function functions go here and before the
MapKey(&Throttle, CHF, EXEC("WeaponsEnable(); DeferCall(15000, &WeaponsDisable, enablecount);")); // on CHF, enable weapons, then defer WeaponsDisable call after 180000ms (180s)
SetShiftButton(&HCougar, S3, &Throttle, BSB, BSF); // toggle for I/O and U/M/D buttons.
}

int enablecount;
int WeaponsEnable()
{
enablecount = enablecount + 1;
MapKeyUMD(&HCougar, S4, DX4, DX3, USB[0x05]);
MapKey(&Throttle, CHB, PULSE+L_SHIFT+USB[0x18]);
}
int WeaponsDisable(int p)
{
if(p != enablecount) return 0; // take in account only the latest WeaponsEnable press
MapKeyUMD(&HCougar, S4, USB[0x05], USB[0x05], USB[0x05]);
MapKey(&Throttle, CHB, 0);


// -----------------------------------------------------------------------------------------------------------------------------------------
// MAP AXIS
// -----------------------------------------------------------------------------------------------------------------------------------------
MapAxis(&HCougar, JOYX, DX_X_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
MapAxis(&HCougar, JOYY, DX_Y_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
MapAxis(&HCougar, RUDDER, DX_ZROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
// MapAxis(&HCougar, RDR_X, DX_XROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE); // Rudder pedal wheel breaks
// MapAxis(&HCougar, RDR_Y, DX_YROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE); // Rudder pedal wheel breaks
MapAxis(&Throttle, THR_LEFT, DX_THROTTLE_AXIS); // Throttle engine 1
MapAxis(&Throttle, THR_RIGHT, DX_Z_AXIS); // Throttle engine 2
MapAxis(&Throttle, THR_FC, DX_SLIDER_AXIS, AXIS_NORMAL); // Friction slider on throttle base
// MapAxis(&Throttle, SCX, DX_XROT_AXIS, AXIS_NORMAL, MAP_RELATIVE); // Mini joystick x-axis to DX axis
// MapAxis(&Throttle, SCY, DX_YROT_AXIS, AXIS_NORMAL, MAP_RELATIVE); // Mini joystick x-axis to DX axis
MapAxis(&Throttle, SCX, MOUSE_X_AXIS, AXIS_NORMAL, MAP_RELATIVE); // Mini joystick x-axis to mouse
MapAxis(&Throttle, SCY, MOUSE_Y_AXIS, AXIS_NORMAL, MAP_RELATIVE); // Mini joystick x-axis to mouse
SetSCurve(&Throttle, SCX, 0, 10, 0, 0, -20); // Mouse curve sensitivity
SetSCurve(&Throttle, SCY, 0, 10, 0, 0, -20); // Mouse curve sensitivity
MapKeyIO(&Throttle, SC, MOUSE_LEFT, MOUSE_RIGHT);
// -----------------------------------------------------------------------------------------------------------------------------------------
// >>>JOYSTICK BUTTONS<<<
// -----------------------------------------------------------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------------------------------------------------------
// DX button Allocation
// -----------------------------------------------------------------------------------------------------------------------------------------
MapKeyIOUMD(&HCougar, S2,
FRAPS_ScrShot, //Boat bay Back & S3 In
Map, //Boat bay Back & S3 Out
Map, //Boat bay Middle & S3 In
Map, //Boat bay Front & S3 Out
Eject, //Boat bay Front & S3 In
Map); //Boat bay Middle & S3 Out

MapKey(&HCougar, TG1, DX1); //DX1 = Weapon 1 = Machineguns
MapKey(&HCougar, TG2, DX11); //DX11 = Weapon 1&2 = MG+Cannons
MapKey(&HCougar, S1, DX3);


// -----------------------------------------------------------------------------------------------------------------------------------------
// Hat 1: TRIM SWITCH
// -----------------------------------------------------------------------------------------------------------------------------------------
// HAT 1 is Trim.
MapKeyIO(&HCougar, H1U, Elevator_Mid, Elevator_Negative);
MapKeyIO(&HCougar, H1D, Elevator_Mid, Elevator_Positive);
MapKeyIO(&HCougar, H1L, Rudder_Neutral, Rudder_Left);
MapKeyIO(&HCougar, H1R, Rudder_Neutral, Rudder_Right);
// -----------------------------------------------------------------------------------------------------------------------------------------
// Hat 2: TMS: TARGET MANAGEMENT SWITCH
// -----------------------------------------------------------------------------------------------------------------------------------------
// HAT 2 is Views
MapKeyIO(&HCougar, H2U, TrackIR_Reset, FOV_70_Norm);
MapKeyIO(&HCougar, H2D, TrackIR_Toggle, GunSightToggle);
MapKeyIO(&HCougar, H2L, CockView, FOV_30_Close);
MapKeyIO(&HCougar, H2R, CockpitNxtView, FOV_90_Far);
// -----------------------------------------------------------------------------------------------------------------------------------------
// Hat 3: DMS: DATA MANAGEMENTS SWITCH
// -----------------------------------------------------------------------------------------------------------------------------------------
// rem GunSightToggle
MapKeyIOUMD(&HCougar, H3U ,// //....H3U
LevelStabaliser, // /In....LevelStabaliser=z
Mirror_Togg, // /Out....Mirror_Togg=i
LevelStabaliser, // /In... LevelStabaliser=z
LevelStabaliser, // /Out....LevelStabaliser=z
Sight_Elev_Plus, // /In.... Sight_Velocity_Decrease=L_CTL+c
Sight_Velocity_Decrease);

MapKeyIOUMD(&HCougar, H3D,
Gunpods_Toggle, // /I Gunpods_Toggle=u
Dim_Cockpit, // /O Dim_Cockpit=LCTL d
Drop_Tanks, // /I Drop_Tanks=L_SHIFT+u
Drop_Tanks, // /O Drop_Tanks=L_SHIFT+u
Sight_Elev_Minus, // /I Sight_Elev_Minus=c
Sight_Velocity_Increase); // /O Sight_Velocity_Increase=L_CTL+e

MapKeyIOUMD(&HCougar, H3R,
Sight_Adjust_Right, // /In Sight_Adjust_Right=d
Sight_Adjust_Right, // /Out Sight_Adjust_Right=d
Autopilot, // /In Autopilot=L_CTL+z
Smoke_Togg, // /Out Lights_Cockpit=l
Sight_Alt_Increase, // /In Sight_Alt_Increaset=L_SHIFT+e
Sight_Alt_Increase); // /Out Sight_Alt_Increaset=L_SHIFT+e

MapKeyIOUMD(&HCougar,H3L,
Sight_Adjust_Left, // /In Sight_Adjust_Left=
Sight_Adjust_Left,
Autopilot_Lvl,
Smoke_Togg,
Sight_Alt_Decrease,
Sight_Alt_Decrease);

// -----------------------------------------------------------------------------------------------------------------------------------------
// Hat 4: CMS: COUNTERMEASURES MANAGEMENT SWITCH
// -----------------------------------------------------------------------------------------------------------------------------------------
// HAT 4 is Flaps, breakes and cowler
// MapKey(&Throttle, H4P, 0);
MapKey(&HCougar, H4U, Flaps_Down); //Flaps No
MapKey(&HCougar, H4D, Flaps_Up); //Flaps Up
MapKey(&HCougar, H4R, VAC_Arm); //Arm the VAC utillity
MapKey(&HCougar, H4L, Radiator); //Control radiator
// Rem Note: If you own a Logitech keybord be sure the keypad is set in NUMPAD MODE or VAC will not work!
// #########################################################################################################################################
// #########################################################################################################################################

// *****************************************************************************************************************************************
// >>>THROTTLE STICKS BUTTONS<<<
// *****************************************************************************************************************************************
MapKey(&Throttle, LTB, WEP_Boost); //
// -----------------------------------------------------------------------------------------------------------------------------------------
// PINKY SWITCH
// -----------------------------------------------------------------------------------------------------------------------------------------
MapKey(&Throttle, PSF, Canopy); //
MapKeyR(&Throttle, PSF, Canopy);
//MapKey(&Throttle, PSM, 0); //
MapKey(&Throttle, PSB, SeatPositions_Togg); //
MapKeyR(&Throttle, PSB, SeatPositions_Togg);
// -----------------------------------------------------------------------------------------------------------------------------------------
// COOLIE SWITCH
// -----------------------------------------------------------------------------------------------------------------------------------------
//Coolie Switch Left
MapKeyUMD(&Throttle, CSL,
Aileron_Left,
Aileron_Left,
Gear_Tailwheellock);
//Coolie Switch Right
MapKeyUMD(&Throttle, CSR,
Aileron_Right,
Aileron_Right,
Lights_Landing);
//Coolie Switch Up
MapKeyUMD(&Throttle, CSU,
Pitch_Increase,
Supercharge_Inc,
Mixture_Increase);
//Coolie Switch Down
MapKeyUMD(&Throttle, CSD,
Pitch_Decrease,
Supercharge_Dec,
Mixture_Decrease);
// -----------------------------------------------------------------------------------------------------------------------------------------
// Mic SWITCH
// -----------------------------------------------------------------------------------------------------------------------------------------
//MapKey(&Throttle, MSP, 0); //Pressing button
MapKey(&Throttle, MSU, TeamSpeak_Whisper2); //
MapKey(&Throttle, MSD, TeamSpeak_Whisper1); //
MapKey(&Throttle, MSR, TeamSpeake_Tast); //
MapKey(&Throttle, MSL, TeamSpeake_Tast); //
// -----------------------------------------------------------------------------------------------------------------------------------------
// SPEEDBREAKE - (3 steps(Back(spring to center)/Center/Front)
// -----------------------------------------------------------------------------------------------------------------------------------------
MapKeyIO(&Throttle, SPDF,
AirBrake_Toggle,
AirBrake_Toggle);

// MapKey(&Throttle, SPDFM, 0); // Generates no keypress

MapKeyIO(&Throttle, SPDB,
Chokes,
Brake_Gear);
// -----------------------------------------------------------------------------------------------------------------------------------------
// CHINA HAT (color red. Back and front spring to center).
// -----------------------------------------------------------------------------------------------------------------------------------------
MapKey(&Throttle, CHF, Gunpods_Toggle);
//MapKeyIO(&Throttle, CHM, 0);
MapKey(&Throttle, CHB, Drop_Tanks);

// -----------------------------------------------------------------------------------------------------------------------------------------
// CONTROL PANEL
// -----------------------------------------------------------------------------------------------------------------------------------------
// Engine Fuel Flow Left (2 positions (no spring))
// Engine1Start
MapKey(&Throttle, EFLNORM, CHAIN(LOCK+PULSE+L_CTL+'8', D(), PULSE+L_SHIFT+'1',D(), PULSE+L_SHIFT+'i',D(), PULSE+L_CTL+'9', D(), LOCK));
// Engine1_Start
MapKey(&Throttle, EFLOVER, CHAIN(LOCK+PULSE+L_CTL+'8', D(), PULSE+L_SHIFT+'1',D(), PULSE+L_SHIFT+'i',D(), PULSE+L_CTL+'9', D(), LOCK));


//Engine Fuel Flow Right (2positions (no spring))
// Engine2_Start
MapKey(&Throttle, EFRNORM, CHAIN(LOCK+PULSE+L_CTL+'8', D(), PULSE+L_SHIFT+'2',D(), PULSE+L_SHIFT+'i',D(), PULSE+L_CTL+'9', D(), LOCK));
// Engine2_Start
MapKey(&Throttle, EFROVER, CHAIN(LOCK+PULSE+L_CTL+'8', D(), PULSE+L_SHIFT+'2',D(), PULSE+L_SHIFT+'i',D(), PULSE+L_CTL+'9', D(), LOCK));


// Engine Operate Left (3(Top-spring back to center and button))
MapKey(&Throttle, EOLIGN, CHAIN(LOCK+PULSE+L_CTL+'8', D(), PULSE+L_SHIFT+'1',D(), EngineExtinguisher,D(), PULSE+L_CTL+'9', D(), LOCK));

//Fireextinguisher_Engine_1
//MapKey(&Throttle, EOLNORM, 0);
MapKey(&Throttle, EOLMOTOR, CHAIN(LOCK+PULSE+L_CTL+'8', D(), PULSE+L_SHIFT+'1',D(), EngineFeather,D(), PULSE+L_CTL+'9', D(), LOCK)); //Feather

// Engine Operate Right (3(Top-spring back to center and button))
MapKey(&Throttle, EORIGN, CHAIN(LOCK+PULSE+L_CTL+'8', D(), PULSE+L_SHIFT+'2',D(), EngineExtinguisher,D(), PULSE+L_CTL+'9', D(), LOCK));
//MapKey(&Throttle, EORNORM, 0);
MapKey(&Throttle, EORMOTOR, CHAIN(LOCK+PULSE+L_CTL+'8', D(), PULSE+L_SHIFT+'2',D(), EngineFeather,D(), PULSE+L_CTL+'9', D(), LOCK)); //Feather


//*************************************Slider0 controlling Teamspeake volume*******************************************************************
KeyAxis(&Throttle,THR_FC, 0, AXMAP1(20, PULSE+TeamSpeake_Volume_Down, PULSE+TeamSpeake_Volume_Up));
//*********************************************************************************************************************************************

// Landing Gear Horn Silence Button (L/G)
MapKey(&Throttle, LDGH, TEMPO(Gear_Toggle, Landing_Hook));

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

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

//Radar Altimimeter (2(no spring))
MapKey(&Throttle, RDRNRM, Lights_Cockpit);
MapKey(&Throttle, RDRDIS, Lights_Cockpit);


//EAC on/off(2(no spring))
MapKeyR(&Throttle, EACON, Lights_NAV);
MapKeyR(&Throttle, EACOFF, Lights_NAV);
}

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




Macro file (IL2_V4_8.ttm):
Quote:

// ------------------------------------------------------------ IL-2 T.A.R.G.E.T Macros File -------------------------------------------
// -------------------------------------------------------------------------------------------------------------------
// Cockpit Controls
// -------------------------------------------------------------------------------------------------------------------
define AirBrake_Toggle PULSE+CHAIN(LOCK+L_SHIFT+USB[0x09],LOCK) // <{LSHF f}>
define Flaps_Up PULSE+USB[0x09] // Flaps up = f
define Flaps_Down PULSE+USB[0x19] // Flaps down = v
define Canopy PULSE+USB[0x11] // Canopy = n
define SeatPositions_Togg PULSE+USB[0x1C] // SeatPositions_Togg = y
// Cougar code: define Canopy_IncreaseVisability = Canopy DLY(2000) SeatPositions
// Cougar code: define Canopy_LowerVisability = SeatPositions DLY(2000) Canopy
define Dim_Cockpit PULSE+L_CTL+USB[0x07] //Dim_cockpit =<{LCTL d}>
define Lights_Cockpit PULSE+CHAIN(LOCK+USB[0x0F],LOCK) // Lights_Cockpit = l
define Lights_NAV PULSE+CHAIN(LOCK+R_SHIFT+USB[0x0F],LOCK) // Lights_NAV = <{RSHF l}>
define Mirror_Togg PULSE+USB[0x0C] // Mirror_togg = i
define Autopilot PULSE+CHAIN(LOCK+L_CTL+USB[0x1D],LOCK) // Autopilot = <{LCTL z}>
define Autopilot_Lvl PULSE+L_SHIFT+USB[0x1D] // Autopilot_lvl = <{LSHF z}>
define LevelStabaliser PULSE+USB[0x1D] // LevelStabaliser = z
define Eject L_ALT+USB[0x14] // Eject = {LALT q} //USB[0x14]
//define EjectUSB = <KD (LALT) KD (q) KU (q) KU (LALT)>
// ------------------------------------------------------------------------------------------------------------------
// Gunsight/Bombsight Controls
// -------------------------------------------------------------------------------------------------------------------
define GunSightToggle DX14
define Sight_Elev_Plus USB[0x08] // /H e
define Sight_Elev_Minus USB[0x05] // c
define Sight_Auto USB[0x1A] //w
define Sight_Adjust_Right USB[0x07] // d
define Sight_Adjust_Left USB[0x04] // a
define Sight_Alt_Increase CHAIN(LOCK+L_SHIFT+USB[0x08], LOCK) //Sight_Alt_Increaset = <L_SHF e}>
define Sight_Alt_Decrease CHAIN(LOCK+L_SHIFT+USB[0x07],LOCK) //Sight_Alt_Decrease = <{LSHF d}>
define Sight_Velocity_Increase CHAIN(LOCK+L_CTL+USB[0x08],LOCK) //Sight_Velocity_Increase = <{LCTL e}>
define Sight_Velocity_Decrease CHAIN(LOCK+L_CTL+USB[0x06],LOCK) //Sight_Velocity_Decrease = <{LCTL c}>
define Bombay_Doors_Mod_Power10 PULSE+USB[0x16] // Bombay_Doors_Mod_Power10= s
// ------------------------------------------------------------------------------------------------------------------------------------------------
// Engine Controls
// ------------------------------------------------------------------------------------------------------------------------------------------------
define Pitch_Auto_Toggle USB[0x30] //Pitch_Auto_Toggle = USB (D30 U30) //Pitch_Auto_Toggle ]

define Pitch_Increase CHAIN(LOCK+R_CTL+USB[0x2E])
define Pitch_Decrease R_CTL+USB[0x2D] // Pitch_Decrease = RCTL - // USB[]

define Mixture_Auto_100 USB[0x2F] // Mixture_auto_100 = [
define Mixture_Increase L_ALT+USB[0x2D] // ALT -
define Mixture_Decrease L_ALT+USB[0x2E] // ALT
define Supercharge_Inc USB[0x56] // KP minus
define Supercharge_Dec USB[0x57] // KP plus
define WEP_Boost PULSE+USB[0x1B] // x

define EngineExtinguisher PULSE+USB[0x4B] //define EngineExtinguisher = PGUP
define EngineFeather PULSE+USB[0x49] // EngineFeather = INS
define Engine_Start PULSE+L_SHIFT+USB[0x0c] //Engine_Start = <{LSHF i}>
define Radiator PULSE+L_CTL+USB[0x09] //Radiator = <{LCTL f}>


define Fireextinguisher_Engine_1 CHAIN(LOCK+EngineToggle_2, EngineToggle_3, EngineToggle_4, EngineExtinguisher, EngineToggle_2, EngineToggle_3, EngineToggle_4, LOCK);
define Fireextinguisher_Engine_2 CHAIN(LOCK+EngineToggle_1, EngineToggle_3, EngineToggle_4, EngineExtinguisher, EngineToggle_1, EngineToggle_3, EngineToggle_4, LOCK);
define Fireextinguisher_Engine_3 CHAIN(LOCK+EngineToggle_1, EngineToggle_2, EngineToggle_4, EngineExtinguisher, EngineToggle_1, EngineToggle_2, EngineToggle_4, LOCK);
define Fireextinguisher_Engine_4 CHAIN(LOCK+EngineToggle_1, EngineToggle_2, EngineToggle_3, EngineExtinguisher, EngineToggle_1, EngineToggle_2, EngineToggle_4, LOCK);

define EngineAll_On CHAIN(LOCK+PULSE+L_CTL+'9', LOCK)
define EngineAll_Off CHAIN(LOCK+PULSE+CTL+'8', LOCK)

define EngineToggle_1 CHAIN(LOCK+PULSE+L_SHIFT+USB[0x1E], LOCK) // Shift 1
define EngineToggle_2 CHAIN(LOCK+PULSE+L_SHIFT+USB[0x1F], LOCK) // Shift 2
define EngineToggle_3 CHAIN(LOCK+PULSE+L_SHIFT+USB[0x20], LOCK // Shift 3
define EngineToggle_4 CHAIN(LOCK+PULSE+L_SHIFT+USB[0x21], LOCK) // Shift 4

define Engine1_Start CHAIN(LOCK+EngineAll_Off, EngineToggle_1, Engine_Start, EngineAll_On, LOCK)

// -------------------------------------------------------------------------------------------------------------------
// Weapons
// -------------------------------------------------------------------------------------------------------------------
define Drop_Tanks CHAIN(LOCK+PULSE+L_SHIFT+USB[0x18], LOCK) //Drop_Tanks = <{LSHF u}>
define Gunpods_Toggle DX13 //Gunpods_Toggle = u
define Guns DX1
define Cannons DX2
define Guns_and_Cannons DX11
define Rockets DX3
define Bombs DX4
// -------------------------------------------------------------------------------------------------------------------
// Landing
// -------------------------------------------------------------------------------------------------------------------
define Landing_Hook PULSE+USB[0x0B] //h
define Gear_Toggle PULSE+USB[0x0A] //g
define Gear_Man_Up R_SHIFT+USB[0x0A] //Gear_Man_up = <{RSHF g}>

// define Gear_Man_upAll RPT(51) Gear_Man_up
define Gear_Man_Down L_CTL+USB[0x0A] //Gear_Man_Down = <{LCTL g}>
// define Gear_Man_DownAll RPT(51) Gear_Man_Down

define Gear_Tailwheellock PULSE+R_SHIFT+USB[0x05] // Gear_Tailwheellock = R_SHIFT+b
define Brake_Gear USB[0x05] // /H b
define Chokes PULSE+R_CTL+USB[0x05] // Chokes = R_CTL+b
define Aircraft_Undock R_SHIFT+USB[0x0B] // Aircraft_Undock = R_SHIFT+h
define Lights_Landing PULSE+R_CTL+USB[0x0F] // Lights_Landing = R_CTL+l
define Wingfold PULSE+L_CTL+USB[0x0B] // Wingfold = L_CTL+h
define Smoke_Togg PULSE+USB[0x17]
// -------------------------------------------------------------------------------------------------------------------
// Views Cockpit
// -------------------------------------------------------------------------------------------------------------------
define CockView PULSE+USB[0x3A] // F1
define CockpitShow PULSE+L_CTL+USB[0x3A] // CockpitShow = L_CTL+F1
define FOV_70_Norm PULSE+USB[0x4D] // END
define FOV_90_Far PULSE+USB[0x4E] // PGDN
define FOV_30_Close PULSE+USB[0X4C] // DEL
define CockpitNxtView PULSE+USB[0x3B]
define CockpitView0 L_ALT+USB[0X1E] // CockpitView0 = L_ALT+0
define CockpitView1 L_ALT+USB[0x1E] // CockpitView1 = L_ALT+1
define CockpitView2 L_ALT+USB[0x1F] // CockpitView2 = L_ALT+2
define CockpitView3 L_ALT+USB[0x20] // CockpitView3 = L_ALT+3
define CockpitView4 L_ALT+USB[0x21] // CockpitView4 = L_ALT+4
define CockpitView5 PULSE+USB[0x22] // 5
define CockpitView6 PULSE+USB[0x23] // 6
define CockpitView7 PULSE+USB[0x25] // 8
define CockpitView8 PULSE+USB[0x26} // 9
define CockpitView9 PULSE+USB[0x27] // 0
// -------------------------------------------------------------------------------------------------------------------
// Views
// -------------------------------------------------------------------------------------------------------------------
define OutsideViewFollow USB[0x41] // F8
define ViewEnemyGround USB[0x40] // F7
define CockpitUp USB[0x3F] //'F6'
define PadlockViewGround USB[0x3E] //'F5'
define PadlockView USB[0x3D] //F4
define OutsideViewFly USB[0x3C] //F3
define OutsideView USB[0x3B] //F2
define NextViewFollow CHAIN(LOCK+R_SHIFT+USB[0x41]LOCK); //NextViewFollow = R_SHIFT+F8
define ViewFriendGround CHAIN(LOCK+L_SHIFT+USB[0x40]LOCK); //ViewFriendGround = L_SHIFT+F7


// -------------------------------------------------------------------------------------------------------------------
// Trim controls
// -------------------------------------------------------------------------------------------------------------------
define Rudder_Left PULSE+DX24
define Rudder_Neutral PULSE+L_SHIFT+USB[0x1B] // L_SHIFT+x
define Rudder_Right PULSE+DX25
define Aileron_Left DX23
define Aileron_Neutral PULSE+R_SHIFT+USB[0x50] // R_SHIFT+LARROW
define Aileron_Right DX22
define Elevator_Positive DX20
define Elevator_Mid PULSE+R_SHIFT+USB[0x52] // R_SHIFT+UARROW
define Elevator_Negative DX21

// -------------------------------------------------------------------------------------------------------------------
// Unsorted
// -------------------------------------------------------------------------------------------------------------------
// AIRCRAFT_STABILIZER = n
// define NextViewEnemyFollow
define NextViewEnemy L_SHIFT+F2
// define PadlockViewPrev*U*
// PadlockViewFriendGround
define PadlockViewFriend L_SHIFT+F4
define NextView L_SHIFT+F2
define CockpitAim PULSE+L_SHIFT+'F1'LOCK // L_SHIFT+F1
// [HotKey orders]
// Escape=deactivate
define Chat ENT //USB[]
define Comms USB[0x2B] //TAB
// -------------------------------------------------------------------------------------------------------------------
// Game control
// -------------------------------------------------------------------------------------------------------------------
//define Mute*U*
//define Mute_Radio*U*
//define Radio_Change_Channel*U*
//define TimeSpeedUp*U*
//define TimeSpeedDown*U*
//define Quote
//define timeSpeedNormal*U*
//define SaveTrack*U*
define Pause USB[0x48] //BRK
//define Timeskip*U*
//define OnlineRating*U*
//define OnlineRatingPage*U*
define Map PULSE+USB[0x10] //m
// -------------------------------------------------------------------------------------------------------------------
// External Applications
// -------------------------------------------------------------------------------------------------------------------
define VAC_Arm PULSE+F9
define VAC_Arm_USB PULSE+USB[0x42] //F9
define TrackIR_Precision PULSE+F10
define TrackIR_PrecisionUSB PULSE+USB[0x43] //F10
define TrackIR_Toggle PULSE+F11
define TrackIR_ToggleUSB PULSE+USB[0x44] //F11
define TrackIR_Reset PULSE+F12
define TrackIR_ResetUSB PULSE+USB[0x45] //F12
// - The TIR buttons have to be assigned in the TrackIR profile.
define FRAPS_ScrShot PULSE+USB[0x0D] //j
define FRAPS_Movie_Toogle PULSE+USB[0x0E] //k
// Thiese are for specialisted for Teamspeak and needs to be setup there.
define TeamSpeake_Tast USB[0x41] // /H F8
define TeamSpeak_Whisper1 USB[0x3E] // /H F5
define TeamSpeak_Whisper2 USB[0x3F] // /H F6
define TeamSpeak_Whisper3 USB[0x40] // /H F7
define TeamSpeak_Whisper4 USB[0x41] // /H F8
define TeamSpeake_Volume_Up L_SHIFT+USB[0x3F] // <{LSHF F6}>
define TeamSpeake_Volume_Down L_SHIFT+USB[0x3E] // <{LSHF F5}>
define TeamSpeake_Channel_cha_Nxt PULSE+L_CTL+USB[0x3F] // <{LCTL F6}>
define TeamSpeake_Channel_cha_Prv PULSE+L_CTL+USB[0x3E] // <{LCTL F5}>



Will we EVER get a real Rainbow Six game again. One for the real Tactic fans? A WWII sim with a dynamic campagn. Games with deept?
#3143418 - 11/24/10 09:00 AM Re: Master Arm - Can this be done [Re: Vierzinger]  
Joined: Oct 2010
Posts: 83
Nicu Offline
Junior Member
Nicu  Offline
Junior Member

Joined: Oct 2010
Posts: 83

#3143427 - 11/24/10 09:50 AM Re: Master Arm - Can this be done [Re: Vierzinger]  
Joined: Oct 2010
Posts: 83
Nicu Offline
Junior Member
Nicu  Offline
Junior Member

Joined: Oct 2010
Posts: 83
See the corrected script:

Code:

include "target.tmh" //here we link this file to the file that contains the default Thrustmaster function code
include "IL2_issue.tmh"

int main()
{
	if(Init(&EventHandle)) return 1; // declare the event handler, return on error
	MapKey(&Throttle, CHF, EXEC("WeaponsEnable(); DeferCall(15000, &WeaponsDisable, enablecount);")); // on CHF, enable weapons, then defer WeaponsDisable call after 180000ms (180s)
	SetShiftButton(&HCougar, S3, &Throttle, BSB, BSF); // toggle for I/O and U/M/D buttons.

// -----------------------------------------------------------------------------------------------------------------------------------------
// MAP AXIS
// -----------------------------------------------------------------------------------------------------------------------------------------
	MapAxis(&HCougar, JOYX, DX_X_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
	MapAxis(&HCougar, JOYY, DX_Y_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
	MapAxis(&HCougar, RUDDER, DX_ZROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
// MapAxis(&HCougar, RDR_X, DX_XROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE); // Rudder pedal wheel breaks
// MapAxis(&HCougar, RDR_Y, DX_YROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE); // Rudder pedal wheel breaks
	MapAxis(&Throttle, THR_LEFT, DX_THROTTLE_AXIS); // Throttle engine 1
	MapAxis(&Throttle, THR_RIGHT, DX_Z_AXIS); // Throttle engine 2
	MapAxis(&Throttle, THR_FC, DX_SLIDER_AXIS, AXIS_NORMAL); // Friction slider on throttle base
// MapAxis(&Throttle, SCX, DX_XROT_AXIS, AXIS_NORMAL, MAP_RELATIVE); // Mini joystick x-axis to DX axis
// MapAxis(&Throttle, SCY, DX_YROT_AXIS, AXIS_NORMAL, MAP_RELATIVE); // Mini joystick x-axis to DX axis
	MapAxis(&Throttle, SCX, MOUSE_X_AXIS, AXIS_NORMAL, MAP_RELATIVE); // Mini joystick x-axis to mouse
	MapAxis(&Throttle, SCY, MOUSE_Y_AXIS, AXIS_NORMAL, MAP_RELATIVE); // Mini joystick x-axis to mouse
	SetSCurve(&Throttle, SCX, 0, 10, 0, 0, -20); // Mouse curve sensitivity
	SetSCurve(&Throttle, SCY, 0, 10, 0, 0, -20); // Mouse curve sensitivity
	MapKeyIO(&Throttle, SC, MOUSE_LEFT, MOUSE_RIGHT);
// -----------------------------------------------------------------------------------------------------------------------------------------
// >>>JOYSTICK BUTTONS<<< 
// -----------------------------------------------------------------------------------------------------------------------------------------
// -----------------------------------------------------------------------------------------------------------------------------------------
// DX button Allocation 
// -----------------------------------------------------------------------------------------------------------------------------------------
	MapKeyIOUMD(&HCougar, S2, 
		FRAPS_ScrShot, //Boat bay Back & S3 In
		Map, //Boat bay Back & S3 Out
		Map, //Boat bay Middle & S3 In
		Map, //Boat bay Front & S3 Out
		Eject, //Boat bay Front & S3 In
		Map); //Boat bay Middle & S3 Out
		
	MapKey(&HCougar, TG1, DX1); //DX1 = Weapon 1 = Machineguns
	MapKey(&HCougar, TG2, DX11); //DX11 = Weapon 1&2 = MG+Cannons
	MapKey(&HCougar, S1, DX3);
	

// -----------------------------------------------------------------------------------------------------------------------------------------
// Hat 1: TRIM SWITCH 
// -----------------------------------------------------------------------------------------------------------------------------------------
// HAT 1 is Trim.
	MapKeyIO(&HCougar, H1U, Elevator_Mid, Elevator_Negative);
	MapKeyIO(&HCougar, H1D, Elevator_Mid, Elevator_Positive);
	MapKeyIO(&HCougar, H1L, Rudder_Neutral, Rudder_Left);
	MapKeyIO(&HCougar, H1R, Rudder_Neutral, Rudder_Right);
// -----------------------------------------------------------------------------------------------------------------------------------------
// Hat 2: TMS: TARGET MANAGEMENT SWITCH 
// -----------------------------------------------------------------------------------------------------------------------------------------
// HAT 2 is Views
	MapKeyIO(&HCougar, H2U, TrackIR_Reset, FOV_70_Norm);
	MapKeyIO(&HCougar, H2D, TrackIR_Toggle, GunSightToggle);
	MapKeyIO(&HCougar, H2L, CockView, FOV_30_Close); 
	MapKeyIO(&HCougar, H2R, CockpitNxtView, FOV_90_Far); 
// -----------------------------------------------------------------------------------------------------------------------------------------
// Hat 3: DMS: DATA MANAGEMENTS SWITCH
// -----------------------------------------------------------------------------------------------------------------------------------------
// rem GunSightToggle
	MapKeyIOUMD(&HCougar, H3U ,// //....H3U
		LevelStabaliser, // /In....LevelStabaliser=z
		Mirror_Togg, // /Out....Mirror_Togg=i
		LevelStabaliser, // /In... LevelStabaliser=z
		LevelStabaliser, // /Out....LevelStabaliser=z
		Sight_Elev_Plus, // /In.... Sight_Velocity_Decrease=L_CTL+c
		Sight_Velocity_Decrease);

	MapKeyIOUMD(&HCougar, H3D, 
		Gunpods_Toggle, // /I Gunpods_Toggle=u
		Dim_Cockpit, // /O Dim_Cockpit=LCTL d
		Drop_Tanks, // /I Drop_Tanks=L_SHIFT+u
		Drop_Tanks, // /O Drop_Tanks=L_SHIFT+u
		Sight_Elev_Minus, // /I Sight_Elev_Minus=c
		Sight_Velocity_Increase); // /O Sight_Velocity_Increase=L_CTL+e
	
	MapKeyIOUMD(&HCougar, H3R, 
		Sight_Adjust_Right, // /In Sight_Adjust_Right=d
		Sight_Adjust_Right, // /Out Sight_Adjust_Right=d
		Autopilot, // /In Autopilot=L_CTL+z
		Smoke_Togg, // /Out Lights_Cockpit=l
		Sight_Alt_Increase, // /In Sight_Alt_Increaset=L_SHIFT+e
		Sight_Alt_Increase); // /Out Sight_Alt_Increaset=L_SHIFT+e
	
	MapKeyIOUMD(&HCougar,H3L, 
		Sight_Adjust_Left, // /In Sight_Adjust_Left=
		Sight_Adjust_Left, 
		Autopilot_Lvl, 
		Smoke_Togg, 
		Sight_Alt_Decrease, 
		Sight_Alt_Decrease);
		
// -----------------------------------------------------------------------------------------------------------------------------------------
// Hat 4: CMS: COUNTERMEASURES MANAGEMENT SWITCH
// -----------------------------------------------------------------------------------------------------------------------------------------
// HAT 4 is Flaps, breakes and cowler
// MapKey(&Throttle, H4P, 0);
	MapKey(&HCougar, H4U, Flaps_Down); //Flaps No
	MapKey(&HCougar, H4D, Flaps_Up); //Flaps Up
	MapKey(&HCougar, H4R, VAC_Arm); //Arm the VAC utillity
	MapKey(&HCougar, H4L, Radiator); //Control radiator
// Rem Note: If you own a Logitech keybord be sure the keypad is set in NUMPAD MODE or VAC will not work!
// #########################################################################################################################################
// #########################################################################################################################################

// *****************************************************************************************************************************************
// >>>THROTTLE STICKS BUTTONS<<<
// *****************************************************************************************************************************************
	MapKey(&Throttle, LTB, WEP_Boost); // 
// -----------------------------------------------------------------------------------------------------------------------------------------
// PINKY SWITCH
// -----------------------------------------------------------------------------------------------------------------------------------------
	MapKey(&Throttle, PSF, Canopy); // 
	MapKeyR(&Throttle, PSF, Canopy);
//MapKey(&Throttle, PSM, 0); // 
	MapKey(&Throttle, PSB, SeatPositions_Togg); // 
	MapKeyR(&Throttle, PSB, SeatPositions_Togg);
// -----------------------------------------------------------------------------------------------------------------------------------------
// COOLIE SWITCH 
// -----------------------------------------------------------------------------------------------------------------------------------------
//Coolie Switch Left
	MapKeyUMD(&Throttle, CSL, 
		Aileron_Left, 
		Aileron_Left, 
		Gear_Tailwheellock);
//Coolie Switch Right
	MapKeyUMD(&Throttle, CSR, 
		Aileron_Right, 
		Aileron_Right, 
		Lights_Landing);
//Coolie Switch Up
	MapKeyUMD(&Throttle, CSU, 
		Pitch_Increase, 
		Supercharge_Inc,
		Mixture_Increase);
//Coolie Switch Down
	MapKeyUMD(&Throttle, CSD, 
		Pitch_Decrease, 
		Supercharge_Dec,
		Mixture_Decrease);
// -----------------------------------------------------------------------------------------------------------------------------------------
// Mic SWITCH
// -----------------------------------------------------------------------------------------------------------------------------------------
//MapKey(&Throttle, MSP, 0); //Pressing button
	MapKey(&Throttle, MSU, TeamSpeak_Whisper2); //
	MapKey(&Throttle, MSD, TeamSpeak_Whisper1); //
	MapKey(&Throttle, MSR, TeamSpeake_Tast); //
	MapKey(&Throttle, MSL, TeamSpeake_Tast); //
// -----------------------------------------------------------------------------------------------------------------------------------------
// SPEEDBREAKE - (3 steps(Back(spring to center)/Center/Front)
// -----------------------------------------------------------------------------------------------------------------------------------------
	MapKeyIO(&Throttle, SPDF, 
		AirBrake_Toggle, 
		AirBrake_Toggle);

// MapKey(&Throttle, SPDFM, 0); // Generates no keypress 

	MapKeyIO(&Throttle, SPDB, 
		Chokes, 
		Brake_Gear);
// -----------------------------------------------------------------------------------------------------------------------------------------
// CHINA HAT (color red. Back and front spring to center).
// -----------------------------------------------------------------------------------------------------------------------------------------
//	MapKey(&Throttle, CHF, Gunpods_Toggle);
//MapKeyIO(&Throttle, CHM, 0);
	MapKey(&Throttle, CHB, Drop_Tanks);

// -----------------------------------------------------------------------------------------------------------------------------------------
// CONTROL PANEL
// -----------------------------------------------------------------------------------------------------------------------------------------
// Engine Fuel Flow Left (2 positions (no spring))
// Engine1Start
	MapKey(&Throttle, EFLNORM, CHAIN(LOCK+PULSE+L_CTL+'8', D(), PULSE+L_SHIFT+'1',D(), PULSE+L_SHIFT+'i',D(), PULSE+L_CTL+'9', D(), LOCK));
// Engine1_Start
	MapKey(&Throttle, EFLOVER, CHAIN(LOCK+PULSE+L_CTL+'8', D(), PULSE+L_SHIFT+'1',D(), PULSE+L_SHIFT+'i',D(), PULSE+L_CTL+'9', D(), LOCK));


//Engine Fuel Flow Right (2positions (no spring))
// Engine2_Start
	MapKey(&Throttle, EFRNORM, CHAIN(LOCK+PULSE+L_CTL+'8', D(), PULSE+L_SHIFT+'2',D(), PULSE+L_SHIFT+'i',D(), PULSE+L_CTL+'9', D(), LOCK)); 
// Engine2_Start
	MapKey(&Throttle, EFROVER, CHAIN(LOCK+PULSE+L_CTL+'8', D(), PULSE+L_SHIFT+'2',D(), PULSE+L_SHIFT+'i',D(), PULSE+L_CTL+'9', D(), LOCK));


// Engine Operate Left (3(Top-spring back to center and button))
	MapKey(&Throttle, EOLIGN, CHAIN(LOCK+PULSE+L_CTL+'8', D(), PULSE+L_SHIFT+'1',D(), EngineExtinguisher,D(), PULSE+L_CTL+'9', D(), LOCK)); 

//Fireextinguisher_Engine_1
//MapKey(&Throttle, EOLNORM, 0);
	MapKey(&Throttle, EOLMOTOR, CHAIN(LOCK+PULSE+L_CTL+'8', D(), PULSE+L_SHIFT+'1',D(), EngineFeather,D(), PULSE+L_CTL+'9', D(), LOCK)); //Feather

// Engine Operate Right (3(Top-spring back to center and button))
	MapKey(&Throttle, EORIGN, CHAIN(LOCK+PULSE+L_CTL+'8', D(), PULSE+L_SHIFT+'2',D(), EngineExtinguisher,D(), PULSE+L_CTL+'9', D(), LOCK));
//MapKey(&Throttle, EORNORM, 0);
	MapKey(&Throttle, EORMOTOR, CHAIN(LOCK+PULSE+L_CTL+'8', D(), PULSE+L_SHIFT+'2',D(), EngineFeather,D(), PULSE+L_CTL+'9', D(), LOCK)); //Feather


//*************************************Slider0 controlling Teamspeake volume*******************************************************************
	KeyAxis(&Throttle,THR_FC, 0, AXMAP1(20, PULSE+TeamSpeake_Volume_Down, PULSE+TeamSpeake_Volume_Up));
//*********************************************************************************************************************************************

// Landing Gear Horn Silence Button (L/G)
	MapKey(&Throttle, LDGH, TEMPO(Gear_Toggle, Landing_Hook));

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

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

//Radar Altimimeter (2(no spring))
	MapKey(&Throttle, RDRNRM, Lights_Cockpit);
	MapKey(&Throttle, RDRDIS, Lights_Cockpit);


//EAC on/off(2(no spring))
	MapKeyR(&Throttle, EACON, Lights_NAV);
	MapKeyR(&Throttle, EACOFF, Lights_NAV);
}

int enablecount;
int WeaponsEnable()
{
	enablecount = enablecount + 1; 
	MapKeyUMD(&HCougar, S4, DX4, DX3, USB[0x05]);
	MapKey(&Throttle, CHB, PULSE+L_SHIFT+USB[0x18]);
}

int WeaponsDisable(int p)
{
	if(p != enablecount) return 0; // take in account only the latest WeaponsEnable press
	MapKeyUMD(&HCougar, S4, USB[0x05], USB[0x05], USB[0x05]);
	MapKey(&Throttle, CHB, 0);
}

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







#3143453 - 11/24/10 12:15 PM Re: Master Arm - Can this be done [Re: Vierzinger]  
Joined: Mar 2006
Posts: 102
Vierzinger Offline
Member
Vierzinger  Offline
Member

Joined: Mar 2006
Posts: 102
Denmark
Sorry. It was very late, so I seem to have posted I the wrong thread.
The FLAP project are a bit more long term.


The reason for my 'love' for "CHAIN(LOCK+" are a lack of information about the CTL/ALT/SHIFT are handled. I have treated CTL/ALT/SHIFT as I would when I did Cougar script (FOXY). In a Cougar script a lack of LOCK could result in an keycommand disturbing one another and resulting in catastrofic behaviour. Am I paranoid?

As you might are to see from my code I want to use the S4 as a wheelbreak when the weapons aren't active.
(This idear was spawned when I as flight lead in a campaign mission wanted to use the wheenbreak and forgot to check the UMD button. The result was that I dropped the bombs on the runway and destroyed the whole flight. Ruining my Sqd mates evening. We did not have the option to respawn banghead In retrospect it would be funny, if it was not that those planes will be gone forever from the rest of our campaign. Did I mention that my Sqd mates where not thrilled Cuss)


1 - Noob question. What defines the start and end of a main ?

2 and 3 - What if I want have additional keypresses to depend on the same functionaliy. Like having wheelbreak when the weapons are not enabled ?
That was why I added the USB (b) to the WeaponsDisable()
I was also thinking on adding a statement that flashes the cockpit instrumentation for start and end of the timeperiode. Something that are not hard, but I wonder how it will affect the script.

4 - Will this change if I use the code made with the DEFER ?

Originally Posted By: Nicu
The manual (page 36) states that SEQ, CHAIN, EXEC, TEMPO, AXIS declarations can be made only in main() function.
In your case, all mappings are done in WeaponsDisable() function, which is hard to understand.
You need to:
1 - move all code from WeaponsDisable() function in main()
2 - put in WeaponsEnable() only the mappings related to weapons trigger.
3 - put in WeaponsDisable() the same mappings like the ones in WeaponsEnable(), but with 0.
4 - be sure that no macros used in WeaponsEnable() contains CHAIN

For instance, if your WeaponsEnable() looks like this:
Code:
int WeaponsEnable()
{
  enablecount = enablecount + 1;
  MapKeyUMD(&Joystick, S4, DX4, DX3, Brake_Gear);
  MapKeyIO(&Throttle, CHB, Drop_Tanks, Drop_Tanks);
}


then the WeaponsDisable() should look like this:
Code:
int WeaponsDisable()
{
  enablecount = enablecount - 1;
  if(enablecount) return 0;
  MapKeyUMD(&Joystick, S4, 0, 0, 0);
  MapKeyIO(&Throttle, CHB, 0, 0);
}


I noticed that your .ttm file contains a lot of CHAINs which can be simplified:
For instance, for each define like:

define Drop_Tanks CHAIN(LOCK+PULSE+L_SHIFT+USB[0x18], LOCK)

you should remove the CHAIN and transform it in:

define Drop_Tanks PULSE+L_SHIFT+USB[0x18]

Last edited by Vierzinger; 11/24/10 12:23 PM. Reason: sqd mates reaction

Will we EVER get a real Rainbow Six game again. One for the real Tactic fans? A WWII sim with a dynamic campagn. Games with deept?
#3143477 - 11/24/10 12:55 PM Re: Master Arm - Can this be done [Re: Vierzinger]  
Joined: Oct 2010
Posts: 83
Nicu Offline
Junior Member
Nicu  Offline
Junior Member

Joined: Oct 2010
Posts: 83
In TARGET you do not need LOCK for the composed keys (like CTL+ALT+'a'). You need LOCK only if the CHAIN contains delays, like:

CHAIN(LOCK+PULSE+'a', D(1000), LOCK+PULSE+'b'); // the LOCK will protect the 1sec gap between keys

1 - The main() content is between the associated curly brackets.

Code:
int main()
{
  // here is inside main()
}
// here is outside main()


2,3 - you can have any commands you want, but take care of the CHAINs

4 - with DEFER it should work exactly the same


If you really need a CHAIN in an event (like WeaponsEnable), you need to create the CHAIN inside main() body, and then use it, like in the following example:

Code:
int main()
{
  if(Init(&EventHandle)) return 1;
  MapKey(&Throttle, CHF, EXEC("WeaponsEnable(); DeferCall(15000, &WeaponsDisable, enablecount);"));  

  myChain = CHAIN(LOCK+PULSE+'a', D(1000), LOCK+PULSE+'b'); // create the CHAIN inside main(), as required by TARGET rules
}

int myChain;
int enablecount ;
int WeaponsEnable()
{
  enablecount = enablecount + 1;
  MapKeyUMD(&Joystick, S4, DX4, DX3, myChain); // use the CHAIN created in main()
}

But this may be a little inconvenient, so first you may want to get rid of the CHAINs (if possible).

#3143674 - 11/24/10 05:34 PM Re: Master Arm - Can this be done [Re: Vierzinger]  
Joined: Mar 2006
Posts: 102
Vierzinger Offline
Member
Vierzinger  Offline
Member

Joined: Mar 2006
Posts: 102
Denmark
Thanks Nicu

It works.
I hope that I will be able to learn excatly what you how you done it.
It seems that there are some basic programming skils I will have to learn.

thumbsup


Will we EVER get a real Rainbow Six game again. One for the real Tactic fans? A WWII sim with a dynamic campagn. Games with deept?
#3144199 - 11/25/10 02:10 PM Re: Master Arm - Can this be done [Re: Vierzinger]  
Joined: Aug 2005
Posts: 73
Galwran Offline
Junior Member
Galwran  Offline
Junior Member

Joined: Aug 2005
Posts: 73
Turku, Finland, your six
Originally Posted By: Vierzinger
I want to create a Master Arm for IL-2. screwy

My idear is that ALL weapon release buttons are disabled until I press the Chinahat.


Why don't you use one of the toggle switches on the throttle? That way you could easily select ARM or SAFE.

#3145850 - 11/28/10 04:11 PM Re: Master Arm - Can this be done [Re: Galwran]  
Joined: Mar 2007
Posts: 1,298
Reschke Offline
Plankowner
Reschke  Offline
Plankowner
Member

Joined: Mar 2007
Posts: 1,298
Vestavia, AL
Originally Posted By: Galwran
Originally Posted By: Vierzinger
I want to create a Master Arm for IL-2. screwy

My idear is that ALL weapon release buttons are disabled until I press the Chinahat.


Why don't you use one of the toggle switches on the throttle? That way you could easily select ARM or SAFE.



+1....that is what I would try to do first without cluttering up my mind or having to have a reference chart of what combination does what.


Star Citizen Referal Code
STAR-MP6J-VFH7

i7-13700K @ 3.40GHz
32GB RAM
GeForce 3060RTX
MSI MAG Z790 Tomahawk
lots of SSD's and a good old fashioned 1TB HDD
Samsung G9 Odyssey 49"
TrackIR 5 with Track Clip Pro
Windows 11 64bit
Warthog #1397...compliments of SimHQ

Moderated by  RacerGT 

Quick Search
Recent Articles
Support SimHQ

If you shop on Amazon use this Amazon link to support SimHQ
.
Social


Recent Topics
Carnival Cruise Ship Fire....... Again
by F4UDash4. 03/26/24 05:58 PM
Baltimore Bridge Collapse
by F4UDash4. 03/26/24 05:51 PM
The Oldest WWII Veterans
by F4UDash4. 03/24/24 09:21 PM
They got fired after this.
by Wigean. 03/20/24 08:19 PM
Grown ups joke time
by NoFlyBoy. 03/18/24 10:34 PM
Anyone Heard from Nimits?
by F4UDash4. 03/18/24 10:01 PM
RIP Gemini/Apollo astronaut Tom Stafford
by semmern. 03/18/24 02:14 PM
10 years after 3/8/2014
by NoFlyBoy. 03/17/24 10:25 AM
Copyright 1997-2016, SimHQ Inc. All Rights Reserved.

Powered by UBB.threads™ PHP Forum Software 7.6.0