Jump to content

TARGET - Advanced programming


ivanwfr

Recommended Posts

  • 1 year later...

Just one simple question to the devs out there from ED and Thrustmaster:

 

Does it need to be THAT complicated these days ?

 

I mean, the F-16 TQS and F-22 Stick had about the same amount of axis and buttons and programming them, even complex things, was so much more straight forward. Some liked Foxy, I liked Notepad. With Either one it was way more straight forward.

 

Is it DCS or DX that stirred this whole soup up ?

 

I know there wont be a a cure anytime soon, I just wanted to express my non-understanding of why this has been made in a way that you need to study the stick more than the corresponding DCS modules to get a working Airbrake the way it is supposed to work.

 

 

I am for a complete redo of this handling.

 

Make it simpler, make it user friendly and dont make us coders :)

 

 

Bit

Gigabyte Aorus X570S Master - Ryzen 5900X - Gskill 64GB 3200/CL14@3600/CL14 - Asus 1080ti EK-waterblock - 4x Samsung 980Pro 1TB - 1x Samsung 870 Evo 1TB - 1x SanDisc 120GB SSD - Heatkiller IV - MoRa3-360LT@9x120mm Noctua F12 - Corsair AXi-1200 - TiR5-Pro - Warthog Hotas - Saitek Combat Pedals - Asus PG278Q 27" QHD Gsync 144Hz - Corsair K70 RGB Pro - Win11 Pro/Linux - Phanteks Evolv-X 

Link to comment
Share on other sites

You can do without, relying on in-game handling. The same goes with planes, most could fly with less buttons on their dashboard, why bother?

 

Learning a programming language is all about getting more control by choosing a high-end alternative. As a programmer, I don't use Notepad to do my job, TARGET and this pricey device deserve Emacs or Vim and a minimum skill requirement to boot.

 

Now, non-programmers have two options, either give up or learn how it works, first is easy, second needs some work.

 

DCS matter is not about those things anyone can do with no effort but I still have a hard time to understand why so many are ready to spend hundreds of hours on hardware and so few at mastering the software that obviously goes with it.

 

Most comments about TARGET have to do with its very existence, many complaints and so few questions.

 

But if you are looking for a cure instead of a way to proceed, your HOTAS's best place is on eBay.

 

-ivan

Link to comment
Share on other sites

ivan,

I couldn't disagree more. there is always the GUI version that people (novices) can use with the point-n-click approach. But BitMaster point is - It was SIMPLER. TM went backwards and made it more complicated. We can wax poetic about vi (clearly superior to emacs, but I digress) but that ship has sailed. In 2015, you should *not* need to know a line of code to get the most out of Warthog.

 

I'll prove it to you. What do you code? Do you use eclipse? Visual studio? Visual XYZ? One could ask the same question, why bother when you can use vi to start coding from *scratch*. Because it's nicer to have a nice IDE. So while I agree with you in spirit, I would fall back to "It's easy to make things hard, it's very hard to make things easy"

 

hsb

 

 

 

I highly

hsb

HW Spec in Spoiler

---

 

i7-10700K Direct-To-Die/OC'ed to 5.1GHz, MSI Z490 MB, 32GB DDR4 3200MHz, EVGA 2080 Ti FTW3, NVMe+SSD, Win 10 x64 Pro, MFG, Warthog, TM MFDs, Komodo Huey set, Rverbe G1

 

Link to comment
Share on other sites

Your points only make me think we're not talking about the same skill level! If you take the time to understand what is attached in my first post, you will see there is no way to do it with any kind of user friendly wrapper. This kind of "opinion" can make some sense only if you keep as far as possible from any effective custom code.

 

I did not start this thread to gossip about what could have been. This is about real hard job that works. It was not easy and I don't like TARGET any more than some others who have done some real work with it. I know that TM tried their best to access the many features of its device ... no way it could be simple ... and they could have done it better ... and I'm also sure they know that.

 

Well, I worked with it and I got every single customization I could think of working as I wanted. If some are not happy with TARGET, I'm not on the list.

 

 

 

And when you want to prove me something about how nice it is using an IDE, I know we're not on the same page...

 

I will NEVER use and IDE like Visual Studio or even Eclipse to get serious job done. I will always use Vim and a few hundreds of custom macros I use to tune up since I started with ed and then vi back in the 80s. I need to own the day, every day, and I can say I do since then.

 

Even with SharePoint ;) , I feed VS running in a VM from gvim running on the host. I do my job, VisualStudio does the plumbing. It knows how to deploy things to keep IIS happy and I don't care to understand how that kind of "works".

 

And I have hundreds of reasons to explain why (even though I used to teach how to work with some IDEs when requested).

 

