Jump to content

TARGET - Advanced programming


ivanwfr
 Share

Recommended Posts

... You probably don't need the StopAutoRepeat() command, but i put it in my routines just to be sure.

 

Yeah, its only needed with the RNOSTOP option on REXEC command

[sIGPIC][/sIGPIC]

Win10 64, Asus Maximus VIII Formula, i5 6600K, Geforce 980 GTX Ti, 32 GB Ram, Samsung EVO SSD.

Link to comment
Share on other sites

  • 3 weeks later...

I ran into a weird problem. After running the script I generally had the virtual controller and all the other devices also recognized in DCS. This way I could mix simple binds with scripts and it was quite flexible.

 

However every now and then it was bugging out so the devices would disappear and only the virtual controller stays, which lead to the point where in the past 1,5h I was completely unable to get them back and the virtual controller is limited to 32 buttons etc. not to mention the different devices also overlap (i.e both MFDs) and some of the buttons don't even seem to exist. Not cool.

 

I tried configuring the devices as excluded, enabled, filtered and also flat out excluding them from the script but does nothing. :helpsmilie:

Link to comment
Share on other sites

  • 6 months later...

Hi I am working on a TARGET script that takes info from a Log file exported by DCS.

Until now I managed to take info from the SIM at the press of a button with EXEC or with REXEC, reading from this file.

I am looking a way for executing this function (reading from the file) every given time (for example every 500 milliseconds) but REXEC seems to work only when I press a button, is there a way to call it as a function...like for example inside a while(true) loop, but without pressing a button?

Vincent "Virus" 

PC: R9 5900x/RTX2080Ti, 64GB RAM.

Joystick bases: Virpil T-50CM2 + T-50CM2 Grip

Throttles: Winwing Orion Throttle

Rudder: Saitek Rudders

Hardware: Razer Tartarus

Monitor: Samsung Odyssey G9, TrackIr v5

Link to comment
Share on other sites

You may try something like this:

 

define CYCLE_INTERVAL = 500
int start_loop()
{
   // FIRST CALL .. ON SOME EVENT
handle_cycle(0);
}

int handle_cycle(int cycle_num)
{
   // THIS CYCLE HANDLING

   // NEXT CYCLE LOOP
   DeferCall(CYCLE_INTERVAL , &handle_cycle, cycle_num + 1);
}

Link to comment
Share on other sites

Is there a utility that would give little text messages. I would sometimes like to get some acknowledgement what I just did. For example, I have some SEQ-commands, maybe for different modes or CM profiles. It would be nice if I got a text saying "CM Profile 1", or so, instead of looking it up from Cockpit switch positions, which BTW in VR are not always that clear...

Link to comment
Share on other sites

Is there a utility that would give little text messages. I would sometimes like to get some acknowledgement what I just did. For example, I have some SEQ-commands, maybe for different modes or CM profiles. It would be nice if I got a text saying "CM Profile 1", or so, instead of looking it up from Cockpit switch positions, which BTW in VR are not always that clear...
You can just use c printf and have debug information you choose in the target console

 

Inviato dal mio SM-J530F utilizzando Tapatalk

Vincent "Virus" 

PC: R9 5900x/RTX2080Ti, 64GB RAM.

Joystick bases: Virpil T-50CM2 + T-50CM2 Grip

Throttles: Winwing Orion Throttle

Rudder: Saitek Rudders

Hardware: Razer Tartarus

Monitor: Samsung Odyssey G9, TrackIr v5

Link to comment
Share on other sites

You may try something like this:

 

define CYCLE_INTERVAL = 500
int start_loop()
{
   // FIRST CALL .. ON SOME EVENT
handle_cycle(0);
}

int handle_cycle(int cycle_num)
{
   // THIS CYCLE HANDLING

   // NEXT CYCLE LOOP
   DeferCall(CYCLE_INTERVAL , &handle_cycle, cycle_num + 1);
}

Thanks i will try to understand and implement it

 

Inviato dal mio SM-J530F utilizzando Tapatalk

Vincent "Virus" 

PC: R9 5900x/RTX2080Ti, 64GB RAM.

Joystick bases: Virpil T-50CM2 + T-50CM2 Grip

Throttles: Winwing Orion Throttle

Rudder: Saitek Rudders

Hardware: Razer Tartarus

Monitor: Samsung Odyssey G9, TrackIr v5

Link to comment
Share on other sites

You can just use c printf and have debug information you choose in the target console

 

Inviato dal mio SM-J530F utilizzando Tapatalk

 

