Previous Thread
Next Thread
Print Thread
Rate This Thread
Hop To
Page 1 of 2 1 2
#4208392 - 12/21/15 08:22 AM Delay+chain with exec in them  
Joined: Dec 2013
Posts: 46
Space the Blaze Offline
Blazer of Space
Space the Blaze  Offline
Blazer of Space
Junior Member

Joined: Dec 2013
Posts: 46
I need to have a code that chain delays stuff.

I got:

Code:
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 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));
}

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


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 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
}



I need code that let's me skip having to push the TS3 button.
It needs to be an automatic one after the H1U,R,L or D button. Without the mouse coming to a complete stop.
Meaning that if I keep the H1U pushed, both stopper and mouse cursor keep being executed one after another.

I tried EXEC the AXIS in the MApkey but I think TARGET does not like that.
When I push the HAT I get syntax errored smile
Compiling seems to be a go, but the code still errors when I push the POV involved.

Inline advert (2nd and 3rd post)

#4208728 - 12/22/15 02:02 AM Re: Delay+chain with exec in them [Re: Space the Blaze]  
Joined: Mar 2007
Posts: 483
Aullido Offline
Member
Aullido  Offline
Member

Joined: Mar 2007
Posts: 483
I am not a native English speaker and I am not sure what do you want. Try this:

// Stopper as function.

int
Stopper ()

{
EXEC("DXAxis(MOUSE_X_AXIS, 0);" "DXAxis(MOUSE_Y_AXIS, 0);");
}

//

int
set_mouse_cursor_speed (short speed)

{
Stopper();
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));
}

Must work, but I am writing off the top of my head;

#4209143 - 12/23/15 02:25 AM Re: Delay+chain with exec in them [Re: Space the Blaze]  
Joined: Dec 2013
Posts: 46
Space the Blaze Offline
Blazer of Space
Space the Blaze  Offline
Blazer of Space
Junior Member

Joined: Dec 2013
Posts: 46
Hello.

Thanks for trying. It does not do what I want it to do.

I want the stopper to be executed automatically after every input from the H1U

What I want it:
I keep H1U pushed:
TARGET will do:
move mouse cursor, stopper, move mouse cursor, stopper, etc.

I got a relative mouse by editing target.tmh line 193, making PlugMouse(0);

