Jump to content

TARGET - Advanced programming


ivanwfr

Recommended Posts

Thanks again Drakoz...you've gone above and beyond!

 

The tweak you've provided works beautifully in game.

 

I'm yet to read your replies or SimHQ in depth and no doubt I just may have a question or two once I have.

 

Many thanks

dmonds

Link to comment
Share on other sites

  • 1 month later...

How do I switch an Axis (Friction Lever) from MapAxis to a KeyAxis and back? Looking to use the lever as flap axis and in shifted state use it as KeyAxis for operating the landing gear, hook, and kneel functions.


Edited by SGT Coyle

Night Ops in the Harrier

IYAOYAS


 
Link to comment
Share on other sites

Hi @SGT_Coyle,

 

I've not got anything in my script that deals specifically between MapAxis and KeyAxis, however, I do have a routine which can programmatically change the curves of an axis...not quite the same thing.

 

Having said that...As part of the KeyAxis statement you can declare which level the statement takes effect (TARGET Script manual page 31 onwards)

This would tend to indicate you can have different statements for the same axis and dependent on the level (shifted state).

Have you tried using KeyAxis for both your flap axis lever (by sending keystrokes) and your gear/hook/kneel functions?

 

dmonds

Link to comment
Share on other sites

dmonds,

Great find. I've used KeyAxis for this sort of thing, but forgot about IOUMD feature it offers. Thanks for that.

 

 

My question was more fore a way to have a traditional axis behavior assigned to say Flaps axis, and via flags or function call, change that traditional axis to the KeyAxis functionality.

 

 

This is an example (non functional) of a .tmc that Drakos helped me out with for the F14.

 

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

//include "target_NO_TPR_DX128_F18.tmh"
//include "DCS_F-14B_Pilot_Macro.ttm"
//include "DCS_F-14B_RIO_Macro.ttm"
//include "VR.ttm"
//include "Gear_Function.tmh"

//    Variable Inits
int    F14_Gear_State;
int F14_Kneel_Down;

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
   
   //Excluded Devices
   //Configure(&Device name, MODE_EXCLUDED);
   Configure(&HCougar, MODE_EXCLUDED);
   Configure(&T16000, MODE_EXCLUDED);
   Configure(&T16000L, MODE_EXCLUDED);
   Configure(&TWCSThrottle, MODE_EXCLUDED);
   Configure(&TFRPRudder, MODE_EXCLUDED);
   Configure(&Joystick, MODE_EXCLUDED);    //Needed for F18 grip to work better.
   
   SetKBLayout(KB_ENG);                                    // this file designed for English keyboard.
   SetShiftButton(&JoystickF18, S4, &Throttle, 0, 0, 0);        // IO Shift and UMD Setup   

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

   // JoyX, JoyY
   MapAxis(&JoystickF18, JOYX, DX_X_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
   MapAxis(&JoystickF18, 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);
   
   //******************************************************************
       
   printf("----------------------------------\xa");

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

}    // end main()
   