I think that is not exactly what I am looking for. I would like to have a text overlay on DCS game window, like fraps does it with frames, showing a short message.

Link to comment
Share on other sites

I think that is not exactly what I am looking for. I would like to have a text overlay on DCS game window, like fraps does it with frames, showing a short message.
You could make target write to a file using the c functions for that (look in the .h files for the supported functions)...and then use something like the vr scrathpad mod (search for it in the forums) for displaying into a window inside Dcs...

It is the opposite of what i am doing (reading a file exported from dcs to target)

 

Inviato dal mio SM-J530F utilizzando Tapatalk

Vincent "Virus" 

PC: R9 5900x/RTX2080Ti, 64GB RAM.

Joystick bases: Virpil T-50CM2 + T-50CM2 Grip

Throttles: Winwing Orion Throttle

Rudder: Saitek Rudders

Hardware: Razer Tartarus

Monitor: Samsung Odyssey G9, TrackIr v5

Link to comment
Share on other sites

I am referring to this Mod

 

https://r.tapatalk.com/shareLink?url=https%3A%2F%2Fforums%2Eeagle%2Eru%2Fshowthread%2Ephp%3Ft%3D229077&share_tid=229077&share_fid=74365&share_type=t

 

You could see which file uses for storing the text, and write from target to it..

 

Inviato dal mio SM-J530F utilizzando Tapatalk

Vincent "Virus" 

PC: R9 5900x/RTX2080Ti, 64GB RAM.

Joystick bases: Virpil T-50CM2 + T-50CM2 Grip

Throttles: Winwing Orion Throttle

Rudder: Saitek Rudders

Hardware: Razer Tartarus

Monitor: Samsung Odyssey G9, TrackIr v5

Link to comment
Share on other sites

You may try something like this:

 

define CYCLE_INTERVAL = 500
int start_loop()
{
   // FIRST CALL .. ON SOME EVENT
handle_cycle(0);
}

int handle_cycle(int cycle_num)
{
   // THIS CYCLE HANDLING

   // NEXT CYCLE LOOP
   DeferCall(CYCLE_INTERVAL , &handle_cycle, cycle_num + 1);
}

Man, this did the trick....

You are a legend.

Now i have realtime (500 ms or 1 second delay) event tracing from dcs world to a target script

 

a01d7d3f366dd60bc5c36c1c4dc62826.jpg

 

Inviato dal mio SM-J530F utilizzando Tapatalk


Edited by VirusAM

Vincent "Virus" 

PC: R9 5900x/RTX2080Ti, 64GB RAM.

Joystick bases: Virpil T-50CM2 + T-50CM2 Grip

Throttles: Winwing Orion Throttle

Rudder: Saitek Rudders

Hardware: Razer Tartarus

Monitor: Samsung Odyssey G9, TrackIr v5

Link to comment
Share on other sites

And this is a little video of the concept in execution.

It is an event reading test without any joystick command yet.

 

Vincent "Virus" 

PC: R9 5900x/RTX2080Ti, 64GB RAM.

Joystick bases: Virpil T-50CM2 + T-50CM2 Grip

Throttles: Winwing Orion Throttle

Rudder: Saitek Rudders

Hardware: Razer Tartarus

Monitor: Samsung Odyssey G9, TrackIr v5

Link to comment
Share on other sites

  • 3 months later...
And this is a little video of the concept in execution.

It is an event reading test without any joystick command yet.

 

 

Good job! It looks you got it right. This level of using the script language is not the shortest way to get things done real quick but, unlike with intricated macros, you can reach a clean understanding of what happens behind your code.

Link to comment
Share on other sites

Good job! It looks you got it right. This level of using the script language is not the shortest way to get things done real quick but, unlike with intricated macros, you can reach a clean understanding of what happens behind your code.

 

 

 

Thanks Ivan...but without your help and inspiration from other people here (like homefries wonderful profiles) it wouldn’t have been possible.

Actually my profile is able to recognize which module i am using, and for some also change bindings on the fly depending if you have gear up or down, and change the backlight as well.

The only downside is that it does not work in multiplayer, because most server blocks export.

Vincent "Virus" 

PC: R9 5900x/RTX2080Ti, 64GB RAM.

Joystick bases: Virpil T-50CM2 + T-50CM2 Grip

Throttles: Winwing Orion Throttle

Rudder: Saitek Rudders

Hardware: Razer Tartarus

Monitor: Samsung Odyssey G9, TrackIr v5

Link to comment
Share on other sites

  • 3 weeks later...

