Jump to content

TARGET - Advanced programming


ivanwfr

Recommended Posts

Don't use the GUI editor, or only use GUI editor for exporting script, which is a horrible way, you have to learn the TARGET scripting, and call a TARGET script file thru the TARGET GUI, amazingly the TARGET scripteditor cannot use command line calls, is why.

 

Attached my - cleaned - DX setup files, you can edit DX120_DCS.tmc, so to not pass specific DX but to pass TARGET Commands (I do that for F18 autopilot macro on the TMWH 3-way autopilot toggle)

 

Well that's basically exactly what I was looking for! Many thanks!

 

With this it's just a mater of assigning buttons in DCS and adding just a bit of fantasy with leds and stuff manually in the script. Perfect :)

 

Still have some script tricks to figure out though....

 

For example using 2 times the mapKey function on same button seems to cancel the first one instead of doing both actions. Will have to look into this!

Link to comment
Share on other sites

Well that's basically exactly what I was looking for! Many thanks!

 

With this it's just a mater of assigning buttons in DCS and adding just a bit of fantasy with leds and stuff manually in the script. Perfect :)

 

Still have some script tricks to figure out though....

 

For example using 2 times the mapKey function on same button seems to cancel the first one instead of doing both actions. Will have to look into this!

you have to read and know

TARGET_SCRIPT_EDITOR_basics.pdf

compare a sample script file with to content of this PDF and figure it out,

looks horribly complex, but it's just a bad scripting language :)

| VR goggles | Autopilot panel | Headtracker | TM HOTAS | G920 HOTAS | MS FFB 2 | Throttle Quadrants | 8600K | GTX 1080 | 64GB RAM| Win 10 x64 | Voicerecognition | 50" UHD TV monitor | 40" 1080p TV monitor | 2x 24" 1080p side monitors | 24" 1080p touchscreen |

Link to comment
Share on other sites

 

and how can I printf flag values ? Can you only printf strings ? not flag values ?

 

As the good SGT has suggested...there are some excellent ideas and suggestions within this thread...it is WELL WORTH reading every page!

 

In the meantime, the short answer is no...you can print any variable!

 

printf("My int variable = %d", <int variable>);

printf("My String variable = %s", <string variable>);

printf("My float variable = %f", <float value>);

 

And it gets better!

 

Hope this helps.

dmonds

Link to comment
Share on other sites

Takes bit of time to get into the head of a thrustmaster developper :)

 

Finally got what I want: gearup/gear down, first led control with the gear, long press for emergency extend, and still working original DX button on virtual controller.

 

NICE :)

MapKey(&Throttle, LDGH, CHAIN(DX54,TEMPO(CHAIN(SEQ( PULSE+L_CTL+'g' , PULSE+L_SHIFT+'g'),SEQ( LED(&Throttle, LED_ONOFF, LED_CURRENT+LED1), LED(&Throttle, LED_ONOFF, LED_CURRENT-LED1))),PULSE+L_CTL+L_SHIFT+'g',1000)));

 

Link to comment
Share on other sites

Figured out the functions and all. Give it a go.!

 

Working script for the su27, Should work for the Mig and Su33 also, haven't tested that.

 

