| View previous topic :: View next topic |
| Author |
Message |
pbrad Guest
|
Posted: Sun Nov 11, 2007 6:50 pm Post subject: Mouse to Key |
|
|
| Hi there, I'm new to the program - is it possible for example to move the mouse left instead of the keyboard d pad left, etc.. so the d pad is being controlled by the mouse? |
|
| Back to top |
|
 |
Xander
Joined: 23 Sep 2007 Posts: 140
|
Posted: Sun Nov 11, 2007 11:03 pm Post subject: |
|
|
Yes.
| Code: | | Left:: MouseMove, -1, 0, , R |
Should do the job. |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6847 Location: Pacific Northwest, US
|
Posted: Sun Nov 11, 2007 11:13 pm Post subject: |
|
|
he wans the other way around
You can probably adapt a gesture script?
dpad on keyboard or gamepad? _________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
Xander
Joined: 23 Sep 2007 Posts: 140
|
Posted: Sun Nov 11, 2007 11:21 pm Post subject: |
|
|
Ahh, is the mouse not suppose to move or is that not important? You'd probably have to poll for the mouse position every 10-50 ms depending on the response tolerance you require.
Probably would be best to reset the mouse to the middle of the screen after each poll as it could probably get stuck at the screen edge. |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6847 Location: Pacific Northwest, US
|
|
| Back to top |
|
 |
pbrad Guest
|
Posted: Tue Nov 13, 2007 8:58 am Post subject: |
|
|
| Thanks very much for replies, what I want to do is there are some "shoot them up" games and I got to use a joypad or keyboard to shoot, but I thought that maybe I could get the mouse to act as the d pad cause it would be a lot easier to play them! |
|
| Back to top |
|
 |
pbrad Guest
|
Posted: Tue Nov 13, 2007 9:19 am Post subject: |
|
|
| So I don't mind if the mouse to move the gamepads d pad or the keyboards d pad, but the keyboard would be more intresting as it could be used for other things, |
|
| Back to top |
|
 |
happytodd
Joined: 12 Nov 2007 Posts: 83 Location: South Australia
|
Posted: Tue Nov 13, 2007 9:32 am Post subject: Trust me! |
|
|
Where theres a will theres a way. _________________
 |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 6847 Location: Pacific Northwest, US
|
Posted: Tue Nov 13, 2007 5:11 pm Post subject: |
|
|
i was asking because AHK cannot simulate gamepad inputs, but can simulate keyboard. _________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM |
|
| Back to top |
|
 |
Xander
Joined: 23 Sep 2007 Posts: 140
|
Posted: Tue Nov 13, 2007 5:33 pm Post subject: |
|
|
| pbrad wrote: | | So I don't mind if the mouse to move the gamepads d pad or the keyboards d pad, but the keyboard would be more intresting as it could be used for other things, |
Did you get it working?
If not here is a short script that might be useful. It may be necessary to change SendMode to get it to work with different windows/games.
| Code: | #NoEnv
CoordMode, Mouse, Screen
CenterX := A_ScreenWidth/2
CenterY := A_ScreenHeight/2
MouseMove, CenterX, CenterY
SetTimer, PollMouse, 30
return
!x::
ExitApp
PollMouse:
MouseGetPos, x, y
if (x < CenterX) {
Loop, % CenterX - x
Send, {Left}
} else if (x > CenterX) {
Loop, % x - CenterX
Send, {Right}
}
if (y < CenterY) {
Loop, % CenterY - y
Send, {Up}
} else if (y > CenterY) {
Loop, % y - CenterY
Send, {Down}
}
MouseMove, CenterX, CenterY
return |
|
|
| Back to top |
|
 |
pbrad Guest
|
Posted: Wed Nov 14, 2007 1:17 pm Post subject: |
|
|
| thanks for helping, I havent got much further |
|
| Back to top |
|
 |
|