First reason is that they tend to make users think they are mastering their subject, when they should realize that the tool is tutoring them. They don't even have to understand majors steps (how to do a good job with syntax,compiler,linker,loader,threads,...) leaving all the real work into the "hands" of some default development tool ... and it works! because MS and co. makes sure it does, they even get you certified to make an incentive so you're hooked for the long term.

 

My job is quite about what others don't do, too late to change that...

 

Look here for something no IDE will ever care about:

... http://ivanwfr.github.io/Twiddler3-Layout/

I googled in vain, looking for any forum, no luck, I'm currently alone on the subject. Once again, my own way to look at things would get me a hard time if I was looking for some consensus ;)

Link to comment
Share on other sites

2 mouse cursors.. a problem!

 

Hello Ivan.

 

I'm not sure if this has already been issued... but when I code my POV for mouse it uses a second mouse cursor. The cursor is halfly shared with what the normal physical mouse is using.

 

When I use the mouse coded POV, it uses it's own coordinates.

When I use my physical mouse it continues where the POV mouse left off.

Then when I use my POV again, it teleports it's cursor to where the POV one left before I used my normal mouse.

 

And in Star Citizen (the game), this 2 cursors creates a conflict.

The game flips when I touch the POV. It goes in search of the second mouse cursor position and this time it is defined as 'out of the screen' , and nog matter how hard I trie, the mouse cursor will never enter the screen. Even when I 'center' the cursor with the centering command.

 

Even my code to center the cursor to the middle of the screen makes the game freak.

In the menu, it DOEs center the cursor, but in FPS mode or flightmode, the cursor get's transported to outside the screen and character instantly looks at his feet, and the ship starts spinning like crazy. Centering does not solve this.

 

 

Is there a code that makes both POV cursor and mouse cursor one? Instead of 50% the same?

 

The code I am currently using (with help from a lot of people including you) is:

 

before main:

int set_mouse_cursor_speed (short speed)
{
MapKey(&T16000, H1U, AXIS(MOUSE_Y_AXIS, -100, speed));
MapKey(&T16000, H1D, AXIS(MOUSE_Y_AXIS, 100, speed));
MapKey(&T16000, H1L, AXIS(MOUSE_X_AXIS, -100, speed));
MapKey(&T16000, H1R, AXIS(MOUSE_X_AXIS, 100, speed));
}

in main:

 

set_mouse_cursor_speed (23); //too slow? make number smaller both here, and below in code right stick! But i.c.w. the stick movement itself it's speedy enough I think.. 

MapKeyR  (&T16001, TS2, EXEC("set_mouse_cursor_speed(23);" )); //here we get slow mouse cursor again, let go right button (time it well in battle) then tap POV again for mousing, cause it stops mousing when letting go of TS2
MapKey   (&T16001, TS2, EXEC("set_mouse_cursor_speed(7);"));  // here comes fast mouse cursor, use with care...see // slow mouse
MapKey   (&T16001, TS3, EXEC(
"DXAxis(MOUSE_X_AXIS, 0);"
"DXAxis(MOUSE_Y_AXIS, 0);"
));  // center mouse cursor to middle screen

The mouse also stops moving if I let go of the TS2 (the release function). The POV needs to be re-pushed, to get the cursor moving again.

Is there also a way to let the mouse continue moving without having to re-push the POV?

 

Thanks for looking into it.


Edited by Solbeamer
typo
Link to comment
Share on other sites

Hi Solbeamer, I will definitely have a look but I'll have to rewind my brain to the time when it still made sense to me... (not much involved anymore). But as I also care about SC, I will have to face this issue eventually but it wont be before a few days.

 

In the meantime, all I can say is that this cursor thing is very messy in many games and here, we have TARGET to make it worse.

 

Maybe you could call AutoHotkey to the rescue to center the pointer with something like this:

 

^+!Delete:: MouseMove, 100,100 ; ... Ctrl-Shift-Alt-Delete


Edited by ivanwfr
Link to comment
Share on other sites

Thanks for being here. You know your T.A.R.G.E.T. :)

 

I will look into Autohotkey. (not familiar with that)

 

I already got some code that works in the script editor. But I lack the skills to test them good in swarm/dogfight. The Vanduul aliens are fingerpainting my cockpit the whole time. They don't care for us testing buttons, lol.

 

This stuff I wrote (kinda proud of it :) ) is for 2 T16000M joysticks.

 

include "target.tmh"
// include "CaptSolbeamer_v1.0.ttm"...define stuff that does not exist :)
//this code gives you thrust/brake on the LEFT stick, and stearing on the RIGHT

alias T16001; // second T16000 handle, which will be used all mapping commands
alias T16A; // for handy switching purposes only
alias T16B; // same here
define switchthem 1 // make 0/1 if left=right