Working with a pinky modifier, 3 sub-functions, 2a2, nav and a2g (a2g is left empty atm since I don't use that much)

 

Throttle lights indicate what program you are in. (a2a, nav or a2g)

 

It also has a Flare and Caff program.

 

I don't have a stick atm, that's why its all mapped to the throttle. Give me some feedback and Ill change it for you if you like to use this script.

su27.zip

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

Figured out the functions and all. Give it a go.!

 

Working script for the su27, Should work for the Mig and Su33 also, haven't tested that.

 

Working with a pinky modifier, 3 sub-functions, 2a2, nav and a2g (a2g is left empty atm since I don't use that much)

Well done. If only you tried this on the Tomcat 14B gazillion commands pilot/RIO etc, bought it, only take off and trapping, never got to the radar or weapons, too many commands.

| VR goggles | Autopilot panel | Headtracker | TM HOTAS | G920 HOTAS | MS FFB 2 | Throttle Quadrants | 8600K | GTX 1080 | 64GB RAM| Win 10 x64 | Voicerecognition | 50" UHD TV monitor | 40" 1080p TV monitor | 2x 24" 1080p side monitors | 24" 1080p touchscreen |

Link to comment
Share on other sites

Well done. If only you tried this on the Tomcat 14B gazillion commands pilot/RIO etc, bought it, only take off and trapping, never got to the radar or weapons, too many commands.

 

Haha. yeah I bet.

 

Figured I'll try to get it working with a simpler plane first. but even with the su27 . it takes a lot of time.

 

Im going to try to implement the 3 way autopilot on it tomorrow. give it a test. I attached the files in the previous post

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

Haha. yeah I bet.

Figured I'll try to get it working with a simpler plane first. but even with the su27 . it takes a lot of time.

Im going to try to implement the 3 way autopilot on it tomorrow. give it a test. I attached the files in the previous post

Never mind, lxsapper in this thread already said DCS F14B pilot/RIO separation interferes with functions list.

Got your files, great sample.

| VR goggles | Autopilot panel | Headtracker | TM HOTAS | G920 HOTAS | MS FFB 2 | Throttle Quadrants | 8600K | GTX 1080 | 64GB RAM| Win 10 x64 | Voicerecognition | 50" UHD TV monitor | 40" 1080p TV monitor | 2x 24" 1080p side monitors | 24" 1080p touchscreen |

Link to comment
Share on other sites

Never mind, lxsapper in this thread already said DCS F14B pilot/RIO separation interferes with functions list.

Got your files, great sample.

 

There is a bug with the navigation, I cant seem to find what is is. do you have the same ? It wont go the next waypoint, only previous....

[sIGPIC][/sIGPIC]

Link to comment
Share on other sites

  • 3 months later...
Anyone got any ideas for a function to have TARGET recognize a rapid double tap on a button?

Looking to add an on the fly switch of functionality without changing Layers.

manual:

"Multiple outputs on a single button

TEMPO Command"

(this is actually a 'hold longer than')

| VR goggles | Autopilot panel | Headtracker | TM HOTAS | G920 HOTAS | MS FFB 2 | Throttle Quadrants | 8600K | GTX 1080 | 64GB RAM| Win 10 x64 | Voicerecognition | 50" UHD TV monitor | 40" 1080p TV monitor | 2x 24" 1080p side monitors | 24" 1080p touchscreen |

Link to comment
Share on other sites

manual:

"Multiple outputs on a single button

TEMPO Command"

(this is actually a 'hold longer than')

 

 

Absolutely right and correct. I don't know what I was thinking. I guess I always use TEMPO for long presses and just never think of it for the quick double tap.

Thanks for reminding me of the basics.

Night Ops in the Harrier

IYAOYAS


 
Link to comment
Share on other sites

  • 1 month later...

Anyone done a progressive output on a button press?

I want a key press sent on a held button press that gets progressively faster the longer it’s held. Like adjusting the time on an old digital clock.

I like this for flipping through kneeboard pages

Night Ops in the Harrier

IYAOYAS


 
Link to comment
Share on other sites

That should be possible on an EXEC that calls an EXEC within itself with a duration variable.

 

EXEC ( DX1, wait T, if (button) T = T/2, if T<minimumValue T=minimumValue, repeat function, else T = originalValue )

 

Does anyone know how to disable mouse emulation? Every time I start a script it snaps the mouse cursor to the middle of the screen which I assume is the mouse emulation initializing. I never use the mouse emulation so stripping it out and not having the virtual mouse would be a nice quality of life improvement.

Link to comment
Share on other sites

  • 1 month later...

Anyone know what causes a Define stack full error in the compiler?

I got this "Compile Error define stack full in TD_Functions.tmh at line 255", and I have no idea why.

[color=#1e90ff][b]int[/b][/color] Cat_Hookup() {
[color=#1e90ff][b]if[/b][/color] (Bar_Down >[color=#ffffff]0[/color]) {
ActKey[color=#ffffff]([/color]PULSE + KEYON + Catapult_Hook_Up);        <- [u][b][i]This is line 255[/i][/b][/u]
Bar_Down = [color=#ffffff]0[/color];

}
[color=#1e90ff][b]else[/b][/color] [color=#1e90ff][b]if[/b][/color] (Bar_Down < [color=#ffffff]1[/color]) {
ActKey[color=#ffffff]([/color]PULSE + KEYON + [color=#ffffff]0[/color]);
} 

Night Ops in the Harrier

IYAOYAS


 
Link to comment
Share on other sites

Don't know what it was, but redoing it seemed to work.

 

Found that automated Macro File Generator was placing "L_WIN + " as a modifier.  That was breaking any USB[0x] commands.


Edited by SGT Coyle

Night Ops in the Harrier

IYAOYAS


 
Link to comment
Share on other sites

  • 5 weeks later...
On 12/2/2020 at 12:56 AM, SGT Coyle said:

Don't know what it was, but redoing it seemed to work.

 

Found that automated Macro File Generator was placing "L_WIN + " as a modifier.  That was breaking any USB[0x] commands.

 


 

What automated Macro File Generator are you using, I used the one by Carlton2001 but it doesn’t work anymore and desperately need a new one to save hours of work, many thx

Asus ROG IX | Intel i7-9700K | RTX 2080TI | G.SKILL 32GB DDR4 3200MHz RAM | Samsung 970 EVO 2TB M2 | LG 43” 4K Monitor | TrackiR | Stream Deck XL | Warthog HOTAS | Cougar MFDs x 3 | Saitek Rudder Pedals | Logitech G13| Corsair Virtuoso Wireless Headset |

Link to comment
Share on other sites

Win11 Pro 64-bit, Ryzen 5800X3D, Corsair H115i, Gigabyte X570S UD, EVGA 3080Ti XC3 Ultra 12GB, 64 GB DDR4 G.Skill 3600. Monitors: LG 27GL850-B27 2560x1440 + Samsung SyncMaster 2443 1920x1200, HOTAS: Warthog with Virpil WarBRD base, MFG Crosswind combat pedals, TrackIR4, Rift-S.

Personal Wish List: A6 Intruder, Vietnam theater, decent ATC module, better VR performance!

Link to comment
Share on other sites

1 hour ago, Lange_666 said:

Yep that’s the one I’ve been using, but now when I run it, it just comes up with errors during the actual run sequence. I tried it with a html file I made a couple of months ago and it worked fine. When I open the actual new html file the format and the actual language looks completely different than what was being produced 2 months ago. Can you try it again on a html file created now and see whether it works, I’ve tried it on a couple of computers with same result.

Asus ROG IX | Intel i7-9700K | RTX 2080TI | G.SKILL 32GB DDR4 3200MHz RAM | Samsung 970 EVO 2TB M2 | LG 43” 4K Monitor | TrackiR | Stream Deck XL | Warthog HOTAS | Cougar MFDs x 3 | Saitek Rudder Pedals | Logitech G13| Corsair Virtuoso Wireless Headset |

Link to comment
Share on other sites

I'm having the same issue. Didn't test before i posted.Worked fine previously because all of my macro files were created (early 2020 and one a few months ago) with this macro file generator. Now it doesn't anymore.

Win11 Pro 64-bit, Ryzen 5800X3D, Corsair H115i, Gigabyte X570S UD, EVGA 3080Ti XC3 Ultra 12GB, 64 GB DDR4 G.Skill 3600. Monitors: LG 27GL850-B27 2560x1440 + Samsung SyncMaster 2443 1920x1200, HOTAS: Warthog with Virpil WarBRD base, MFG Crosswind combat pedals, TrackIR4, Rift-S.

Personal Wish List: A6 Intruder, Vietnam theater, decent ATC module, better VR performance!

Link to comment
Share on other sites

New macro generator for HTML has been uploaded by Carlton2001 in the user file section, many thx for upgrading this program to work with new html format

Asus ROG IX | Intel i7-9700K | RTX 2080TI | G.SKILL 32GB DDR4 3200MHz RAM | Samsung 970 EVO 2TB M2 | LG 43” 4K Monitor | TrackiR | Stream Deck XL | Warthog HOTAS | Cougar MFDs x 3 | Saitek Rudder Pedals | Logitech G13| Corsair Virtuoso Wireless Headset |

Link to comment
Share on other sites

  • 2 weeks later...

Hello. I'm trying to achieve something:

 

TG1 - on long press (1s) - Laser_OnOff - this is the first trigger stage;
TG2 - Gun_Fire (on hold, when relesed stop, Gun_Fire off) - the second trigger stage;

 

When I press trigger in Warthog, to the second stage - TG2, the first one - TG1 going on too.

 

So, when I set this in a normal way mapping all this, every time I press fire for longer time my laser go on or off.

//            Warthog Joystick TG1


    MapKeyIO(&Joystick, TG1,
     Null_Event,
     TEMPO(Null_Event, LDRF_switch, 1000));


//            Warthog Joystick TG2

    MapKeyIO(&Joystick, TG2,
     Null_Event,
     Gun_Fire);


I wish to have long burst fire when using TG2 Gun_Fire but not to switch my Laser On or Off on TG1 Long press (1s) while shooting.

 

From the manual:

include "target.tmh"

char flag1; //we create a flag called flag1

int main()
{
if(Init(&EventHandle)) return 1;

flag1=0; //set the flag1 value to 0 at startup of the configuration
MapKey(&Joystick, TG2, EXEC("flag1=1;")); //set the flag1 to 1 (true) when TG2 is pressed
MapKeyR(&Joystick, TG2, EXEC("flag1=0;")); //set the flag1 to 0 (false) when TG2 is released

MapKey(&Joystick, TG1, EXEC("if(flag1) ActKey(Weapon_Fire); else ActKey(LDRF_switch);"));

MapKey(&Joystick, TG1, EXEC("if(TG2) ActKey(Weapon_Fire); else ActKey(LDRF_switch);"));

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

 

( This will work only with PULSE+KEYON+'a'. If I remove PULSE or try tu use my definitions will not work. )

 

I can't  make this code to use proper hold press recognition.

 

I need something like this:

 

MapKey(&Joystick, TG1, EXEC("if(TG2) ActKey(KEYON+'a'); else ActKey(KEYON+'b');"));

 

With :

TEMPO(Null_Event, LDRF_switch, 1000));

How to achive this ?


Edited by Glow
Link to comment
Share on other sites

For me this part does not compile. I get a syntax error: ; expected in the first line (int    Trigger1...).

Problem is that i can' find the error...yet.

 

int	Trigger1()	{
	if(Joystick[TG1])
	ActKey(PULSE + KEYON + DX1);		//Replace DX1 with your Macro or key combo or DX command
	}

Win11 Pro 64-bit, Ryzen 5800X3D, Corsair H115i, Gigabyte X570S UD, EVGA 3080Ti XC3 Ultra 12GB, 64 GB DDR4 G.Skill 3600. Monitors: LG 27GL850-B27 2560x1440 + Samsung SyncMaster 2443 1920x1200, HOTAS: Warthog with Virpil WarBRD base, MFG Crosswind combat pedals, TrackIR4, Rift-S.

Personal Wish List: A6 Intruder, Vietnam theater, decent ATC module, better VR performance!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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