Looking for some advice on a strategy, for an F14 profile. Looking for how to best implement controls for Pilot and RIO in one profile. I don't like using the UMD functionality built into TARGET, but I'm open to suggestions.

Flying the Viper Viggen

IYAOYAS


 
Link to comment
Share on other sites

Looking for some advice on a strategy, for an F14 profile. Looking for how to best implement controls for Pilot and RIO in one profile. I don't like using the UMD functionality built into TARGET, but I'm open to suggestions.

 

You could simply remap all the pilot / RIO controls whenever a toggle button is pushed (or some 2-position switch is flipped) if you don't want to use the in-built UMD layers.

 

There's probably some more effective way, though.


Edited by Dudikoff

i386DX40@42 MHz w/i387 CP, 4 MB RAM (8*512 kB), Trident 8900C 1 MB w/16-bit RAMDAC ISA, Quantum 340 MB UDMA33, SB 16, DOS 6.22 w/QEMM + Win3.11CE, Quickshot 1btn 2axis, Numpad as hat. 2 FPH on a good day, 1 FPH avg.

 

DISCLAIMER: My posts are still absolutely useless. Just finding excuses not to learn the F-14 (HB's Swansong?).

 

Annoyed by my posts? Please consider donating. Once the target sum is reached, I'll be off to somewhere nice I promise not to post from. I'd buy that for a dollar!

Link to comment
Share on other sites

You could simply remap all the pilot / RIO controls whenever a toggle button is pushed (or some 2-position switch is flipped) if you don't want to use the in-built UMD layers.

 

There's probably some more effective way, though.

 

 

Yeah,

I'm thinking of two separate .tmc files, or not.

 

 

 

Really stuck for how to go about it, but one feature I'd like to have is a command that switches between Pilot and RIO, and also switches stick/controller functionality.

Flying the Viper Viggen

IYAOYAS


 
Link to comment
Share on other sites

You could simply remap all the pilot / RIO controls whenever a toggle button is pushed (or some 2-position switch is flipped) if you don't want to use the in-built UMD layers.

 

There's probably some more effective way, though.

 

 

Yeah,

I'm thinking of two separate .tmc files, or not.

 

 

 

Really stuck for how to go about it, but one feature I'd like to have is a command that switches between Pilot and RIO, and also switches stick/controller functionality.

Flying the Viper Viggen

IYAOYAS


 
Link to comment
Share on other sites

You can run new map commands anytime you want. Make a function call to map for pilot and one for RIO. Then use a button press or toggle switch to toggle between calling the two functions every time the button is pressed or the switch is flipped (use EXEC() to call the new mapping function). Each function can 100% remap everything as if you just ran a separate .TMC file.

 

Of course, for those mappings that are the same for both pilot and RIO, map those the normal way just once in the main part of your .TMC.

Link to comment
Share on other sites

You can run new map commands anytime you want. Make a function call to map for pilot and one for RIO. Then use a button press or toggle switch to toggle between calling the two functions every time the button is pressed or the switch is flipped (use EXEC() to call the new mapping function). Each function can 100% remap everything as if you just ran a separate .TMC file.

 

Can you give an example? I'm feeling particularly dense at this time.

Flying the Viper Viggen

IYAOYAS


 
Link to comment
Share on other sites

Here is an example of how to do it. This should work well as a template for your config. It swaps between the Pilot and RIO configs when you press the I shift key (S3 on the Warthog Joystick) and the LTB button on the Warthog Throttle. Of course it is easy to change the button combo to suit your needs. It also uses LEDs to indicate which profile is currently selected.

 

Reply with any questions.

 

 

The .tmc file:

//******************************************************************

include "target.tmh"
include "_Drakoz_DualConfigExample.ttm"

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

//******************************************************************
// Common config for Pilot and RIO
//******************************************************************
// This config will be set up once and never changed.  Settings are for both Pilot and RIO.

//******************************************************************
//	Setup some basic settings

SetKBLayout(KB_ENG);									// this file designed for English keyboard.
SetShiftButton(&Joystick, S3, &Throttle, 0, 0, 0);		// IO Shift and UMD Setup   


//******************************************************************
//	Map DirectX axis

// JoyX, JoyY
MapAxis(&Joystick, JOYX, DX_X_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
MapAxis(&Joystick, JOYY, DX_Y_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);

// Throttle - Left and Right
MapAxis(&Throttle, THR_RIGHT, DX_Z_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
MapAxis(&Throttle, THR_LEFT, DX_ZROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);

// Slew Control
MapAxis(&Throttle, SCX, DX_XROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
MapAxis(&Throttle, SCY, DX_YROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);

// Throttle Friction Control
MapAxis(&Throttle, THR_FC, DX_SLIDER_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);

//******************************************************************
//	LED Setup 
ActKey(PULSE+KEYON+LED(&Throttle, LED_INTENSITY, LEDLevel1));		// set Throttle LED back light intensity

ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED1)); 	// set LED 1 OFF
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 OFF
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 OFF

//******************************************************************
//	Throttle Controls

// Coolie Switch (HAT)
MapKeyIO(&Throttle, CSU, 0, DCS_ZoomInSlow);
MapKeyIO(&Throttle, CSD, 0, DCS_ZoomOutSlow);	
MapKeyIO(&Throttle, CSL, 0, DCS_LabelsAll);
MapKeyIO(&Throttle, CSR, 0, DCS_ZoomNormal);

printf("----------------------------------\xa");

SetUpPilot();			// Configure Pilot specific mappings.  (Default to Pilot config on startup)

}	// end main()


int SetUpPilot()
{
printf("Setting up config for Pilot...\xa");

// LED1 on to indicate Pilot mode (LED2 off)
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

// Swap to RIO config when shifted Left Throttle Button pressed
MapKeyIO(&Throttle, LTB, EXEC("SetUpRIO();"), 0);

// Place all Pilot specific configs here
// This can include all normal config commands like MapKey, MapAxis, etc
//  ...

}

int SetUpRIO()
{
printf("Setting up config for RIO...\xa");

// LED2 on to indicate RIO mode (LED1 off)
ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT+LED2)); 	// set LED 2 ON
ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED1)); 	// set LED 1 OFF