int main()
{

Configure(&HCougar, MODE_EXCLUDED);
Configure(&Joystick, MODE_EXCLUDED);
Configure(&Throttle, MODE_EXCLUDED);
Configure(&LMFD, MODE_EXCLUDED);
Configure(&RMFD, MODE_EXCLUDED);

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

&T16001 = GetIndexJoy (SelectUsbDevice ("VID_044F&PID_B10A")); //pc expects a joystick on this adress


if (switchthem)

{
&T16A = &T16000;
&T16B = &T16001;

&T16000 = &T16B;
&T16001 = &T16A;
}
// this was about making the left one right and vice...




///////////////////////
//The Axis:


//Left stick axis
//thrust/backw, rolling and up/down (deadzones at 14%)


KeyAxis (&T16000, JOYY,   0,  AXMAP2 (LIST (0, 43, 57, 100), 'w', 0, 's'));  // forward/backward 
KeyAxis (&T16000, JOYX,   0,  AXMAP2 (LIST (0, 43, 57, 100), 'q', 0, 'e'));  //Strafe left/right
KeyAxis (&T16000, RUDDER, 0,  AXMAP2 (LIST (0, 43, 57, 100), 'f', 0, 'r')); // Strafe Down/Up 


//Right stick axis
//yaw and pitch and : 

MapAxis (&T16001, JOYY, DX_Y_AXIS);            //pitch
KeyAxis (&T16001, JOYX, 0, AXMAP2 (LIST (0, 43, 57, 100), 'a', 0, 'd')); // roll
MapAxis (&T16001, RUDDER, DX_X_AXIS);          //yaw
SetSCurve (&T16001, JOYY,   0, 6, 0, 4, 0);   // deadzone first number,   
SetSCurve (&T16001, RUDDER, 0, 12, 0, 4, 0);   // 2nd = sensitivy (range -20/20)



////////////////
// left stick..


MapKey  (&T16000, TS1, MOUSE_LEFT);       // fire w1
MapKey  (&T16000, TS2, USB[0x2C]) ;       // Spacebar = brake
MapKey   (&T16000, TS3, TEMPO ( CHAIN (USB[0xE6], 'm'), CHAIN (USB[0x2B],  USB[0xE0]) , 850 )  ); // RALT(=R_MENU)+M/ TAB+LCTRL =Look ahead, or  after 0,8 pushdown sec Head Look
MapKey  (&T16000, TS4, USB [0xE2] );      // Gimball locked (L_ALT=L_MENU)

MapKey  (&T16000, H1U, TEMPO ('u', 'g', 850 ) ) ;    // PIN, CYCLE PINNED
//MapKey  (&T16000, H1D,                  // Second Reticle Speed...soon implemented by CIG I hope
MapKey  (&T16000, H1L, L_CTL+CAPS);       //'CTRL+CAPS' = g-safe
MapKey  (&T16000, H1R, USB[0x39]);        //'CAPS' = decouple


//The buttons left stick:

// 11,12,13  7,6,5
//         []
// 16,15,14  8,9,10

MapKey (&T16000, B11, '1');       // power to group 1
MapKey (&T16000, B12, '2');       // Power to group 2
MapKey (&T16000, B13, '3');       // power to group 3

MapKey (&T16000, B16, '0');       // equalize powergrid
MapKey (&T16000, B15, USB[0x5D]); // equalize shield powergrid (nump 5)
MapKey (&T16000, B14, '.');       // Camera Looks behind me


MapKey (&T16000, B7, USB[0x4A]);  // focus HUD 
MapKey (&T16000, B6, USB[0x52]);  // arrow UP
MapKey (&T16000, B5, USB[0x28]);  // Interact with HUD (ENTER)

MapKey (&T16000, B8,  USB[0x50]); // arrow LEFT
MapKey (&T16000, B9,  USB[0x51]); // arrow DOWN
MapKey (&T16000, B10, USB[0x4F]); // arrow RIGHT


//////////////////////////
//////////////////////////


//Right stick 

//rightstick POV:

//U,D,L,R, bind ingame for ship follows reticle 
MapKey  (&T16001, H1U, '8');  // Aim up
MapKey  (&T16001, H1D, '9');  // Aim down  
MapKey  (&T16001, H1L, '6');  // Aim left
MapKey  (&T16001, H1R, '7');  // Aim right


MapKey  (&T16001, TS1, MOUSE_RIGHT );   // Fire w2
MapKey  (&T16001, TS2, TEMPO (MOUSE_CENTER, 'z' , 850) ); //Mousewheel (missile) / FLARE
MapKey  (&T16001, TS3, DX3);            // weapon 3 = mouse4 button
MapKey  (&T16001, TS4, 'x' );           // Cycle cm. (and missile cycle in future by tempo) 



/// 5,6,7  13,12,11
///      []
///10,9,8  14,15,16

//shield stuff
MapKey (&T16001, B5, USB[0x5F]);   // nump7
MapKey (&T16001, B6, USB[0x60]);   // nump8
MapKey (&T16001, B7, USB[0x61]);   // nump9


MapKey (&T16001, B10, USB[0x5C]);  // nump4
MapKey (&T16001, B9,  USB[0x5A]);  // nump2
MapKey (&T16001, B8,  USB[0x5E]);  // nump6


MapKey (&T16001, B13, ',');        // zoom radar
MapKey (&T16001, B12, 'o');        // toggle lights or ninja/mode
MapKey (&T16001, B11, 't');        // Cycle (find) all enemies


MapKey (&T16001, B14, 'k');        // cycle radar backw 
MapKey (&T16001, B15, 'j');        // cycle radar forward
MapKey (&T16001, B16, R_ALT +'l'); // Ejectos (USB[0xE6]) (R_ALT=R_MENU)

//doubletap bind ingame or with combining it with [ENTER] (B5 left sstick)
//to go to camera view. B5, B7, B10 and B8 = top, bottom, left and right camera then 

}

