Previous Thread
Next Thread
Print Thread
Rate This Thread
Hop To
#4021268 - 10/11/14 09:47 PM Several DCS Profiles in One  
Joined: Oct 2009
Posts: 1,599
Frederf Offline
Member
Frederf  Offline
Member

Joined: Oct 2009
Posts: 1,599
I'm no stranger to making TARGET profiles and perhaps neither are you. BMS, DCS, IL-2, Euro Trucking Simulator (no, I'm not kidding), and others. DirectX binds, keyboard binds, buttons as buttons, axes as axes, buttons as axes, axes as buttons. We've done it all.

But what about DCS which allows you to change vehicles on the fly? In multiplayer or using Combined Arms it's possible to change from P-51D to A-10C to Ka-50 to F-86 all within the same session but you want to retain your individual profile function? Is it possible to simple alt-tab DCS, stop the old profile, load the new one, and DCS is fine? Yes, as far as I can tell. That's a little too crude for us though.

What about a profile that was capable of completely remapping itself without stopping the script? What about a combination of buttons that is very unlikely to come up in normal use and let it advance the "operating mode" forward or backward in a list? The 5-LED status lights could be used to display current mode (in binary, no practical limit).

That's the goal. So far I've just gotten the structure sort of in place. I'll let you know how it develops.

Code:
include "target.tmh"

//Variables
char operatingmode; 

//Initialization
int main()
{
	//Exclude all but WH Throttle
	Configure(&HCougar, MODE_EXCLUDED); 
	Configure(&Joystick, MODE_EXCLUDED);
	Configure(&T16000, MODE_EXCLUDED);
	Configure(&LMFD, MODE_EXCLUDED);
	Configure(&RMFD, MODE_EXCLUDED);
    if(Init(&EventHandle)) return 1; 
  
    //Mode Lights Off
    ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED1));
	ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED2));
	ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED3));
	ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED4));
	ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED5));
    //Backlight Control
	MapKey(&Throttle, PSF, PULSE+LED(&Throttle, LED_INTENSITY, 86)); 
	MapKey(&Throttle, PSM, PULSE+LED(&Throttle, LED_INTENSITY, 0));
	MapKey(&Throttle, PSB, PULSE+LED(&Throttle, LED_INTENSITY, 43));    

	//Mode Switching 
	SetShiftButton(&Throttle, PSF, &Throttle, 0, 0);
	MapKeyIO(&Throttle, CHF, EXEC("mode_change(operatingmode,1);") , 0);
	MapKeyIO(&Throttle, CHB, EXEC("mode_change(operatingmode,0);"), 0);
}

//Mode Change Primary Function
int mode_change(int operatingmode, int increase)
{
	if(increase != 0)	{ operatingmode=operatingmode+1; }
	else operatingmode=operatingmode-1;
	
	mode_exec(operatingmode);
	mode_lights(operatingmode);
	
	return operatingmode;
}

//Remapping Sub Function
int mode_exec (int operatingmode)
{

}

//Light Indicator Sub Function
int mode_lights (int operatingmode)
{
	printf("Test");
}

//Event Handler
int EventHandle(int type, alias o, int x)
{
	//Event Handler code
	DefaultMapping(&o, x);
}

Inline advert (2nd and 3rd post)

#4505892 - 02/02/20 02:29 PM Re: Several DCS Profiles in One [Re: Frederf]  
Joined: Jun 2007
Posts: 11
Knight Trane Offline
Junior Member
Knight Trane  Offline
Junior Member

Joined: Jun 2007
Posts: 11
Has there been any movement on this?
It seems this is exactly what I'm looking to do. Although I don't especially understand what you wrote.

#4506047 - 02/03/20 10:27 PM Re: Several DCS Profiles in One [Re: Frederf]  
Joined: Jul 2016
Posts: 61
Drakoz Offline
Junior Member
Drakoz  Offline
Junior Member

