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

#4209810 - 12/24/15 11:55 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
MapKey(&T16000, H1L, REXEC(0, 88, "TrimDXAxis(MOUSE_X_AXIS, SET(-1));"));

with PlugMouse (0) is the only thing that gives me a mouse that works ingame.
All other mouse codes either swings or let's the game freak.

PlugMouse(1) is not an option. Citizen hates that code.
smile

So whatever solution we come up with, it has to look at the code Plug(0) uses.

#4209812 - 12/25/15 12: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
Try this, it works for me.

Code:
MapKey
 (
  &Joystick,
  H1D,
  REXEC(0,50,"DXAxis(MOUSE_X_AXIS, Axis[MOUSE_X_AXIS].pos + 100);")
 );


And try with PlugMouse(1) also!

Last edited by Aullido; 12/25/15 12:13 AM.
#4209815 - 12/25/15 12:12 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. give me 6 minutes smile

#4209816 - 12/25/15 12:32 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

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


MapKey
 (
  &T16001,
  H1R,
  REXEC(0,50,"DXAxis(MOUSE_X_AXIS, Axis[MOUSE_Y_AXIS].pos + 2);")
 );

MapKey
 (
  &T16001,
  H1L,
  REXEC(0,50,"DXAxis(MOUSE_X_AXIS, Axis[MOUSE_Y_AXIS].pos - 2);")
 );

MapKey
 (
  &T16001,
  H1D,
  REXEC(0,50,"DXAxis(MOUSE_Y_AXIS, Axis[MOUSE_X_AXIS].pos + 2);")
 );

MapKey
 (
  &T16001,
  H1U,
  REXEC(0,50,"DXAxis(MOUSE_Y_AXIS, Axis[MOUSE_X_AXIS].pos - 2);")
 );
 
}


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

//add event handling code here
}




Gives me 3!!! smile working axis.
As soon as I change one of the two axis in one line I win one axix but lose the reaction for another. Another then becomes dead.

And I have to flip axis in one line. Really weird.

If I put Y and Y in one line, and X and X I get the pendulum axis back.

But 3 out of 4 axis is not bad. Only that last one now and we are gold.
Should be look at the Z mouse axis?
We got a lot of options, lol

Last edited by SpaceBlaze; 12/25/15 12:32 AM. Reason: on =one
#4209818 - 12/25/15 12:42 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 got a 3 working sides. U, L, R

And when I use the mouse weird #%&*$# happens. Different axis get locked and start working.
And when I use combinations All buttons now only give down and right movement.
Left and up are now giving right and down.
One button at this speed, and the other at another.

frown

I thought we nailed it... frown

#4209819 - 12/25/15 12:49 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:
MapKey
 (
  &T16001,
  H1R,
  REXEC(0,50,"DXAxis(MOUSE_X_AXIS, Axis[MOUSE_X_AXIS].pos + 2);")
 );

MapKey
 (
  &T16001,
  H1L,
  REXEC(0,50,"DXAxis(MOUSE_X_AXIS, Axis[MOUSE_X_AXIS].pos - 2);")
 );

MapKey
 (
  &T16001,
  H1D,
  REXEC(0,50,"DXAxis(MOUSE_Y_AXIS, Axis[MOUSE_Y_AXIS].pos + 2);")
 );

MapKey
 (
  &T16001,
  H1U,
  REXEC(0,50,"DXAxis(MOUSE_Y_AXIS, Axis[MOUSE_Y_AXIS].pos - 2);")
 );


Would be great...but without the adding/subtracting of the last coordinates and the speed it went.

So we need to say: STOP!
And then go again!

#4209820 - 12/25/15 12:52 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
Wait, you are mixing axis. Be sure the axis moved is the same as the axis position:

REXEC(0,50,"DXAxis(MOUSE_X_AXIS, Axis[MOUSE_Y_AXIS].pos - 2);") // Wrong.

REXEC(0,50,"DXAxis(MOUSE_X_AXIS, Axis[MOUSE_X_AXIS].pos - 2);") // Right.

If this works for one must work for all.

#4209822 - 12/25/15 12:56 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
Yes, mixing axis grumbles it up.

But X X still gives me a pendulum/swinging mouse.
We need a stopping code followed up by a continue mode.

H1D (the code), stop all movement, H1D (the code)again in the same line.
So that when I do the code the stopping makes sure all adding are forgotten, and we get a fresh startvalue 'hop'


Last edited by SpaceBlaze; 12/25/15 12:58 AM. Reason: bad engrish :)
#4209823 - 12/25/15 12: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
OK lets try without the REXEC. I will try to use the events section instead but I am afraid it would be tomorrow since its Christmas dinner time.

Merry Christmas.

#4209825 - 12/25/15 01:01 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
Stopper = EXEC("DXAxis(MOUSE_X_AXIS, 0);" "DXAxis(MOUSE_Y_AXIS, 0);");

kills the adding, and gives me a fresh new cursor.

So 2 continuing pushes of H1D should have a stopper code in between.
But I have no idea how to code that.