//event handler
int EventHandle(int type, alias o, int x)
{
DefaultMapping(&o, x);

//add event handling code here
}

And this is what it should do:

nieuw%203.0_zpsalsjldua.jpg


Edited by Solbeamer
Link to comment
Share on other sites

Don't forget to apply the following..

...the hat-problem!

TARGET not finding it that is. It's a typo in the file TARGET itself makes.

 

Solution:

 

thanks to KrakkenSmacken (on the SC forum) for this:

 

:

To find the second hat in T.A.R.G.E.T, you need to go deep.

 

To set it up you have to relalize that the second stick is on Alias, (&T16001)

 

Because of this, the hat code on line 258 of the target.tmh file misses the check.

 

else if(&dev == &T16000)

edit it to this:

 

else if(&dev == &T16000 | &dev == &T16001)

Cheers

 

[end quote]

------

 

You will end up with this file:

http://www.speedyshare.com/cmZZT/target.tmh

:)

 

Sol (on a general note for other readers):

If saving this file (in case my link stops working) is a problem (you can just copy-paste by selecting the whole stuff in TARGET and then CTRL+C the lot) and give a new file the same name),

You can use the file in this zip.

 

It has a different solution. (it completely kills the 'else'-stuff altogeter), but it has the same result. It works!

 

You need to put this new target.tmh file in the same folder as your homebrew file. TARGET will not make it's own typo'ed file, and our file will give us the second HAT.

 

*note ... I don't know if Thrustmaster updated the program and fixed this.

I emailed them with the above solution, but I dare not uninstall, and re-install TARGET. Maybe they fixed this, but screwed up other stuff. :P

Better fight the demons you know.. :)


Edited by Solbeamer
Link to comment
Share on other sites

Solbeamer,

I think I found your escape route ... have a look into the target.tmh file you have already patched ... line 192 reads:

 

[size="6"]PlugMouse([b][color="Blue"]1[/color][/b]);[/size]

And that's absolute pointer coordinate mode, as you can see in the comment a few lines above.

 

You should set an argument of 0 to have the relative pointer behavior you need:

[size="6"]PlugMouse([b][color="Red"]0[/color][/b]);[/size]

 

As I use SetCurve() with the virtual mouse, I did not test the AXIS(DirectX axis name, increment, delay before repeat); version in my code, I'll let you check this patch and wait your feedback to know how it goes.

 

In any case, the relative mode is quite messy with SetCurve... If it works with AXIS(), I will also use it for Star Citizen.

 

-ivan

Link to comment
Share on other sites

Alright; I tested it.

This code gave a workable test:

 

include "target.tmh"

//mouse test file

 

alias T16001; // second T16000 handle, which will be used all mapping commands

alias T16A; // for handy switching purposes only

alias T16B; // same here

define switchthem 1 // make 0/1 if left=right

 

 

int set_mouse_cursor_speed (short speed)

{

MapKey(&T16001, H1U, AXIS(MOUSE_Y_AXIS, -1, speed));

MapKey(&T16001, H1D, AXIS(MOUSE_Y_AXIS, 1, speed));

MapKey(&T16001, H1L, AXIS(MOUSE_X_AXIS, -1, speed));

MapKey(&T16001, H1R, AXIS(MOUSE_X_AXIS, 1, speed));

 

//MapAxis(&T16001, H1U, MOUSE_Y_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);

//MapAxis(&T16001, H1D, MOUSE_Y_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);

//MapAxis(&T16001, H1L, MOUSE_X_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);

//MapAxis(&T16001, H1R, MOUSE_X_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);

 

MapAxis(&T16001, H1U, MOUSE_Y_AXIS, AXIS_NORMAL, MAP_RELATIVE);

MapAxis(&T16001, H1D, MOUSE_Y_AXIS, AXIS_NORMAL, MAP_RELATIVE);

MapAxis(&T16001, H1L, MOUSE_X_AXIS, AXIS_NORMAL, MAP_RELATIVE);

MapAxis(&T16001, H1R, MOUSE_X_AXIS, AXIS_NORMAL, MAP_RELATIVE);

 

}

 

 