Joined: Jul 2016
Posts: 61
Knight Trane, it is actually very easy to do this, but you do need to understand a little bit of C programming to edit someone else's work to fit your needs. I have a complete working script that demonstrates one way to do it. The script allows using a Warthog Throttle with Train Sim World (TSW), which you probably don't care about, but if you look at it, and the included documentation I wrote on it, you can hopefully learn from it and see how to modify the concept for your needs. The script can be downloaded from here:
https://forums.dovetailgames.com/th...warthog-throttle-saitek-tq-profile.3634/

I have pasted a simplified example of my TSW script below. The script above is tested and will compile and run, but my reduced examples below are not tested and won't compile because I didn't include all the defines in the .ttm file.

In the script, I use the IO Shift key (set to Warthog MSP button) and the Warthog LDGH button in combination to cycle through a couple dozen profiles for the various locomotives in Train Sim World. You can easily strip out all my TSW code and add in your own custom MapKey or Axis statements for a flight sim or other game. The script does a lot of complex stuff, but most of that is entirely for TSW, not something you need to use for your own stuff.

Some comments about how this is done.

A TARGET script has two main sections, main() where you add all your MapKey() or Axis commands (and other stuff) and EventHandle() at the bottom of the script. We can ignore EventHandle() when editing TARGET scripts. Thrustmaster intended us to add all our custom mapping in main().

So the first thing to understand about a TARGET script is main() is run only once. It is run when you press RUN in the TARGET script editor and then exits. main() only configures your commands, but does not get called over and over. EventHandle(), on the other hand, is called every time you press a button, change a switch, or move an axis. But we don't need to use that for the sake of this discussion.

The second thing to understand is, even though main() runs once and executes all your MapKey() and other commands only once, there is no limitation that prevents you from running new MapKey() commands to completely remake your entire configuration in TARGET, erasing all the old MapKey() commands. This is true for most the TARGET commands (MapKey, KeyAxis, MapAxis, etc.). So the easiest way to reconfigure your entire setup is to run a new function to re-execute all the configuration commands, or at least the ones that change for your new aircraft. This is exactly what Frederf is doing. In Frederf's function, when you press CHF on the Warthog Throttle, it runs the following command:

Code
EXEC("mode_change(operatingmode,1);"


EXEC() is just how TARGET allows you to call another function in your script due to a button press. So when you press CHF on the Warthog Throttle, TARGET executes the mode_change() function. So imagine mode_change() is just another version of main(). You can add a whole new set of MapKey() or MapAxis() commands to mode_change() if you want, and completely reprogram all your key and axis mappings. In Frederf's example, he chose to pass in a number (0, 1, etc.) to mode_change() to tell mode_change() which updates to make. In my example, I just have separate functions for each locomotive, and every time I press MSP & LDGH, it cycles to the next profile and executes the functions specific to that locomotive.

See my example below. I stripped a lot of the code out of my TSW script and pasted it here so I can explain a few things, but it is still long. I did not compile and test the example below, but if you download my full script at the link above, that script is tested and should work without issue (for a Warthog Throttle). I explain what I did a little below.

Here is the .tmc file (name this what ever you want):
Code
include "target.tmh"
include "Drakoz_TrainSimWorld.ttm"

// Global variables

// Default Engine Profile 
//	This script is designed to have different control setups for different engines.  
//	This is mainly to control the difference of separate throttle and brake levers (e.g. SD40-2, GP38)
//  vs. combined throttle/brake levers (e.g. AC4400CW). 
//	Choices:
//	  pro_ProfileSelection = 
//			pro_SD40GP38		- EMD SD40-2, GP38-2, GP40-2	(LED 00001 = 1)
//			pro_AC4400CW		- GE AC4400CW					(LED 00010 = 2)
//
// Uncomment the line below for the engine you want to be the default engine.  
int pro_ProfileSelection = pro_SD40GP38;

int main()
{

	if(Init(&EventHandle)) return 1;

	//******************************************************************
	// !!!!! Don't add any code above the Configure and EventHandle commands above !!!!!
	//******************************************************************
	
	printf("----------------------------------\xa");

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

	SetKBLayout(KB_ENG);											// this file designed for English keyboard.
	SetKBRate(100, 100); 											// SetKBRate(PULSE delay, D() delay) in ms - long delays needed for TSW
	SetShiftButton(&Throttle, MSP, &Throttle, FLAPU, FLAPD, 0);		// IO Shift and UMD Setup (%DEV1, I button, $DEV, U, D, Toggle settings)

	//******************************************************************
	//  Warthog Throttle 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)); 	// LED 1 OFF
	ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED2)); 	// LED 2 OFF
	ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED3)); 	// LED 3 OFF
	ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED4)); 	// LED 4 OFF
	ActKey(PULSE+KEYON+LED(&Throttle, LED_ONOFF, LED_CURRENT-LED5)); 	// LED 5 OFF
	
	//******************************************************************
	//  Configure buttons and axis

	// Configuration that is common among all engines can be set in the function CommonConfig().  
	// pro_CallCustomConfigs() calls CommonConfig() first to make sure all common setups are done first
		
	// Call functions to make custom configuration for each profile
	//	Allows creating MapKey() and other configurations specific to each engine type.
	//	Configurations in pro_CallCustomConfigs() will override any previous MapKey(), KeyAxis(), etc. commands.  
	pro_CallCustomConfigs();

	// Set LEDs to match current profile
	setLEDbyBinary(&Throttle, pro_ProfileSelection);

	printf("----------------------------------\xa");
	
}	// end main()