// Swap to Pilot config when shifted Left Throttle Button pressed
MapKeyIO(&Throttle, LTB, EXEC("SetUpPilot();"), 0);

// Place all RIO specific configs here
// This can include all normal config commands like MapKey, MapAxis, etc
//  ...

}


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

 

 

The .ttm file:

// Search for all TODO and resolve

//******************************************************************
//
//	(Generic Blank Script File)	-  T.A.R.G.E.T. Macro File   
//
//******************************************************************
//	Notes about using this configuration
//	- See .tmc file for notes
//	
//
//
//******************************************************************
//
//	History
//	MM/DD/YYYY Created - Michael Lohmeyer			// TODO:  Add date here
//
//******************************************************************

//******************************************************************
//  TrackIR 
define		TIR_Center				R_CTL+APPS			// Center TrackIR
define		TIR_Pause				R_CTL+R_SHIFT+APPS	// Pause TrackIR
define		TIR_Precision			R_ALT+APPS			// TrackIR Precision Mode
define		TIR_ProfileSmooth		L_CTL+L_SHIFT+F1	// Select Smooth TrackIR Profie
define		TIR_ProfileFlatYawPitch	L_CTL+L_SHIFT+F2	// Select FlatYawPitch TrackIR Profile

//******************************************************************
//	Warthog Throttle LED Settings
define		LEDLevelOff		0				// LED intensity off
define		LEDLevel1		50				// LED intensity level 1
define		LEDLevel2		100				// LED intensity level 2
define		LEDLevel3		150				// LED intensity level 3
define		LEDLevel4		200				// LED intensity level 4
define		LEDLevel5		255				// LED intensity level 5

//******************************************************************
//  Standard DCS Functions
define		DCS_LabelsAll			L_SHIFT+F10			// Toggle Labels all aircraft

define		DCS_ZoomInSlow			USB[0x54]			// Zoom in slow - Num*
define		DCS_ZoomOutSlow			USB[0x55]			// Zoom out slow - Num/
define		DCS_ZoomNormal			KPENT				// Zoom set to normal


//******************************************************************
//	

Link to comment
Share on other sites

Thanks,

I'll look at this tonight.

 

 

Drakos,

 

Working on my Macro .ttm's. Eliminated most of the duplicate commands. I intend to use 2 macro files. Pilot(default) and RIO. All the pilot and duplicated commands go in Pilot.ttm, and only RIO specific commands go in RIO.ttm.

 

 

Once that's done I can build my Mapping.

I play mostly in VR so the printf and LED commands, in the example you gave me, are pretty much useless. I'm going to make those audio files for the pilot and RIO switch.

 

 

 

That example is most definitely appreciated.

Thanks.


Edited by SGT Coyle

Flying the Viper Viggen

IYAOYAS


 
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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