int main()

{

 

Configure(&HCougar, MODE_EXCLUDED);

Configure(&Joystick, MODE_EXCLUDED);

Configure(&Throttle, MODE_EXCLUDED);

Configure(&LMFD, MODE_EXCLUDED);

Configure(&RMFD, MODE_EXCLUDED);

 

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

 

&T16001 = GetIndexJoy (SelectUsbDevice ("VID_044F&PID_B10A")); //pc expects a joystick on this adress

 

 

if (switchthem)

 

{

&T16A = &T16000;

&T16B = &T16001;

 

&T16000 = &T16B;

&T16001 = &T16A;

}

// this was about making the left one right and vice...

 

 

set_mouse_cursor_speed (60); //too slow? make number smaller both here, and below in code right stick! But i.c.w. the stick movement itself it's speedy enough I think..

 

/////// right stick

// working with mouse speed

 

MapKeyR (&T16000, TS2, EXEC("set_mouse_cursor_speed(60);" )); //here we get slow mouse cursor again

MapKey (&T16000, TS2, EXEC("set_mouse_cursor_speed(20);")); // here comes faster mouse cursor

MapKey (&T16000, TS3, EXEC(

"DXAxis(MOUSE_X_AXIS, 0);"

"DXAxis(MOUSE_Y_AXIS, 0);"

)); // center mouse cursor to middle screen

 

 

 

 

 

 

 

}

 

//event handler

int EventHandle(int type, alias o, int x)

{

DefaultMapping(&o, x);

 

//add event handling code here

}


Edited by Solbeamer
Link to comment
Share on other sites

My old code (speed at 23, and axis at -100 and 100) gave me a cursor that runs away it instand speed.

With this code all got slowed down so I could see what was going on with the cursor.

 

It seems we cured one problem, and created another.

 

The mouse and TARGET coded mouse are now linked :)

So that is good.

However.... we now got a funny mouse cursor :):

When I keep it pushed it looks like it keeps adding up the pixels it should skip. It also skips way more then one pixel.

Then when I go the other way with the cursor; instead of going the other way right away, it first subtracts values untill the cursor is dead in the screen, and only then does it start to go the other way.

It does these things even faster if you don't keep it pushed down, but 'click' it all the time. (the POV button)

 

I tried coding the axis to both ABSOLUTE and RELATIVE, but they seem to do the same stuff.

So we got adding and subtracting of values when determining our mouse position now.

 

I haven't checked it in SC yet. The jumps it makes are too big.

We first have to fix that adding and subtracting I think. And making a pixel jump a pixel jump, and not 50k pixels :)

 

But the mouses are linked. So that's good :)

Link to comment
Share on other sites

I am looking at page 29/60 now of the script manual.

Going to see if I can trick the axis going into CURRENT mode and forgetting the last calculations... If I succeed I will have reached another level, :D

 

Feel free to post if you beat me to it. :)


Edited by Solbeamer
Link to comment
Share on other sites

interesting...

I find that pushing TS3 will let TARGET forget all about the calculation :)

And it doesn't put the cursor in the middle of the screen like originaly intended. It stops it dead in it's track. Like we now kinda want.

I am sure we can fiddle that into an EXEC? (if the CURRENT trick doesn't work). 2 option to tackle the problem now?


Edited by Solbeamer
Link to comment
Share on other sites

I found something interesting. But don't got it working.

http://simhq.com/forum/ubbthreads.php/topics/3504421/2

 

I build the following stuff. But my 'stopper' still only get's understood if I press the TS3. If I execute the code (what's with the blue letter b.t.w? ... :P ) , the stopper doesn't seem to get activated, and the code freezes after the first pixel. So something 'stops'it :)

Also I have no idea what to put in the main, and what above it. I've been at it for hours now... many, many hours.. (what time is it? hmmm... lol..)

 

I hope my code below makes kinda sense.

 

 

 

include "target.tmh"

//mouse test file

 

alias T16001; // second T16000 handle, which will be used all mapping commands

alias T16A; // for handy switching purposes only

alias T16B; // same here

define switchthem 1 // make 0/1 if left=right

 

 

int Stopper;

int Rrr;

int Lll;

int Ddd;

int Uuu;

 

short speed;

 

 

int set_mouse_cursor_speed (short speed)