//******************************************************************
// CommonConfig()
//	Configurations (MapKey, KeyAxis, Axis setup, etc.) that is common to all engines should be set up here. 
//  This function will be called every time a profile change occurs before setting any custom configuration for specific engines.  
int CommonConfig()
{

	//******************************************************************
	//	Warthog Throttle Button Controls

    //  Add all common configuration statements here....  (some examples shown)

	// Slew Control Button
	MapKeyIO(&Throttle, SC, 0, L_SHIFT);
	
	// Coolie Switch (HAT)
	MapKeyIO(&Throttle, CSU, L_CTL+DARROW, DARROW);
	MapKeyIO(&Throttle, CSD, L_CTL+UARROW, UARROW);
	MapKeyIO(&Throttle, CSL, L_CTL+LARROW, LARROW);
	MapKeyIO(&Throttle, CSR, L_CTL+RARROW, RARROW);
	
	//  Landing Gear Horn Silence Button    
	MapKeyIO(&Throttle, LDGH, 
		EXEC("pro_RotateProfile();"),   // (Map MSP + LDGH to call pro_RotateProfile() and change to next profile)
		AWS_Reset               // Otherwise, LDGH does AWS_Reset button press
	);
	
}

//******************************************************************
// pro_CallCustomConfigs()
//	Call functions to make custom configuration for each profile
int pro_CallCustomConfigs()
{
	// Do common config shared by all engines first
	CommonConfig();		
	
	// Then do custom config depending on profile.  
	// MapKey(), etc. setup in custom config will overwrite the button/axis configs from the common config.
	if      (pro_ProfileSelection == pro_SD40GP38)	pro_ConfigureSD40GP38();
	else if (pro_ProfileSelection == pro_AC4400CW)	pro_ConfigureAC4400CW();

}

//******************************************************************
// pro_ConfigureSD40GP38()
//	Custom configuration for SD40-2, GP38-2, GP40-2 and other similar diesel engines
int pro_ConfigureSD40GP38()
{
	printf("Profile %d: pro_SD40GP38\xa", pro_SD40GP38);
	
	// Reverser - using Throttle Friction Control
	KeyAxis(&Throttle, THR_FC, 'ioumd', AXMAP1(LIST(0,40,60,100), 
		CHAIN(LOCK+DOWN+Reverser_Backwards, D(400), UP+Reverser_Backwards, D(50), LOCK), 
		CHAIN(LOCK+DOWN+Reverser_Forward, D(400), UP+Reverser_Forward, D(50), LOCK))
	);
}
		
