Previous Thread
Next Thread
Print Thread
Rate This Thread
Hop To
#3510253 - 02/03/12 02:59 PM Target script - Need help to program LEDS  
Joined: May 2005
Posts: 80
Hrvoje Offline
Junior Member
Hrvoje  Offline
Junior Member

Joined: May 2005
Posts: 80
I am using friction control wheel coupled with shift paddle to produce landing gear up/down cmmand...
I would like also the command in this sequence to make all led lights flash for 3 times when i select ldg gear up/down command...
KeyAxis(&Throttle,THR_FC,'i',AXMAP2(3,Toggle_landing_gear_up,0, Toggle_landing_gear_down));


Here is my sript file for dcs a-10C


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

int main()
{

Configure(&LMFD,MODE_EXCLUDED);
Configure(&RMFD,MODE_EXCLUDED);


if(Init(&EventHandle)) return 1; // declare the event handler, return on error

//script and function functions go here and before the }

// shift button
SetShiftButton(&Joystick,S4);

// set pulse and delay lengths
SetKBRate(30,100);

//////////////////////////////////////////////////////////////////////////////////
// Joystick and Throttle Axis Definitions
//////////////////////////////////////////////////////////////////////////////////
MapAxis(&Joystick, JOYX, DX_X_AXIS);
MapAxis(&Joystick, JOYY, DX_Y_AXIS);
MapAxis(&Throttle, THR_LEFT, DX_ZROT_AXIS);
MapAxis(&Throttle, THR_RIGHT, DX_Z_AXIS);
RotateDXAxis(DX_X_AXIS, DX_Y_AXIS, -15); //simulate a -15 deg twisted centred stick for the A-10.

// Uncomment following two lines if you want Slew Control axes available in-game
MapAxis(&Throttle, SCX, DX_XROT_AXIS);
MapAxis(&Throttle, SCY, DX_YROT_AXIS);

// For now, don't do anything with the Slew Control pressed in
MapKey(&Throttle,SC,0);

// Assign gear lever control to gray throttle friction lever
//KeyAxisIO(0,(&Throttle,THR_FC,0,AXMAP2(LIST(0,40,60,100),Toggle_landing_gear_up,0,Toggle_landing_gear_down)));
KeyAxis(&Throttle,THR_FC,'o',AXMAP2(3,Zoom_in_slow,0,Zoom_out_slow));
KeyAxis(&Throttle,THR_FC,'i',AXMAP2(3,Toggle_landing_gear_up,0, Toggle_landing_gear_down));



//KeyAxis(&Throttle,THR_FC,'i',AXMAP2(3,LED(&Throttle, LED_ONOFF, LED_CURRENT^LED1),0,LED(&Throttle, LED_ONOFF, LED_CURRENT^LED1)));

//KeyAxis(&Throttle,THR_FC,'i',AXMAP2
//(3,
//CHAIN(LED(&Throttle,LED_ONOFF, LED_CURRENT^LED1),D(500),LED(&Throttle, LED_ONOFF, LED_CURRENT^LED1),D(500),LED(&Throttle, LED_ONOFF, LED_CURRENT^LED1),D(500),LED(&Throttle, LED_ONOFF, LED_CURRENT^LED1),
//0,
//CHAIN(LED(&Throttle,LED_ONOFF, LED_CURRENT^LED1),D(500),LED(&Throttle, LED_ONOFF, LED_CURRENT^LED1),D(500),LED(&Throttle, LED_ONOFF, LED_CURRENT^LED1),D(500),LED(&Throttle, LED_ONOFF, LED_CURRENT^LED1)
//);

////////////////////////////////////////////////////////////////////////////////////
// Joystick Button Definitions
////////////////////////////////////////////////////////////////////////////////////

MapKey(&Joystick,TG1,Gun_trigger_first_stage);
MapKey(&Joystick,TG2,Gun_trigger);
MapKeyIO(&Joystick,S1,
SEQ( //open the sequence
CHAIN(
EXEC( // Curve 1
"SetSCurve(&Joystick, JOYX, 0, 0, 0, 1, 0); SetSCurve(&Joystick, JOYY, 0, 0, 0, 1, 0);"
),
LED(&Throttle, LED_ONOFF, LED_CURRENT+LED1)
),
CHAIN(
EXEC( // curve 2
"SetSCurve(&Joystick, JOYX, 0, 0, 0, 2, 0); SetSCurve(&Joystick, JOYY, 0, 0, 0, 2, 0);"
),
LED(&Throttle, LED_ONOFF, LED_CURRENT+LED1),
LED(&Throttle, LED_ONOFF, LED_CURRENT+LED2)
),
CHAIN(
EXEC( // curve 3
"SetSCurve(&Joystick, JOYX, 0, 0, 0, 3, 0); SetSCurve(&Joystick, JOYY, 0, 0, 0, 3, 0);"
),
LED(&Throttle, LED_ONOFF, LED_CURRENT+LED1),
LED(&Throttle, LED_ONOFF, LED_CURRENT+LED2),
LED(&Throttle, LED_ONOFF, LED_CURRENT+LED3)
),
CHAIN(
EXEC( // curve 4
"SetSCurve(&Joystick, JOYX, 0, 0, 0, 3, -1); SetSCurve(&Joystick, JOYY, 0, 0, 0, 3, -1);"
),
LED(&Throttle, LED_ONOFF, LED_CURRENT+LED1),
LED(&Throttle, LED_ONOFF, LED_CURRENT+LED2),
LED(&Throttle, LED_ONOFF, LED_CURRENT+LED3),
LED(&Throttle, LED_ONOFF, LED_CURRENT+LED4)
),
CHAIN(
EXEC( // curve 5
"SetSCurve(&Joystick, JOYX, 0, 0, 0, 4, -1); SetSCurve(&Joystick, JOYY, 0, 0, 0, 4, -1);"
),
LED(&Throttle, LED_ONOFF, LED_CURRENT+LED1),
LED(&Throttle, LED_ONOFF, LED_CURRENT+LED2),
LED(&Throttle, LED_ONOFF, LED_CURRENT+LED3),
LED(&Throttle, LED_ONOFF, LED_CURRENT+LED4),
LED(&Throttle, LED_ONOFF, LED_CURRENT+LED5)
),
CHAIN(
EXEC( // reset to straight
"SetSCurve(&Joystick, JOYX, 0, 0, 0 ,0, 0); SetSCurve(&Joystick, JOYY, 0, 0, 0 ,0, 0);"
),
LED(&Throttle, LED_ONOFF, LED_CURRENT-LED1),
LED(&Throttle, LED_ONOFF, LED_CURRENT-LED2),
LED(&Throttle, LED_ONOFF, LED_CURRENT-LED3),
LED(&Throttle, LED_ONOFF, LED_CURRENT-LED4),
LED(&Throttle, LED_ONOFF, LED_CURRENT-LED5)
)
) //close the Sequence
,HOTAS_Master_Mode_Control_Button);
MapKeyIO(&Joystick,S2,0,Weapon_release);
MapKeyIO(&Joystick,S3,0,HOTAS_nosewheel_steering_button);

MapKey(&Joystick,H1U,Trim_nose_down);
MapKey(&Joystick,H1D,Trim_nose_up);
MapKey(&Joystick,H1L,Trim_aileron_left);
MapKey(&Joystick,H1R,Trim_aileron_right);

MapKeyIO(&Joystick,H2U,0,HOTAS_TMS_up);
MapKeyIO(&Joystick,H2D,0,HOTAS_TMS_down);
MapKeyIO(&Joystick,H2L,0,HOTAS_TMS_left);
MapKeyIO(&Joystick,H2R,0,HOTAS_TMS_right);

MapKeyIO(&Joystick,H3U,0,HOTAS_DMS_up);
MapKeyIO(&Joystick,H3D,0,HOTAS_DMS_down);
MapKeyIO(&Joystick,H3L,0,HOTAS_DMS_left);
MapKeyIO(&Joystick,H3R,0,HOTAS_DMS_right);

MapKeyIO(&Joystick,H4U,Zoom_in_slow,HOTAS_CMS_forward);
MapKeyIO(&Joystick,H4D,Zoom_out_slow,HOTAS_CMS_aft);
MapKeyIO(&Joystick,H4L,0,HOTAS_CMS_left);
MapKeyIO(&Joystick,H4R,0,HOTAS_CMS_right);

//////////////////////////////////////////////////////////////////////////////////////
// Throttle Button Definitions
//////////////////////////////////////////////////////////////////////////////////////

// MIC HAT + views
MapKeyIO(&Throttle,MSU,F1,DX3);
MapKeyIO(&Throttle,MSD,F3,DX5);
MapKeyIO(&Throttle,MSL,F4,DX6);
MapKeyIO(&Throttle,MSR,L_CTL+F5,L_ALT+KP1);
MapKeyIO(&Throttle,MSP,SEQ(DOWN+KP5,UP+KP5),0);

MapKey(&Throttle,SPDB,DX8);
MapKey(&Throttle,SPDF,DX7);

MapKey(&Throttle,BSB,DX10);
MapKey(&Throttle,BSF,DX9);

MapKey(&Throttle,CHB,DX12);
MapKey(&Throttle,CHF,DX11);

MapKey(&Throttle,PSB,DX14);
MapKey(&Throttle,PSF,DX13);

MapKeyIO(&Throttle,LTB,KP5,TEMPO(F13,L_SHIFT+F12,500));

MapKey(&Throttle,CSU,DXHATUP);
MapKey(&Throttle,CSD,DXHATDOWN);
MapKey(&Throttle,CSL,DXHATLEFT);
MapKey(&Throttle,CSR,DXHATRIGHT);

MapKey(&Throttle,EFLNORM,DX16);
MapKey(&Throttle,EFRNORM,DX17);
MapKey(&Throttle,EOLMOTOR,DX18);
MapKey(&Throttle,EORMOTOR,DX19);
MapKey(&Throttle,APUON,DX20);
MapKey(&Throttle,LDGH,DX21);
MapKey(&Throttle,FLAPU,DX22);
MapKey(&Throttle,FLAPD,DX23);
MapKey(&Throttle,EACON,DX24);
MapKey(&Throttle,RDRNRM,DX25);
MapKey(&Throttle,APENG,DX26);
MapKey(&Throttle,APPAT,DX27);
MapKey(&Throttle,APALT,DX28);
MapKey(&Throttle,IDLELON,DX30);
MapKey(&Throttle,IDLERON,DX29);
MapKey(&Throttle,EOLIGN,DX31);
MapKey(&Throttle,EORIGN,DX32);

}

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