{

//MapKey(&T16001, H1U, AXIS (MOUSE_Y_AXIS, -1, speed));

//MapKey(&T16001, H1D, AXIS (MOUSE_Y_AXIS, 1, speed));

//MapKey(&T16001, H1L, AXIS (MOUSE_X_AXIS, -1, speed));

//MapKey(&T16001, H1R, AXIS (MOUSE_X_AXIS, 1, speed));

 

Uuu = EXEC("MapKey(&T16001, H1U, AXIS (MOUSE_Y_AXIS, -1, speed));");

Ddd = EXEC("MapKey(&T16001, H1D, AXIS (MOUSE_Y_AXIS, 1, speed));");

Lll = EXEC("MapKey(&T16001, H1L, AXIS (MOUSE_X_AXIS, -1, speed));");

Rrr = EXEC("MapKey(&T16001, H1R, AXIS (MOUSE_X_AXIS, 1, speed));");

//Stopper = EXEC("DXAxis(MOUSE_X_AXIS, 0);" "DXAxis(MOUSE_Y_AXIS, 0);");

 

}

 

 

 

int main()

 

{

 

Configure(&HCougar, MODE_EXCLUDED);

Configure(&Joystick, MODE_EXCLUDED);

Configure(&Throttle, MODE_EXCLUDED);

Configure(&LMFD, MODE_EXCLUDED);

Configure(&RMFD, MODE_EXCLUDED);

 

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

 

&T16001 = GetIndexJoy (SelectUsbDevice ("VID_044F&PID_B10A")); //pc expects a joystick on this adress

 

 

if (switchthem)

 

{

&T16A = &T16000;

&T16B = &T16001;

 

&T16000 = &T16B;

&T16001 = &T16A;

}

// this was about making the left one right and vice...

 

 

set_mouse_cursor_speed (60); //too slow? make number smaller both here, and below in code right stick! But i.c.w. the stick movement itself it's speedy enough I think..

 

 

Uuu = EXEC("MapKey(&T16001, H1U, AXIS (MOUSE_Y_AXIS, -1, speed));");

Ddd = EXEC("MapKey(&T16001, H1D, AXIS (MOUSE_Y_AXIS, 1, speed));");

Lll = EXEC("MapKey(&T16001, H1L, AXIS (MOUSE_X_AXIS, -1, speed));");

Rrr = EXEC("MapKey(&T16001, H1R, AXIS (MOUSE_X_AXIS, 1, speed));");

Stopper = EXEC("DXAxis(MOUSE_X_AXIS, 0);" "DXAxis(MOUSE_Y_AXIS, 0);");

 

 

 

//MapKey(&Joystick, H1U, EXEC("if(flag1) ActKey(KEYON+MouseU); else ActKey(KEYON+DXHATUP);")); // starts it moving

//MouseUO = CHAIN(EXEC("ActKey(MouseU);"),EXEC("TrimDXAxis(MOUSE_Y_AXIS,SET(0));"));

MapKey(&T16001, H1U, CHAIN ( EXEC ("ActKey(Stopper);") , D(10), Uuu) );

MapKey(&T16001, H1D, CHAIN (Stopper , D(10), Ddd) );

MapKey(&T16001, H1L, CHAIN (ActKey(Stopper), D(10), Lll) );

MapKey(&T16001, H1R, CHAIN (ActKey(Stopper), D(10), Rrr) );

 

 

 

 

 

/////// right stick

// working with mouse speed

 

MapKeyR (&T16000, TS2, EXEC("set_mouse_cursor_speed(60);" )); //here we get slow mouse cursor again

MapKey (&T16000, TS2, EXEC("set_mouse_cursor_speed(20);" )); // here comes fast mouse cursor

MapKey (&T16000, TS3, Stopper);

 

//MapKey (&T16000, TS3, EXEC("DXAxis(MOUSE_X_AXIS, 0);""DXAxis(MOUSE_Y_AXIS, 0);")); // center mouse cursor to middle screen

 

 

 

 

 

 

 

}

 

//event handler

int EventHandle(int type, alias o, int x)

{

DefaultMapping(&o, x);

 

//add event handling code here

}

Link to comment
Share on other sites

Well, I tried my best to find a way to make TARGET behave like it should. But when you have a function called GetMouseX() that returns 1459 nearly every time you call it, that's not going to happen!

 

Quite like PlugMouse(NOT absolute) should result in something that makes sense and there is no way to get an idea of what happens.

 

My conclusion is that this code is not clean enough to work out a solution that would track the current position of the pointer as would any mouse driver.

 

I even tried the TrimDXAxis() hack ... same result, TARGET keeps working with its private pointer position instead of starting from the current screen coordinates. And you can't correct that when GetMouseX() and GetMouseY() are not working.

 