//******************************************************************
// pro_ConfigureAC4400CW()
//	Custom configuration for AC4400CW. 
int pro_ConfigureAC4400CW()
{
	printf("Profile %d: pro_AC4400CW\xa", pro_AC4400CW);
	
	// Reverser - using Throttle Friction Control
	KeyAxis(&Throttle, THR_FC, 'ioumd', AXMAP1(LIST(0,40,60,100), 
		CHAIN(LOCK+DOWN+Reverser_Backwards, D(400), UP+Reverser_Backwards, D(50), LOCK), 
		CHAIN(LOCK+DOWN+Reverser_Forward, D(400), UP+Reverser_Forward, D(50), LOCK))
	);
	
	// Headlight Switch - different delays needed vs. other engines. 
	// Following complicated CHAIN commands needed to overcome issues with SHIFT & CTL not being received properly by TSW (bug with TSW?)
	int headlightFrontFwd = CHAIN(LOCK+DOWN+'h', D(250), UP+'h', D(50), LOCK);
	int headlightFrontBkd = CHAIN(LOCK+DOWN+L_SHIFT, D(50), DOWN+'h', D(250), UP+'h', D(50), UP+L_SHIFT, D(50), LOCK);
	int headlightRearFwd = CHAIN(LOCK+DOWN+L_CTL, D(50), DOWN+'h', D(300), UP+'h', D(50), UP+L_CTL, D(50), LOCK);
	int headlightRearBkd = CHAIN(LOCK+DOWN+L_SHIFT, D(50), DOWN+L_CTL, D(50), DOWN+'h', D(300), UP+'h', D(50), UP+L_CTL, D(50), UP+L_SHIFT, D(50), LOCK);
	// Engine Operate Switch - Right
	MapKeyIO (&Throttle, EORIGN, 0, headlightFrontFwd);
	MapKeyIO (&Throttle, EORNORM, 0, 0);
	MapKeyRIO(&Throttle, EORMOTOR, 0, 0);
	MapKeyIO (&Throttle, EORMOTOR, 0, headlightFrontBkd);	
	// Engine Operate Switch - Left
	MapKeyIO (&Throttle, EOLIGN, 0, headlightRearFwd);
	MapKeyIO (&Throttle, EOLNORM, 0, 0);
	MapKeyRIO(&Throttle, EOLMOTOR, 0, 0);
	MapKeyIO (&Throttle, EOLMOTOR, 0, headlightRearBkd);	
}



// ******************* End of User Configuration ******************************************************************************************
//	Users should not make changes to the functions below.



//******************************************************************
// pro_RotateProfile()
//	Rotate through engine profiles and implement changes for specific engines.
//	Rotates LEDs to represent current profile
//	Note sections below for custom programming for each engine.  
//	
int pro_RotateProfile()
{
	pro_ProfileSelection = (pro_ProfileSelection + 1) % (pro_NumOfProfiles + 1);
	if (pro_ProfileSelection == 0) pro_ProfileSelection = 1;
	setLEDbyBinary(&Throttle, pro_ProfileSelection);
	//printf("Profile changed to: %d\xa", pro_ProfileSelection);
	pro_CallCustomConfigs();
}

//******************************************************************
// setLEDbyBinary()
//	Set LEDs to match the binary equivalent of p 
//	dev - device (e.g. &Throttle)
int LEDListArray[5] = {LED1, LED2, LED3, LED4, LED5};
int setLEDbyBinary(alias dev, int p)
{
	int x = 0;
	while (x < 5) {
		if (p & 0x1) ActKey(PULSE+KEYON+LED(&dev, LED_ONOFF, LED_CURRENT+LEDListArray[x]));
		else ActKey(PULSE+KEYON+LED(&dev, LED_ONOFF, LED_CURRENT-LEDListArray[x]));
		x = x + 1;
		p = p >> 0x1;
	}
}



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



Here is the .ttm file (named "Drakoz_TrainSimWorld.ttm" in my example).
Code
//******************************************************************
//	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

//******************************************************************
//	Profile Selection Labels (used for the variable pro_ProfileSelection)
//	Do not define any profile at 0, only 1 through 31 allowed.  
define		pro_SD40GP38		1		// EMD SD40-2, GP38-2, GP40-2	(LED 00001 = 1)
define		pro_AC4400CW		2		// GE AC4400CW					(LED 00010 = 2)