Inline advert (2nd and 3rd post)

#3510330 - 02/03/12 04:39 PM Re: Target script - Need help to program LEDS [Re: Hrvoje]  
Joined: Jul 2005
Posts: 1,508
Teej Offline
Member
Teej  Offline
Member

Joined: Jul 2005
Posts: 1,508
Well, one issue you might run into is there's no way (that I've seen) to read back the current state of the LEDs. You could do some more scripting on your end to keep track of what you're doing to the LEDs in other places in variables, and reset according to that.

Thus, you can turn them on, turn them off, or flip them from what they are now.

My suggestion?

Your existing line: KeyAxis(&Throttle,THR_FC,'i',AXMAP2(3,Toggle_landing_gear_up,0, Toggle_landing_gear_down));

should change to:

KeyAxis(&Throttle,THR_FC,'i',AXMAP2(3,CHAIN(Toggle_landing_gear_up,Flash3),0, CHAIN(Toggle_landing_gear_down,Flash3)));

Then right above int main, add:

int Flash3;

Then after the SETKBRATE command, add:
Code:
Flash3 = CHAIN( LED(&Throttle,LED_ONOFF,LED_CURRENT^0x333338),D(500),
LED(&Throttle,LED_ONOFF,LED_CURRENT^0x333338),D(500),
LED(&Throttle,LED_ONOFF,LED_CURRENT^0x333338),D(500),
LED(&Throttle,LED_ONOFF,LED_CURRENT^0x333338),D(500),
LED(&Throttle,LED_ONOFF,LED_CURRENT^0x333338),D(500),
LED(&Throttle,LED_ONOFF,LED_CURRENT^0x333338),D(500)
);