But without a stopper it keep adding mouse cursor values. We keep a swinging mouse then.
The stopper stops adding values. But the stopper needs to be automated.
(we don't want to press it after moving every pixel smile )

It's the only mouse that will work in the game I am playing.
The normal mouse code (PlugMouse (1) ) kills the game.
The mouse (0) works ingame, but adds values. It's a swinging mouse.

#4209406 - 12/23/15 09:15 PM Re: Delay+chain with exec in them [Re: Space the Blaze]  
Joined: Mar 2007
Posts: 483
Aullido Offline
Member
Aullido  Offline
Member

Joined: Mar 2007
Posts: 483
You must not edit the original files, you can broke something badly. In fact I believed those files were in a protected folder.

I am experimenting with the mouse functions also. I have a problem with Cliffs actually.

Try moving the stopper call to the end of the function.

Maybe your solution is using another function, try to use trimming to move the mouse. Each mouse axis is modeled like a +-1024 points axis centered on the screen. A trim value must move the position permanently to a new position. I think you can use CURRENT(the current axis value) to increment the movement.

Last edited by Aullido; 12/23/15 09:32 PM.
#4209441 - 12/24/15 12:24 AM Re: Delay+chain with exec in them [Re: Space the Blaze]  
Joined: Dec 2013
Posts: 46
Space the Blaze Offline
Blazer of Space
Space the Blaze  Offline
Blazer of Space
Junior Member

Joined: Dec 2013
Posts: 46
I must not tinker with them?
But they are filled with typo's and non-working errors.
biggrin

//target.tmh file you need to patch ... line 193 PlugMouse(0);
//target.tmh file you need to patch ... line 258 else if (&dev == &T16000 | &dev == &T16001)

if you don't change these 2 things you don't get your second POV and my mouse let's the game crash in a game I play.
Changing the aboves gives me a working TARGET/mouse code :P

At 2 dozen sites they say to edit the file. It's no good.

You can always backup the (non-able-to-be-editted-anyway) file, but since the new one works and the old one doesn't... smile

I have no idea how to use CURRENT. You might want to give me a syntax example?


I have found another way to tackle the problem, but yet I walk into syntaxerrorland.

Compile Error: = expected in workingmousecode.tmc at line 81 (see // comment to see the line)

Why? And what is the fix? (me such a noob, lol)


Code:


include "target.tmh"
//mouse test file
//target.tmh file you need to patch ... line 193 PlugMouse(0);
//target.tmh file you need to patch ... line 258 else if (&dev == &T16000 | &dev == &T16001)


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 Uonk;
int Donk; 
int Lonk; 
int Ronk;

int Stopper;

char Uo;
char Do;
char Lo;
char Ro;


int main()

{

Uo=0;
Lo=0;
Do=0;
Ro=0;



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

Uonk = EXEC("DXAxis(MOUSE_Y_AXIS,-1);");

Donk = EXEC("DXAxis(MOUSE_Y_AXIS,+1);");

Lonk = EXEC("DXAxis(MOUSE_X_AXIS,-1);");

Ronk = EXEC("DXAxis(MOUSE_X_AXIS,+1);");



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...



MapKey   (&T16000, TS3, Stopper);

MapKey(&T16001, H1U,  "Uo=1;");
MapKey(&T16001, H1D,  "Do=1;");
MapKey(&T16001, H1L,  "Lo=1;");
MapKey(&T16001, H1R,  "Ro=1;");
MapKeyR(&T16001, H1U, "Uo=0;");
MapKeyR(&T16001, H1D, "Do=0;");
MapKeyR(&T16001, H1L, "Lo=0;");
MapKeyR(&T16001, H1R, "Ro=0;");


do Uonk while (Uo=1);   //line 81
do Donk while (Do=1);
do Ronk while (Ro=1);
do Lonk while (Lo=1);


}


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

//add event handling code here
}


Last edited by SpaceBlaze; 12/24/15 12:25 AM. Reason: tupo
#4209452 - 12/24/15 12:44 AM Re: Delay+chain with exec in them [Re: Space the Blaze]  
Joined: Dec 2013
Posts: 46
Space the Blaze Offline
Blazer of Space
Space the Blaze  Offline
Blazer of Space
Junior Member

Joined: Dec 2013
Posts: 46
From the TARGET 'helpdesk':

Dear Mr. [name] ,

Regarding your T.16000M.

We are very sorry Sir, but we do not offer support for the Script Editor version of TARGET.

We don't have any programmers available.

The Script editor version of TARGET was designed for user with advanced programming skills, in order for them to be able to crate their own configurations.

Unfortunately, we are unable to assist you in this matter.

---------------------------------

So it seems we are on our own from now on. They wrote the program to give programmers an idea how to work with it, and that's that.

The program will not be looked at again by the company. And this has been so for a long time already.... frown

#4209465 - 12/24/15 01:32 AM Re: Delay+chain with exec in them [Re: Space the Blaze]  
Joined: Mar 2007
Posts: 483
Aullido Offline
Member
Aullido  Offline
Member

Joined: Mar 2007
Posts: 483
From the Script manual page 29:



MapKey(&Joystick, H1U, EXEC("TrimDXAxis(DX_Y_AXIS, -10);"));
MapKey(&Joystick, H1D, EXEC("TrimDXAxis(DX_Y_AXIS, 10);"));
MapKey(&Joystick, H1L, EXEC("TrimDXAxis(DX_X_AXIS, -10);"));
MapKey(&Joystick, H1R, EXEC("TrimDXAxis(DX_X_AXIS, 10);"));

In these lines, each time I press a button, it offsets the joystick X or Y axis by 10 points. If I hold the button down,
it will have no effect; the trim value is only “EXECuted” once. If I want the offset value to loop until I release the
button, I will use the REXEC function (please see later on in this manual for an explanation).

MapKey(&Joystick, H1L, REXEC(0, 100, "TrimDXAxis(DX_X_AXIS, -5);"));
MapKey(&Joystick, H1R, REXEC(0, 100, "TrimDXAxis(DX_X_AXIS, 5);"));
MapKey(&Joystick, H1U, REXEC(1, 100, "TrimDXAxis(DX_Y_AXIS, -5);"));
MapKey(&Joystick, H1D, REXEC(1, 100, "TrimDXAxis(DX_Y_AXIS, 5);"));

Force a trim value

MapKey(&Joystick, S4, EXEC("TrimDXAxis(DX_X_AXIS, SET(0));TrimDXAxis(DX_Y_AXIS, SET(0));"));

I force the trim value to zero; the result is a trim reset. Here, when I press the S4 button on the Joystick, I set the
X and the Y axis trim offset to zero.

Read an axis value and apply it as trim offset to the same axis

MapKey(&Joystick, S1, EXEC("TrimDXAxis(DX_X_AXIS, CURRENT);TrimDXAxis(DX_Y_AXIS, CURRENT);"));

When I press the Joystick S1 button, I memorize the X and Y axis position and calculate the difference to the
center of the axis, and then I apply it to the X and Y axis. It simply works in the same way as the DCS BlackShark
trim. In this case, the use of a cancel trim event is highly recommended.


You must use MOUSE_X_AXIS and MOUSE_Y_AXIS on those examples instead.

Respect changing the original files, please, just don't. I have seen post about how to work with a double joystick, it is not my case but I remember they suggest to create a copy of the original .tmh file and work over it. They are a guy from France, maybe very involved with the TARGET development who explain how to use those tricks for Elite Dangerous. This guy is above my level. I would not try to mess with those files because his code is not protected. Much of the chaingrain to understand TARGET is that part of the code works in a different address space, just to avoid people messing with things at system level.

As second thought, maybe your solution is changing the Axis behavior using

MapAxis(&Throttle, SCX, MOUSE_X_AXIS, AXIS_NORMAL, MAP_RELATIVE);

There are two operating modes: MAP_RELATIVE and MAP_ABSOLUTE.

Last edited by Aullido; 12/24/15 01:57 AM.
#4209471 - 12/24/15 01:55 AM Re: Delay+chain with exec in them [Re: Space the Blaze]  
Joined: Dec 2013
Posts: 46
Space the Blaze Offline
Blazer of Space
Space the Blaze  Offline
Blazer of Space
Junior Member

Joined: Dec 2013
Posts: 46
ok, thanks.

Will try it.

I thought trimaxis was about curve. So totally overread it :P
(I thought it had nothing to do with what I was looking for smile )

It sounds like what I am looking for.
If it is, you will hear me cry out from Holland!
smile

#4209472 - 12/24/15 01:59 AM Re: Delay+chain with exec in them [Re: Space the Blaze]  
Joined: Mar 2007
Posts: 483
Aullido Offline
Member
Aullido  Offline
Member

Joined: Mar 2007
Posts: 483
Check changes to my previous post.

#4209496 - 12/24/15 03:02 AM Re: Delay+chain with exec in them [Re: Space the Blaze]  
Joined: Dec 2013
Posts: 46
Space the Blaze Offline
Blazer of Space
Space the Blaze  Offline
Blazer of Space
Junior Member

Joined: Dec 2013
Posts: 46
I tried RELATIVE. It did not give me the results I needed.

Since I need MapKey there is no way to put AXIS into RELATIVE mode in that.

Only setting (1) to (0) gives me the mouse the game (Star Citizen the sim smile ) will not freak out on.

#4209509 - 12/24/15 03:19 AM Re: Delay+chain with exec in them [Re: Space the Blaze]  
Joined: Dec 2013
Posts: 46
Space the Blaze Offline
Blazer of Space
Space the Blaze  Offline
Blazer of Space
Junior Member

Joined: Dec 2013
Posts: 46
MapKey(&Joystick, H1L, REXEC(0, 100, "TrimDXAxis(DX_X_AXIS, -5);"));

what do the numbers 0, 100 do?

#4209516 - 12/24/15 04:09 AM Re: Delay+chain with exec in them [Re: Space the Blaze]  
Joined: Mar 2007
Posts: 483
Aullido Offline
Member
Aullido  Offline
Member

Joined: Mar 2007
Posts: 483
The first parameter is an identifier, you can use it to stop the REXEC with

EXEC("StopAutoRepeat(4);") // 4 is the Id on this case.

The second is an interval in milliseconds to define when the function will repeat.

#4209527 - 12/24/15 04:53 AM Re: Delay+chain with exec in them [Re: Space the Blaze]  
Joined: Dec 2013
Posts: 46
Space the Blaze Offline
Blazer of Space
Space the Blaze  Offline
Blazer of Space
Junior Member

Joined: Dec 2013
Posts: 46
Code:
include "target.tmh"
//mouse test file
//target.tmh file you need to patch ... line 193 PlugMouse(0);
//target.tmh file you need to patch ... line 258 else if (&dev == &T16000 | &dev == &T16001)


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 main()

{



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



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...


MapKey   (&T16001, TS3, Stopper);

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));"));


}

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