define		pro_NumOfProfiles	2		// Set to the number of profiles listed  (31 max allowed)




In my .tmc file, I have 2 functions in main() that set it all up.

Code
	pro_CallCustomConfigs();
	setLEDbyBinary(&Throttle, pro_ProfileSelection);


pro_CallCustomConfigs() is the important one. It determines what the current profile is, and calls the proper function to configure the Warthog for the chosen locomotive.

setLEDbyBinary() is used to set the Warthog LEDs to a binary code so you know what profile is currently selected, but this is optional. In my full script, I also use a Windows command line beep.exe program to give audible feedback when changing profiles. But I removed all that from the examples here.

In pro_CallCustomConfigs(), the first thing I do is call CommonConfig(), which does all the common or default key and axis setup. Then in pro_CallCustomConfigs, I use if statements to call the proper configuration function for the current chosen profile. Here is that code:

Code
	if      (pro_ProfileSelection == pro_SD40GP38)	pro_ConfigureSD40GP38();
	else if (pro_ProfileSelection == pro_AC4400CW)	pro_ConfigureAC4400CW();


The variable, pro_ProfileSelection, stores the value of the currently selected profile (e.g. 1, 2, 3). To make it more readable, I assign define statements (e.g. pro_SD40GP38 = 1 and pro_AC4400CW = 2) in the .ttm file. You can choose the default profile when you first run the script by setting pro_ProfileSelection = to your preferred default, which I have done in my example above.

Each if statement calls a specific function for a specific locomotive (e.g. pro_ConfigureSD40GP38() or pro_ConfigureAC4400CW()). You can then add any new commands (MapKey, MapAxis, KeyAxis, etc.) to these specific pro_Configure....() functions. There is no need to reconfigure everything in the locomotive specific functions when you change profiles. Just the configuration that is different for that locomotive or aircraft, etc. All the rest, which is common to all locomotives, is configured once in CommonConfig().

The last thing to point out is in CommonConfig(), I have the following:

Code
	
//  Landing Gear Horn Silence Button    
	MapKeyIO(&Throttle, LDGH, 
		EXEC("pro_RotateProfile();"),   // (Map MSP + LDGH to call pro_RotateProfile() and change to next profile)
		AWS_Reset               // Otherwise, LDGH does AWS_Reset button press
	);
	


For the Warthog LDGH button, if we press LDGH alone, the script does the AWS_Reset key press for TSW. But in the shifted state (MSP + LDGH pressed), we execute the pro_RotateProfile() function. Each time you press MSP + LDGH, pro_RotateProfile() will cycle through the profiles in a round robin fashion. In my example here, I only have 2 profiles, but you could have as many profiles as you want. After changing the profile to the next profile, pro_RotateProfile() calls pro_CallCustomConfigs() again, which executes the common configuration as well as the profile function specific to our currently chosen locomotive.

I also print text to the TARGET script editor window to say what profile has been selected. So if you can alt-tab out of your game, you can see the text. Or you can use the changing LED pattern to know what is selected. Or the beep functions I mentioned. You could get even more complex and use different key combos to select different profiles, or group aircraft together and use one shifted key combo for helicopters, and another for fixed wing as configuration for these two aircraft types might differ, but be very similar for each group.

Again, it all starts with using EXEC() to call a function which then remaps all the buttons and axes as needed. But you'll have to re-arrange things to fit your needs as there is no one template that can do it all.


It is hard to tell how much of this is obvious vs confusing, so I have tried to give a simple example and explain it. You don't need to understand C programming very well to use this, so hopefully I have explained it well enough. Don't hesitate to ask questions.

The ideal way to do this would be if we could ask TARGET to simply recompile a different script, but sadly that isn't possible. That is why I added the beeps. The audible feedback allows me to quickly "beep" my way through nearly 2 dozen locomotives to find the one I want to use. In my case, the beeps just increase in tone as I click MSP+LDGH, but you could use a variety of different tones to help you count your way to the correct profile.