Last edited by Teej; 02/03/12 04:39 PM.

#6 - Opposing / Left Solo
Virtual Thunderbirds, LLC | Sponsored by Thrustmaster
#3512451 - 02/06/12 09:49 AM Re: Target script - Need help to program LEDS [Re: Hrvoje]  
Joined: May 2005
Posts: 80
Hrvoje Offline
Junior Member
Hrvoje  Offline
Junior Member

Joined: May 2005
Posts: 80
thanks for your idea...will try to incorporate this into my profile...


Moderated by  RacerGT 

Quick Search
Recent Articles
Support SimHQ

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


Recent Topics
Headphones
by RossUK. 04/24/24 03:48 PM
Skymaster down.
by Mr_Blastman. 04/24/24 03:28 PM
The Old Breed and the Costs of War
by wormfood. 04/24/24 01:39 PM
Actors portraying British Prime Ministers
by Tarnsman. 04/24/24 01:11 AM
Roy Cross is 100 Years Old
by F4UDash4. 04/23/24 11:22 AM
Actors portraying US Presidents
by PanzerMeyer. 04/19/24 12:19 PM
Dickey Betts was 80
by Rick_Rawlings. 04/19/24 01:11 AM
Exodus
by RedOneAlpha. 04/18/24 05:46 PM
Copyright 1997-2016, SimHQ Inc. All Rights Reserved.

Powered by UBB.threads™ PHP Forum Software 7.6.0