Is it a first person shooter?
In an FPS, if a target is visible on the screen at pixel coordinates 100, 200, then moving the mouse CURSOR to 100, 200 WILL NOT aim at that target.
FPS shooters simply do not work that way - the position of the CURSOR is irrelevant, the SIGNALS that came from the mouse are what is important.
In order for this to work, you would need to do it over multiple frames of the game.
Where is the target? Top right of screen.
Move mouse up and right some.
Repeat - where is target now? Right of screen.
Move mouse right some, repeat.
If you turned off pointer acceleration (In the game and in your mouse software, the windows setting is again irrelevant) and had high-precision timers, you MIGHT be able to aim at a predictable coordinate with just pre-calculated input, but I highly doubt you could get it accurate enough, plus it would be totally reliant on screen resolution and DPI settings - if you changed either, it would break.
MouseGetPos
- blueeyiz702
- Posts: 20
- Joined: 12 Dec 2017, 20:12
- Location: Las Vegas, Nevada
- Contact:
Re: MouseGetPos
so its going difficult to hit a certain place in game,and yes fps,black squad.evilC wrote:Is it a first person shooter?
In an FPS, if a target is visible on the screen at pixel coordinates 100, 200, then moving the mouse CURSOR to 100, 200 WILL NOT aim at that target.
FPS shooters simply do not work that way - the position of the CURSOR is irrelevant, the SIGNALS that came from the mouse are what is important.
In order for this to work, you would need to do it over multiple frames of the game.
Where is the target? Top right of screen.
Move mouse up and right some.
Repeat - where is target now? Right of screen.
Move mouse right some, repeat.
If you turned off pointer acceleration (In the game and in your mouse software, the windows setting is again irrelevant) and had high-precision timers, you MIGHT be able to aim at a predictable coordinate with just pre-calculated input, but I highly doubt you could get it accurate enough, plus it would be totally reliant on screen resolution and DPI settings - if you changed either, it would break.
- blueeyiz702
- Posts: 20
- Joined: 12 Dec 2017, 20:12
- Location: Las Vegas, Nevada
- Contact:
Re: MouseGetPos
@evilC, your UCR program,how would i map movements from black squad to xbox 360 wireless controller?
i tried and could not get it to work at all,im new so i need some help. thanks.
i tried and could not get it to work at all,im new so i need some help. thanks.
-
- Posts: 202
- Joined: 14 Aug 2016, 04:08
Re: MouseGetPos
what's the game?
- blueeyiz702
- Posts: 20
- Joined: 12 Dec 2017, 20:12
- Location: Las Vegas, Nevada
- Contact:
Re: MouseGetPos
Black Squadicuurd12b42 wrote:what's the game?
-
- Posts: 69
- Joined: 28 Dec 2017, 02:53
Re: MouseGetPos
this is black squad (pretty fun sometimes) https://www.youtube.com/watch?v=RKnzHSboWJc
Re: MouseGetPos
You mean you want to fake an xbox controller?blueeyiz702 wrote:@evilC, your UCR program,how would i map movements from black squad to xbox 360 wireless controller?
i tried and could not get it to work at all,im new so i need some help. thanks.
Did you read the big fat IMPORTANT in the first post of the UCR thread?
-
- Posts: 202
- Joined: 14 Aug 2016, 04:08
Re: MouseGetPos
Those kinds of games have 2 possible means of moving the reticule...
1) they constantly set the mouse to the center of the screen every step and see how far from the center of the screen you moved the mouse. and they derive from that a rotation of the camera
2) they read the mouse directly from the hardware and check against the old position and derive from that a rotation of the camera...
if the implementation is 1) then this code should work for you
MouseDirect.MoveInDirection(270,100,2);
or
MouseDirect.MoveByXYVector(0,100,2);
move mouse down, twice by 100 each time
this would essentially move the mouse relative to it's current location, which is the center of the screen. the game should re-center
1) they constantly set the mouse to the center of the screen every step and see how far from the center of the screen you moved the mouse. and they derive from that a rotation of the camera
2) they read the mouse directly from the hardware and check against the old position and derive from that a rotation of the camera...
if the implementation is 1) then this code should work for you
Code: Select all
Class MouseDirect
{
MoveByXYVector(xAmount,yAmount, numrepeat)
{
loop, %numrepeat%
{
DllCall("mouse_event", "UInt", 0x0001, "Int", xAmount, "Int", yAmount, "UInt", 0, "UPtr", 0) ; MOUSEEVENTF_MOVE = 0x0001
sleep 16
}
}
MoveInDirection(angle, amount, numrepeat)
{
xAmount := this.cosIt(angle) * amount
yAmount := this.sinIt(angle) * amount
this.MoveByXYVector(xAmount,yAmount, numrepeat)
}
cosIt(deg)
{
return, (cos(this.DegToRad(deg)))
}
sinIt(deg)
{
return, (-sin(this.DegToRad(deg)))
}
DegToRad(deg)
{
static pi := 3.14159265358979323846
return, deg * pi / 180
}
}
or
MouseDirect.MoveByXYVector(0,100,2);
move mouse down, twice by 100 each time
this would essentially move the mouse relative to it's current location, which is the center of the screen. the game should re-center
Re: MouseGetPos
The mouse_event DllCall should work if the game uses the cursor position OR if it reads the mouse via RawInput, seeing as the cursor moves in response to mouse_event.
If you want to send smooth mouse movement in this way, you want faster firing timers than AHK can provide (AHK only goes down to ~10ms, whereas real mice send input at a rate more like 1-2ms), then you can use MicroTimer: https://autohotkey.com/boards/viewtopic.php?t=29957
If you want to send smooth mouse movement in this way, you want faster firing timers than AHK can provide (AHK only goes down to ~10ms, whereas real mice send input at a rate more like 1-2ms), then you can use MicroTimer: https://autohotkey.com/boards/viewtopic.php?t=29957
-
- Posts: 202
- Joined: 14 Aug 2016, 04:08
Re: MouseGetPos
true, it should work in both cases I mention come to think of it.
I have experience mouse_event with a game that looked like it was reading the mouse via RawInput from the way it was acting but it turns out is was not the case... Either that or mouse_event does not work like I suspected...
I had to jump through hoops on that one
https://autohotkey.com/boards/viewtopic.php?f=5&t=42291
I have experience mouse_event with a game that looked like it was reading the mouse via RawInput from the way it was acting but it turns out is was not the case... Either that or mouse_event does not work like I suspected...
I had to jump through hoops on that one
https://autohotkey.com/boards/viewtopic.php?f=5&t=42291
Re: MouseGetPos
But I am still not 100% sure what blueeyiz702 wants - I do not know if he wants to use mouse or joystick as the physical input device.
It's a PC game, so I am guessing the game takes input from the mouse, so I am guessing he wants mouse as the output, but to play the game with a joypad in his hands, but who in their right mind would want to play a mouse-aim game with a joystick???
It's a PC game, so I am guessing the game takes input from the mouse, so I am guessing he wants mouse as the output, but to play the game with a joypad in his hands, but who in their right mind would want to play a mouse-aim game with a joystick???
- blueeyiz702
- Posts: 20
- Joined: 12 Dec 2017, 20:12
- Location: Las Vegas, Nevada
- Contact:
Re: MouseGetPos
[quote="evilC"]But I am still not 100% sure what blueeyiz702 wants - I do not know if he wants to use mouse or joystick as the physical input device.
It's a PC game, so I am guessing the game takes input from the mouse, so I am guessing he wants mouse as the output, but to play the game with a joypad in his hands, but who in their right mind would want to play a mouse-aim game with a joystick???[/quote
im trying to map the A,W,S,D to left pad on Xbox controller and the shooting action to right trigger. i noticed some guys have a lean and shoot and its almost impossible to hit them on they move. i want to map the black sqaud game keys
to my controller. I need mouse to controller input,so i can use xbox controller instead of mouse.
It's a PC game, so I am guessing the game takes input from the mouse, so I am guessing he wants mouse as the output, but to play the game with a joypad in his hands, but who in their right mind would want to play a mouse-aim game with a joystick???[/quote
im trying to map the A,W,S,D to left pad on Xbox controller and the shooting action to right trigger. i noticed some guys have a lean and shoot and its almost impossible to hit them on they move. i want to map the black sqaud game keys
to my controller. I need mouse to controller input,so i can use xbox controller instead of mouse.
Re: MouseGetPos
Ok so the input (The thing you actually use) is keyboard and mouse, and the output (The thing the game needs to see) is a virtual xbox controller?
And you also want to have it so that when you move the mouse, one of the virtual controller joysticks moves?
And you also want to have it so that when you move the mouse, one of the virtual controller joysticks moves?
Re: MouseGetPos
NM, just noticed this.blueeyiz702 wrote:Recoil() ;Recoil
So the real reasons emerge. I'm out.
- blueeyiz702
- Posts: 20
- Joined: 12 Dec 2017, 20:12
- Location: Las Vegas, Nevada
- Contact:
Re: MouseGetPos
evilC wrote:NM, just noticed this.blueeyiz702 wrote:Recoil() ;Recoil
So the real reasons emerge. I'm out.
i did not write that,i have not been on till just now,wtf.
- blueeyiz702
- Posts: 20
- Joined: 12 Dec 2017, 20:12
- Location: Las Vegas, Nevada
- Contact:
Re: MouseGetPos
if i wanted no recoil, i would have said that. None of my guns recoil i have over 20,000 kills why i need that? Duh i want to map keys to my xbox controller i use with computer.
Re: MouseGetPos
Seriously? You just lost all credibility.blueeyiz702 wrote:i did not write that,i have not been on till just now,wtf.
Who is online
Users browsing this forum: No registered users and 53 guests