#4506215 - 02/05/20 09:16 AM Re: Several DCS Profiles in One [Re: Drakoz]  
Joined: May 2001
Posts: 468
Joao Muas Offline
Member
Joao Muas  Offline
Member

Joined: May 2001
Posts: 468
Portugal
This is very interesting...

I have 20 plus profiles each for a different aircraft to fly IL-2 BOX, and I have to stop the running script and load a new one every time I want to fly a different aircraft, which is a bit annoying as I fly mostly multiplayer.

In the IL-2 series, most commands are common for all aircraft, but there are some which are specific, mostly due to different engine management requirements.

So it would be great if can could get one script to handle at least the 4 or 5 aircrafts I fly mostly.

I'm on T.16000M so no leds, but I can find another way of announcing the active profiles (an overlay on the display would be the best, but I'd be happy with something simpler).

I will study the code above and check if I'm up to it.

Thank you for bringing this up.

#4506931 - 02/10/20 05:33 PM Re: Several DCS Profiles in One [Re: Joao Muas]  
Joined: May 2001
Posts: 468
Joao Muas Offline
Member
Joao Muas  Offline
Member

Joined: May 2001
Posts: 468
Portugal
This actually works!! And works flawlessly!!

I downloaded Drakoz Train Sim World files and adapted the .tmc to two of my IL-2 BOS aircraft. Success.
The only problem is that I'm on my beloved T.16000M and I don't have leds, so I have to rely on the beeps to announce the profile changes. It's ok.
Now it's just a matter of adding more profiles! One file to load for each online flying session. Close the script editor and forget about it. No more ALT+TAB's...
I did change the beeps tone formula a bit so they are a bit more recognizable. And I need to map the wBeep.exe to send the sound to my headphones, and that's it.

THANK YOU DRAKOZ!! AND THANK YOU ALL!!

#4506952 - 02/10/20 08:59 PM Re: Several DCS Profiles in One [Re: Frederf]  
Joined: Jul 2016
Posts: 61
Drakoz Offline
Junior Member
Drakoz  Offline
Junior Member

Joined: Jul 2016
Posts: 61
Text to Speech and playing Wav files in TARGET...

I just made a bunch of changes to my TSW script regarding profile swapping. But it is too much to explain here. I'll post it to the same Dovetail forum topic linked above soon so anyone interested can use it as a template.

Agreed about the beeps... I plan to change the beeps to play on frequency to match musical notes (do ra mi fa so la ti do) since musical notes are more recognizable and properly spaced. Right now it just increases the sound by a set number of Hz, but sound frequency grows exponentially, not linearly. So for example, A3 is 220Hz, A4 is 440Hz, A5 is 880Hz where C4 is often considered center C on a piano keyboard.

Also last night, I added a text to speech function to the script which will speak the name of the profile when I release the MSP button (my IO Shift key). So what I mean is, I have it set up to use the Warthog MSP and LDGH to cycle through scrips (press and hold MSP and press LDGH multiple times to cycle through the profiles). When I release MSP, it will speak the profile I am on as confirmation. I didn't want it to speak the profile name with each change because the delay is too much - you would be waiting for it to speak a lot of words. So it still depends on the beeps. But you get confirmation you ended up on the correct profile by releasing MSP. Add to that the ability to cycle up or down through the profiles, and it gets much easier to stop on the correct profile, or go back if you over shot.

I haven't posted the updated TSW script yet, but I posted my function for doing text to speech, as well as one for playing WAV files, at the DCS World forums here: (go to posts 12 and 13 for my posts, but the entire thread is interesting):
https://forums.eagle.ru/showthread.php?p=4204376

Off topic:: Joao, I just bought a T.16000M stick and TWCS Throttle. So I can more easily help with TARGET scripts using the T.16000M setup. My TSW script uses both now, but of course the Warthog is still the primary controller. I regreased the metal rails with Nyogel 767A (a thick plastic safe grease) and the TWCS is very smooth now - it has a nice hydraulic like feel. A nice addition to my setup.