#4209826 - 12/25/15 01:05 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 think I tried it long ago but as soon as the stopper code part in the line was executed the button went dead.

Last edited by SpaceBlaze; 12/25/15 01:05 AM. Reason: part
#4209828 - 12/25/15 01:21 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
Yes, I guess it will be 2-ish days from now since I will be back here.

Merry X-mas and have a nice dinner party with close ones
smile

(like me smile )

#4209871 - 12/25/15 06:33 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
A simple MapKeyR?


MapKeyR(&T16000,H1U,EXEC("DXAxis(MOUSE_X_AXIS, 0);" "DXAxis(MOUSE_Y_AXIS, 0);"));

Do it for each H1 button.

#4209896 - 12/25/15 09:59 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
This would mean it get's 'stopped' when I let go of the button, right?

But I need the mouse code to walk around. Walking can not be done when I have to let go every time.
And also not if the pixels moved get's doubled every second.

In Citizen you walk around (and shoot) with the mouse.

I want to do that with the joystick.

I got 2 joysticks, and don't like another mouse next to it.

I fly with the joysticks, and I (and more players on the forums of the game) want to walk and shoot with it too.

Flying uses key bindings. And can also be bound ingame.

But walking only has the option for mouse.

Therefore I need mouse code smile

And when I can alter speed by toggling, I can even go into snipe mode.
(go fast to target, and then zoom in slowly or more secure)



Last edited by SpaceBlaze; 12/25/15 10:01 AM.
#4210003 - 12/25/15 08:26 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 can directly assign the mouse to a joystick. How SC uses the mouse exactly? I don't have the game installed.

#4210138 - 12/26/15 10:32 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
The mouse can be used to fly spacecraft and walk your toon.

Flying can also be done by binding it ingame to joystick(s)

walking can only be done with mouse. No joystick binding optioni for that yet.

XML stuff is used to bind them.


But since it's a space sim I (and many with me) do simply not want to use the mouse at all.

But mousecode on joystick gives us walking around with joystick AND a moveable reticle.



Since it seems we need code that gives us an adding mouse followed by a stopper code, we must focus on this. The stopper code should not kill any followup of the HAT button.

I have not yet tested () stopper after each H1D/L/R/U line.
Maybe the stopper should also exec a looking at the H1D etc and if it sees it as true, the continue of the mouse movement.

Bringing is back to move+stop+move.

You already know how to alter the target.thm file to the swinging mouse. So you can test the code needed to do move+stop+move. Have you yourself tried the (0) mouse?
It's easier talking if you do.
The original file cannot be tempered with anyway. It does not hurt to use an altered copy.
As soon as you use another map/folder without our target.tmh in it, it makes a fresh (original) one anyway.
We cannot 'break' the program. The files are write protected.

As long as we use alterable copies anyway we can never hurt the program.

Have you seen the whacky mouse we have?

#4210276 - 12/26/15 10: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
Try this on the shooter game, maybe you will find it useful.

Code:
 MapAxis
  (
   &T16000,
   JOYX,
   MOUSE_X_AXIS,
   AXIS_NORMAL,
   MAP_RELATIVE
  );
    
 MapAxis
  (
   &T16000,
   JOYY,
   MOUSE_Y_AXIS,
   AXIS_NORMAL,
   MAP_RELATIVE
  );



From the manual:

MapAxis optional parameters.

We have only used a few parameters in the previous script. In fact, MapAxis supports the following options:

MapAxis
(
&Input device,
physical axis name,
dx_axis name,
AXIS_NORMAL or AXIS_REVERSED,
MAP_ABSOLUTE or MAP_RELATIVE
):

AXIS_NORMAL: the axis runs in the default direction.
AXIS_REVERSED: reverses the axis direction.
MAP_ABSOLUTE: usual behavior of an axis.
MAP_RELATIVE: in this particular mode, the axis value will stay at the maximum or minimum value
reached until you change your movement direction. This parameter was specially created for Slew
Control axes or ministicks which control a Target Designation Cursor. Only use absolute mode when
needed.

Note: this mode provides for realistic handling of the TDC box in Lock On Modern Air Combat, DCS Flaming Cliffs
1 (and 2 without the patch).

#4230467 - 02/18/16 05:42 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 Aullido.

Sorry I only now am back. (time does indeed seem to fly away a lot)

It seems Synkc has solved the problem for me. (sorry for you work smile )
https://forums.robertsspaceindustries.co...de-kinda#latest

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

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
Headphones
by RossUK. 04/24/24 03:48 PM
Skymaster down.
by Mr_Blastman. 04/24/24 03:28 PM
The Old Breed and the Costs of War
by wormfood. 04/24/24 01:39 PM
Actors portraying British Prime Ministers
by Tarnsman. 04/24/24 01:11 AM
Roy Cross is 100 Years Old
by F4UDash4. 04/23/24 11:22 AM
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
Copyright 1997-2016, SimHQ Inc. All Rights Reserved.

Powered by UBB.threads™ PHP Forum Software 7.6.0