int SetUpPilot()
{

   [b]//MapAxis(&Throttle, THR_FC, DX_SLIDER_AXIS);
   //SetJCurve(&Throttle, THR_FC, 50, 50); 
   KeyAxis(&Throttle, THR_FC, 0, AXMAP2( LIST(0,10,30,60,90,100),                                                        
                                                       EXEC("F14_Gear_Up_State();"),            //    DX35
                                                       EXEC("F14_Launch_Bar_Toggle();"),            //    DX35 & DX36
                                                       EXEC("F14_Gear_Down_State();"),            //    DX34                                                        
                                                       PULSE + Hook_Retract,            //    DX33
                                                       PULSE + Hook_Extend                //    DX32
                                                       ));                                
   
   
   EXEC("DefaultMapping(&Thorttle, THR_FC);" );[/b]
   


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

   
   ActKey(PULSE + KEYON + Occupy_Pilot_Seat);     
   

   
   
       
//////////////////////////////////////////////////////////////////////    
//BUTTON PROGRAMING STARTS BELOW
//////////////////////////////////////////////////////////////////


   
//THROTTLE PROGRAMING



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


////////////*\\\\\\\\\\*//////////*\\\\\\\\\\*//////////*\\\\\\\\\\*//////////*\\\\\\\\\
//\\\\\\\\\\*//////////*\\\\\\\\\\*//////////*\\\\\\\\\\*//////////*\\\\\\\\\\*/////////
int SetUpRIO()
////////////*\\\\\\\\\\*//////////*\\\\\\\\\\*//////////*\\\\\\\\\\*//////////*\\\\\\\\\
//\\\\\\\\\\*//////////*\\\\\\\\\\*//////////*\\\\\\\\\\*//////////*\\\\\\\\\\*/////////
{
   printf("Setting up config for RIO...\xa");
   // LED2 on to indicate RIO mode (LED1 off)
    ActKey(PULSE + KEYON + Occupy_RIO_Seat);


    [b]SetJCurve(&Throttle, THR_FC, 50, 50);
   EXEC("DefaultMapping(&Thorttle, THR_FC);" );[/b]


//Left Throttle Button
MapKey(&Throttle, LTB, EXEC( "SetUpPilot();"));
   
}

int    F14_Launch_Bar_Toggle()    {
                       if (F14_Gear_State>0) {
                           ActKey(PULSE + KEYON + Nose_strut_kneel);
                           //DeferCall( 1000, &ActKey, Launch_Bar_Control_Switch_EXTEND_RETRACT);
                           F14_Kneel_Down = 1;
                           
                       }
                       else if (F14_Gear_State < 1)    {
                               ActKey(PULSE + KEYON + 0);
                       }
                   }    
                       
int F14_Gear_Up_State()        {
                       ActKey( PULSE + KEYON + Gears_Up);
                       F14_Gear_State = 0;
                       F14_Kneel_Down = 0;
                       }

int F14_Gear_Down_State()    {
                       ActKey(PULSE + KEYON + Gears_Down);
                       F14_Gear_State = 1;
                       }
                       
                       
       
           
int F14_Cat_Hookup()        {
                       if (F14_Kneel_Down >0) {
                           ActKey(PULSE + KEYON + Catapult_Hook_Up);
                           F14_Kneel_Down = 0;
                           
                       }
                       else if (F14_Kneel_Down < 1)    {
                               ActKey(PULSE + KEYON + 0);
                       }    

}                        




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

 

There are probably many things wrong with it at this stage, but I thought it might illustrate the problem.

There are 2 modes of the script: Mode1 = Pilot settings

Mode 2= RIO settings

Modes are switched via the Left Throttle Button.

In the Pilot settings I want to have the landing gear, hook and kneel operations on the Friction Lever as KeyAxis, and also the Flap axis that is not available via keyboard binding (there is Flap_UP and Flap_Down, but those aren't working as axis control, just full up and full down). So my desire is to move from KeyAxis to MapAxis control on the fly.

...And of course I'd like to do the same sort of thing for the RIO settings.

 

 

 

I hope that makes sense.

Any help or insights would be appreciated.

Night Ops in the Harrier

IYAOYAS


 
Link to comment
Share on other sites

How do I switch an Axis (Friction Lever) from MapAxis to a KeyAxis and back? Looking to use the lever as flap axis and in shifted state use it as KeyAxis for operating the landing gear, hook, and kneel functions.

 

When you change to MapAxis(), you need to "unmap" the KeyAxis(). When you change to KeyAxis(), you need to unmap the MapAxis().

 

I did an experiment on this and I think I remember that I was able to unmap the MapAxis() or KeyAxis() by just zeroing out the actions as follows:

 

KeyAxis(&Throttle, THR_FC, 0, 0);

or

MapAxis(&Throttle, THR_FC, 0);

 

So just add these unmap commands to your functions, and you should have it working as you want.

Link to comment
Share on other sites

Hi

When I run first time my configuration I see.... "launching and running profile" with the little spinner spinning away for almost an 20 min... (I did not waiting more) The instructions do say it may take "some time" the first time a profile is run, but this seems excessive? ??????????????

What reason ?

730083137_Launchingandrunningprofile.JPG.2228430988f3ed4dc38c20ff49817179.JPG


Edited by SMN

Окурок, выброшенный в урну, гораздо патриотичнее флажочка на автомобиле

TM Wartrhog Stick + VPC MongoosT-50Base + VPC TMW Extension 150mm / TM Wartrhog Throttle / CH Pro Pedals / 2-VPC Deck Mount / TrackIR5/

__________________________________________________________

i5-10600K Over to 5.0MHz/32GbDD4-3200/RTX4070/System-SSD1 DCS-SSD2/32" 2560x1440

Link to comment
Share on other sites

But, you might have a corrupted install. Maybe uninstall/reinstall GUI and try again.

I uninstalled/reinstalled GUI- same!

Окурок, выброшенный в урну, гораздо патриотичнее флажочка на автомобиле

TM Wartrhog Stick + VPC MongoosT-50Base + VPC TMW Extension 150mm / TM Wartrhog Throttle / CH Pro Pedals / 2-VPC Deck Mount / TrackIR5/

__________________________________________________________

i5-10600K Over to 5.0MHz/32GbDD4-3200/RTX4070/System-SSD1 DCS-SSD2/32" 2560x1440

Link to comment
Share on other sites

I uninstalled/reinstalled GUI- same!

 

boot up without your controllers connected, and then connect once your pc is up and running.

 

I have all my thrustmaster stuff connected to a hub that i only turn on once the pc have booted. Otherwise target sometimes get stuck or doesnt remove the physical devices once the virtual one has been created.

[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

boot up without your controllers connected, and then connect once your pc is up and running.

 

 

 

I have all my thrustmaster stuff connected to a hub that i only turn on once the pc have booted. Otherwise target sometimes get stuck or doesnt remove the physical devices once the virtual one has been created.

 

 

 

Same here

🖥️ R7-5800X3D 64GB RTX-4090 LG-38GN950  🥽  Valve Index 🕹️ VPForce Rhino FFB, Virpil F-14 (VFX) Grip, Virpil Alpha Grip, Virpil CM3 Throttle + Control Panel 2, Winwing Orion (Skywalker) Pedals, Razer Tartarus V2 💺SpeedMaster Flight Seat, JetSeat

CVW-17_Profile_Background_VF-103.png

Link to comment
Share on other sites

Hi

When I run first time my configuration I see.... "launching and running profile" with the little spinner spinning away for almost an 20 min... (I did not waiting more) The instructions do say it may take "some time" the first time a profile is run, but this seems excessive? ??????????????

What reason ?

I have that when there is some - quasi? - memory corruption, in particular when I had Firefox open with a lot (40+) of tabs and in particular Youtube's open.

Just crash programs 1 by 1 in task manager and see which one is the culprit? Could also be Target itself is not behaving and claiming addresses it's not supposed.

| 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

It found your throttle, but not your joystick.

This can happen if you’ve not loaded the drivers yet (or properly) or if your USB ports are playing up.

 

As Sgt Coyle said, it may be a corrupted install if Windows is trying to enumerate a USB device it cannot find, or is having issues with.

Link to comment
Share on other sites

BTW my batch file loading my progs for DCS simming also loads Windows Device manager, Windows Games devices and a util that shows the JoyID of loaded USB devices (and Rift and more).

 

This checks beforehand if everything is OK to run DCS, every time, which is quite necessary (I have another batch that kills them al).

| 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

It found your throttle, but not your joystick.

.

- I have only throttle Warthog!

- TARGET see my Throttle Warthog, assigning parameters - OK

- Run my configuration and....see - "launching and running profile", I wrote above :(

- Without waiting for the end of this process I start DCS FA-18

- DCS see my "TARGET virtual Throttle" in DCS and my assigned parameters

- I can fly.. BUT... in some time, the buttons and switches on throttle stop working normally. Only axes work! And my keyboard stops working !!!

 

I have 32 Gb DRAM (I do not have any problem with my PC !)

My Throttle Warthog connected to the PC directly without any hub!

 

Without TARGER - all OK in DCS

 

P,S

Such an impression that something did not fully boot.... "launching and running profile" continues to be in boot mode ...

I try run another parameters - same..

 

See attached video


Edited by SMN

Окурок, выброшенный в урну, гораздо патриотичнее флажочка на автомобиле

TM Wartrhog Stick + VPC MongoosT-50Base + VPC TMW Extension 150mm / TM Wartrhog Throttle / CH Pro Pedals / 2-VPC Deck Mount / TrackIR5/

__________________________________________________________

i5-10600K Over to 5.0MHz/32GbDD4-3200/RTX4070/System-SSD1 DCS-SSD2/32" 2560x1440

Link to comment
Share on other sites

Hi

I see.... "launching and running profile" with the little spinner spinning

 

Unless I'm mistaken, this is normal...it is running your profile.

 

The console message "main returned 0" is the indicator everything loaded and there were no errors. At this point it's waiting for input.

 

dmonds

Link to comment
Share on other sites

Unless I'm mistaken, this is normal...it is running your profile.The console message "main returned 0" is the indicator everything loaded and there were no errors. At this point it's waiting for input.

dmonds

Hmm.....:thumbup:

Maybe this is normal. I found in the manual, the picture is similar to what I have

Resume:

- This indication start TARGET - is NORMAL

- My problem with abnormal control... uncorrect was assigned conficutation option for speed brake !!

Now all OK !!

Sorry for my question :(

manual.thumb.JPG.08c737ddc713e5a57703ebd4cb9c31d7.JPG


Edited by SMN

Окурок, выброшенный в урну, гораздо патриотичнее флажочка на автомобиле

TM Wartrhog Stick + VPC MongoosT-50Base + VPC TMW Extension 150mm / TM Wartrhog Throttle / CH Pro Pedals / 2-VPC Deck Mount / TrackIR5/

__________________________________________________________

i5-10600K Over to 5.0MHz/32GbDD4-3200/RTX4070/System-SSD1 DCS-SSD2/32" 2560x1440

Link to comment
Share on other sites

  • 1 month later...

Hi,

 

I have a Warthog Throttle and Stick and use TARGET script to combine them into one controller.

 

I want to use the Paddle switch on the joystick - S4 - and the Mic switch Left - MSL - on the throttle temporary IO shift buttons.

 

This works better ergonomically as you can use one finger for shifting and the other hand for button selection on the opposite controller.

 

I have tried the following with no success.

 

SetShiftButton(&Joystick, S4,0,0,0,0);
SetShiftButton(&Throttle, MSL,0,0,0,0);
MapKeyIO(&Joystick, S1, L_SHIFT+ 'b', 'a');
MapKeyIO(&Throttle, CSU, L_SHIFT+ 'e', 'd’);

Link to comment
Share on other sites

Hi,

 

I have a Warthog Throttle and Stick and use TARGET script to combine them into one controller.

 

I want to use the Paddle switch on the joystick - S4 - and the Mic switch Left - MSL - on the throttle temporary IO shift buttons.

 

This works better ergonomically as you can use one finger for shifting and the other hand for button selection on the opposite controller.

 

I have tried the following with no success.

 

SetShiftButton(&Joystick, S4,0,0,0,0);
SetShiftButton(&Throttle, MSL,0,0,0,0);
MapKeyIO(&Joystick, S1, L_SHIFT+ 'b', 'a');
MapKeyIO(&Throttle, CSU, L_SHIFT+ 'e', 'd’);

 

 

Starting on page 21 in the manual, Layers.

 

 

Try

SetShiftButton(&Joystick,S4, &Throttle, MSL, 0, 0)

The "SetShiftButton" function is only used once to setup your IO and Layer buttons.

Night Ops in the Harrier

IYAOYAS


 
Link to comment
Share on other sites

Starting on page 21 in the manual, Layers.

 

 

Try

SetShiftButton(&Joystick,S4, &Throttle, MSL, 0, 0)

The "SetShiftButton" function is only used once to setup your IO and Layer buttons.

 

Yes I have read the entire manual but that section does not say you can only use SetShiftButton once.

 

So are you saying I will have to use the IO layer and the U layer to achieve two shift buttons ?

Link to comment
Share on other sites

Yes I have read the entire manual but that section does not say you can only use SetShiftButton once.

 

So are you saying I will have to use the IO layer and the U layer to achieve two shift buttons ?

I use the same kind of code as the poster above

 

SetShiftButton(&Joystick,S4,&Throttle,MSP);

 

for only IO

| 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

Hi @speedbird5,

 

Check the syntax...I think you have too many zeros...plus...

You cannot declare IO button twice using your method as the second call overrides the first.

 

Hope this helps.

 

Dmonds

 

Thanks,

 

This seems to be the information I was missing. The documentation does not say you cannot declare it twice. Is it just me but I think the Fast Script guide is very light on detail.

 

Is there a more detailed script guide ?

 

So just to confirm, I will have to use the IO layer plus one of either U or D layers to have two shift buttons.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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