Last edited by Drakoz; 02/17/20 08:32 PM.
#4507077 - 02/11/20 04:58 PM Re: Several DCS Profiles in One [Re: Drakoz]  
Joined: May 2001
Posts: 468
Joao Muas Offline
Member
Joao Muas  Offline
Member

Joined: May 2001
Posts: 468
Portugal
Originally Posted by Drakoz
Text to Speech and playing Wav files in TARGET...
I will check this out for sure...

To adjust the beeps to musical notes frequency seems a good idea, but the text to speech voice as annunciator seems even better...

But now I'm having a small problem.
I have this setup on some aircraft profiles:

Somewhere in my .ttm file I have this:
Code
define Interconnect_RPM EXEC("sync_rpm = !sync_rpm;")

...

// INTERCONNECT THROTTLE WITH PROP PITCH 

	int SyncRPM()
	{
		if (sync_rpm) DXAxis(DX_Z_AXIS, -T16000[THR]); // throttle and rpm connected
	}


Then in my .tmc file:
Code
int main()
{

...

//	B14
	MapKeyIO(&T16000, B14, 0, Interconnect_RPM);

...

}
int EventHandle(int type, alias o, int x)
{
	DefaultMapping(&o, x);
	
	if ((&o == &T16000) & (x == THR)) SyncRPM();
}

Now when I change profile within a single .tmc file, the new MapKey, KeyAxis, etc. are loaded, but how about the functions?!? In this example I wanted the function SyncRPM() to be reset to its default value which is "off". Do I have to check the state of the variable sync_rpm? Isn't there an easier way? Because I have a lot of functions like the example above which are specific of a certain configuration, I don't want them to keep working in another profile...

Quote
Off topic:: Joao, I just bought a T.16000M stick and TWCS Throttle. So I can more easily help with TARGET scripts using the T.16000M setup. My TSW script uses both now, but of course the Warthog is still the primary controller. I regreased the metal rails with Nyogel 767A (a thick plastic safe grease) and the TWCS is very smooth now - it has a nice hydraulic like feel. A nice addition to my setup.
I don't have the TWCS, but that Nyogel will that be usefull to lubricate the stick sphere too? It makes a bit of noise that plastic to plastic friction...

#4507145 - 02/11/20 11:43 PM Re: Several DCS Profiles in One [Re: Frederf]  
Joined: May 2001
Posts: 468
Joao Muas Offline
Member
Joao Muas  Offline
Member

Joined: May 2001
Posts: 468
Portugal
Nevermind my post above...
That was easily corrected with sync_rpm = 0 in the common config...

One thing we must be aware when using this single script for multiple profiles following the above method is that when "loading" a new profile the MapKey, KeyAxis, etc definitions are set to the common then overwritten, not cleared and set as if the script was loaded.

What I mean is that if a specific configuration has a MapKey or KeyAxis that doesn't exist on the common or on any other configuration, that definition will prevail on the other configurations.

One solution to overcome this is to have all definitions from all configurations set on the common even if just "zeroed" like MapKeyIO(&T16000, B16, 0, 0); or KeyAxis(&T16000, JOYY, 0, 0);

This way these definitions will be "cleared" and the new loaded configurations will work as they should.

This is also valid for functions like my SyncRPM() example above.

As another example, I have a specific profile where I remapped the throttle lever to a different axis; then I had to add a statement to remap the throttle lever to the default axis in the common section so the other profiles were not affected.

A bit tricky but once the concept is understood everything will work smoothly.


Moderated by  RacerGT 

Quick Search
Recent Articles
Support SimHQ

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


Recent Topics
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
Grumman Wildcat unique landing gear
by Coot. 04/17/24 03:54 PM
Peter Higgs was 94
by Rick_Rawlings. 04/17/24 12:28 AM
Whitey Herzog was 92
by F4UDash4. 04/16/24 04:41 PM
Anyone can tell me what this is?
by NoFlyBoy. 04/16/24 04:10 PM
10 Years ago MV Sewol
by wormfood. 04/15/24 08:25 PM
Copyright 1997-2016, SimHQ Inc. All Rights Reserved.

Powered by UBB.threads™ PHP Forum Software 7.6.0