I got many fancy functions working so far like an toggle-able auto-zoom between first and second trigger stages with a blinking led when it's on, auto cockpit views preset file storage, etc.

 

But this issue is a lost cause as it requires a core rework (or more accurately finished work).

 

Sorry, I'm going to find some better way to spend my time ... as you should ;)

 

-ivan

Link to comment
Share on other sites

  • 1 month later...

This might not be too advanced, but does any of you guys know a way to map two DirectX axis to one physical joy axis?

 

The solution i have found until now is using a REXEC to trigger a SEQ every 20ms or so, that changes the mapping, and it has to be doing that all the time.

 

ala:

 

int axis;

axis = SEQ( mapaxis_1, mapaxis_2);

REXEC(1, 20," ActKey(KEYON+ PULSE+ axis);");

 

This is of course not how the code looks, but i hope you get the idea.

It works pretty good, but it would be nice if there was another way.

 

Thanks in advance..

[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

  • 2 weeks later...
  • 1 month later...
  • 4 months later...
This might not be too advanced, but does any of you guys know a way to map two DirectX axis to one physical joy axis?

 

The solution i have found until now is using a REXEC to trigger a SEQ every 20ms or so, that changes the mapping, and it has to be doing that all the time.

 

ala:

 

int axis;

axis = SEQ( mapaxis_1, mapaxis_2);

REXEC(1, 20," ActKey(KEYON+ PULSE+ axis);");

 

This is of course not how the code looks, but i hope you get the idea.

It works pretty good, but it would be nice if there was another way.

 

Thanks in advance..

 

 

Hello.

 

I am back. My first prio is flying in Star Citzen. And your problem seems like a tough one. It would take me days where others would only requires 2 hours tops.

 

Try asking here if eagles could not help.

https://forums.robertsspaceindustries.com/categories/hardware

 

There are some more TARGET know-what's/pro's there now.

Link to comment
Share on other sites

Hi all,

 

Here is a small thread demonstrating how to automatically run a TARGET script at startup. This is usefull if you don't want to bother running the scripts manually everytime you're using your stick.

 

See here: http://forums.eagle.ru/showthread.php?t=144584

 

Cheers !

 

 

Thanks.

Not exactly what I was looking for but maybe helpfull.

I found that switching scripts in Star Citizen gives no problems.

But a quickbind for it speeds it up by a few seconds.

Not too bad.. unless clicking the second quickbind in windows closes the program. In which case I also then need to restart star citizen so it recognizes TARGET again :). Then I lose 7-8 minutes getting in dogfight again.

:D

Link to comment
Share on other sites

This might not be too advanced, but does any of you guys know a way to map two DirectX axis to one physical joy axis?

 

The solution i have found until now is using a REXEC to trigger a SEQ every 20ms or so, that changes the mapping, and it has to be doing that all the time.

 

ala:

 

int axis;

axis = SEQ( mapaxis_1, mapaxis_2);

REXEC(1, 20," ActKey(KEYON+ PULSE+ axis);");

 

This is of course not how the code looks, but i hope you get the idea.

It works pretty good, but it would be nice if there was another way.

 

Thanks in advance..

Hello, you can use TrimDXAxis.

 

There you go, here I mapped Joystick X axis to both X and Y, note that 2048 is the maximum resolution you can using this method:

KeyAxis(&Joystick,JOYX,0,AXMAP1(2048,
  EXEC([color=DarkRed]"TrimDXAxis(DX_X_AXIS, SET(Joystick[JOYX]/32)); TrimDXAxis(DX_Y_AXIS, SET(Joystick[JOYX]/32));"[/color]),
  EXEC([color=DarkRed]"TrimDXAxis(DX_X_AXIS, SET(Joystick[JOYX]/32)); TrimDXAxis(DX_Y_AXIS, SET(Joystick[JOYX]/32));"[/color])));

Edit: Joystick[JOYX]/32 is used to make resolution of the axis (65536) match the resolution of the trim (2048=65536/32).

Read page 30 of the pdf manual.

 

Edit2: you can even use a third controller axis that will be mapped to two other directx axis, here moving the slider on the throttle will set both joystick X and Y, with less steps (512 instead of 2048 ):