//add event handling code here
}



This gives me a working mouse that doesn't let the game freak out.
But with PlugMouse(0) at 193 (the only mouse version the game will accept), the mouse skips 10-ish cm on the screen.

I do not seem to know how to get smaller working numbers then 1.
0.1 is not accepted/understood in the set.
Not setting it but just giving the number 1 even gives bigger jumps on the screen.

How do I get low hops of the mouse?

#4209528 - 12/24/15 04:55 AM Re: Delay+chain with exec in them [Re: Space the Blaze]  
Joined: Dec 2013
Posts: 46
Space the Blaze Offline
Blazer of Space
Space the Blaze  Offline
Blazer of Space
Junior Member

Joined: Dec 2013
Posts: 46
You are REALLY helping me here!
I am almost there..... (star wars deathstar scene quote :P )

thanks!!

biggrin

#4209732 - 12/24/15 07:53 PM Re: Delay+chain with exec in them [Re: Space the Blaze]  
Joined: Mar 2007
Posts: 483
Aullido Offline
Member
Aullido  Offline
Member

Joined: Mar 2007
Posts: 483
Maybe the solution lies on CURRENT.

The problem is that I still don't understand exactly what you need.

Do you want to reset the cursor to center screen every time after the mouse is moved one point?

Or do you want the mouse to move one point, wait, move another point?