[color=#a52a2a][color=Black]KeyAxis(&Throttle,THR_FC,0,AXMAP1(512,
  EXEC([color=#a52a2a]"TrimDXAxis(DX_X_AXIS, SET(Throttle[THR_FC]/32)); TrimDXAxis(DX_Y_AXIS, SET(Throttle[THR_FC]/32));"[/color]),
  EXEC([color=#a52a2a]"TrimDXAxis(DX_X_AXIS, SET(Throttle[THR_FC]/32)); TrimDXAxis(DX_Y_AXIS, SET(Throttle[THR_FC]/32));"[/color])));[/color][/color]


Edited by PiedDroit
Link to comment
Share on other sites

  • 4 months later...

https://forums.robertsspaceindustries.com/discussion/315586/t-a-r-g-e-t-working-mouse-code#latest

 

Synkc helped me out here with solid working code. Thank you Synkc!

 

"Synkc"

 

Replacing:

MapKey(&T16000, H1L, REXEC(0, 88, "TrimDXAxis(MOUSE_X_AXIS, SET(-1));"));
MapKey(&T16000, H1R, REXEC(0, 88, "TrimDXAxis(MOUSE_X_AXIS, SET(1));"));
MapKey(&T16000, H1U, REXEC(0, 88, "TrimDXAxis(MOUSE_Y_AXIS, SET(-1));"));
MapKey(&T16000, H1D, REXEC(0, 88, "TrimDXAxis(MOUSE_Y_AXIS, SET(1));"));

 

With:

MapKey(&T16000, H1U, REXEC(0, 2, "DXAxis(MOUSE_Y_AXIS, -1);"));
MapKey(&T16000, H1R, REXEC(1, 2, "DXAxis(MOUSE_X_AXIS, 1);"));
MapKey(&T16000, H1D, REXEC(0, 2, "DXAxis(MOUSE_Y_AXIS, 1);"));
MapKey(&T16000, H1L, REXEC(1, 2, "DXAxis(MOUSE_X_AXIS, -1);"));

 

Should solve the mousehops problem when the virtual mouse is set to relative mode. To alter the speed, change the delay in REXEC().

Link to comment
Share on other sites

  • 1 year later...

MapKey, MAPAXIS2, CHAIN, EXEC

 

Can anyone help me with this?

[color=#1e90ff][b]include[/b][/color] [color=#a52a2a]"target.tmh"[/color]
[color=#1e90ff][b]include[/b][/color] [color=#a52a2a]"DCS_F-5ESim_Macro.ttm"[/color]

[color=#1e90ff][b]char[/b][/color] GS; [color=#32cd32]//we create a flag called GS (Gear State)[/color]


[color=#32cd32]//program startup[/color]
[color=#1e90ff][b]int[/b][/color] main()
{
   [color=#1e90ff][b]if[/b][/color][color=#ffffff]([/color]Init(&EventHandle)) [color=#1e90ff][b]return[/b][/color] [color=#ffffff]1[/color]; [color=#32cd32]// declare the event handler, return on error[/color]
   
GS[color=#ffffff]=[/color][color=#ffffff]0[/color]; [color=#32cd32]//set the GS value to 0 at startup of the configuration[/color]

MapAxis(&Throttle, THR_FC, DX_SLIDER_AXIS);
   KeyAxis(
       &Throttle,
       THR_FC,
       [color=#a52a2a]'ioumd'[/color],
       AXMAP2(
       [color=#ffffff]3[/color],                                                [color=#32cd32]// 3 SECTIONS  Gear Down, none, Gear Up[/color]
       CHAIN[color=#ffffff]([/color]EXEC([color=#a52a2a]"GS=0;"[/color]),Landing_Gear_Lever_LG_UP),    [color=#32cd32]// Gear Up set GS=0[/color]
       [color=#ffffff]0[/color],                                                [color=#32cd32]//Middle dead zone[/color]
       CHAIN[color=#ffffff]([/color]EXEC([color=#a52a2a]"GS=1;"[/color]),Landing_Gear_Lever_LG_DOWN)    [color=#32cd32]//Gear Down set GS=1[/color]
               )                                        [color=#32cd32]//Close AXMAP2 command[/color]
           );                                            [color=#32cd32]//Close KeyAxis function[/color]


MapKey(&Joystick, S1, EXEC([color=#a52a2a]"if(GS) ActKey(Arresting_Hook_Button);"[/color])); [color=#32cd32]//If GS true (=1) press “h” keystroke when S1 is pressed.[/color]
}

[color=#32cd32]//event handler[/color]
[color=#1e90ff][b]int[/b][/color] EventHandle[color=#ffffff]([/color][color=#1e90ff][b]int[/b][/color] type, [color=#1e90ff][b]alias[/b][/color] o, [color=#1e90ff][b]int[/b][/color] x)
{
   DefaultMapping(&o, x);
   
   [color=#32cd32]//add event handling code here[/color]
}

Inspired by Home Fries

I wanted to tie the Hook, Parachute, and Nose Wheel Steering to weather the landing gear was Up or Down.

I'm using the Throttle Friction Lever axis with the AXMAP 2 function. The script compiles and launches. The Gear goes up and down (as far as the Event Tester) , but the Hook won't deploy with the gear down.

 

Any help would be appreciated.

Night Ops in the Harrier

IYAOYAS


 
Link to comment
Share on other sites

  • Recently Browsing   0 members

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