The first step to resolve a problem is to define it.

Last edited by Aullido; 12/24/15 07:54 PM.
#4209744 - 12/24/15 08:21 PM Re: Delay+chain with exec in them [Re: Space the Blaze]  
Joined: Dec 2013
Posts: 46
Space the Blaze Offline
Blazer of Space
Space the Blaze  Offline
Blazer of Space
Junior Member

Joined: Dec 2013
Posts: 46
I want the mouse to move one point, wait, move another point.

And I want to be able to manually define how many pixels it should skip.

I would follow the manual if I could, but having to use PlugMouse(0) changes all the rules it seems.
Using PlugMouse(1) however and doing normal mouse code like in the script manual is no option, since Star Citizen does not like a (1) mouse.


With SET (1) en (-1) I don't get a pendulum/swinging mouse.
But the '1' seems to let me skip 10cm. I need to skip smaller parts of the screen.



Last edited by SpaceBlaze; 12/24/15 08:22 PM.
#4209757 - 12/24/15 08:43 PM Re: Delay+chain with exec in them [Re: Space the Blaze]  
Joined: Mar 2007
Posts: 483
Aullido Offline
Member
Aullido  Offline
Member

Joined: Mar 2007
Posts: 483
Why AXIS didn't work?

MapKey(&T16000, H1D, AXIS(MOUSE_Y_AXIS, 80, 20));

The 80 is the number of increase for the axis and the 20 are the milliseconds to wait for another increase. Just change the 20 to 100 and see what happens.

The PlugMouse function is not documented and I suspect it creates a new mouse. Are you sure you have the latest version of the software?

#4209775 - 12/24/15 09:26 PM Re: Delay+chain with exec in them [Re: Space the Blaze]  
Joined: Dec 2013
Posts: 46
Space the Blaze Offline
Blazer of Space
Space the Blaze  Offline
Blazer of Space
Junior Member

Joined: Dec 2013
Posts: 46
It gives a mouse that keeps adding and subtracting latest speed of it.
When I push H1D 3 times, the jumps get bigger, and then when I push H1U a few times after that what first happens is that the speed down get's chopped and only after 3 times pushing it, it will stop, and only then go up after that.

example:
H1D, H1D, H1D, H1U, H1U, H1U, H1U, H1U
go down 80, go down 160, go down 240, go down 160, go down 80, stop, go up 80, go up 160

The mouse 'swings'

It's because of the code PlugMouse(0)does.

If I was a skilled math dude I would look into target.tmh and find out how it get's the mouse coordinates, and how to add only one or a few pixels.
But I am very bad at math. And how pc's use cos and sin and arc tang is magic to me smile

#4209792 - 12/24/15 10:29 PM Re: Delay+chain with exec in them [Re: Space the Blaze]  
Joined: Mar 2007
Posts: 483
Aullido Offline
Member
Aullido  Offline
Member

Joined: Mar 2007
Posts: 483
The problem is with PlugMouse since we really don't know what it does. Let's use the default value and try to find an answer to your problem. I will try with TrimAxis meanwhile now I understand what it is needed. Check outside the game what AXIS is doing, the function is designed to hold the button, not to send repeated presses. I think the problem with the swing could be the axis pass its limit and then changes direction but it is strange it happens with such low values.

#4209809 - 12/24/15 11:51 PM Re: Delay+chain with exec in them [Re: Space the Blaze]  
Joined: Dec 2013
Posts: 46
Space the Blaze Offline
Blazer of Space
Space the Blaze  Offline
Blazer of Space
Junior Member

Joined: Dec 2013
Posts: 46
The problem with not adjusting PlugMouse is that when I touch any Mouse_Axis code in Star Citizen the game freaks out, and put's the cursor way out of the screen without being able to retrieve it.
Even setting the cursor to middle of the screen does not let the game stop freaking.

https://forums.robertsspaceindustries.co...e-game-go-crazy

Page 1 of 2 1 2

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
Pride Of Jenni race win
by NoFlyBoy. 04/15/24 12:22 AM
Copyright 1997-2016, SimHQ Inc. All Rights Reserved.

Powered by UBB.threads™ PHP Forum Software 7.6.0