 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
SolSavant
Joined: 11 Jan 2008 Posts: 26
|
Posted: Fri Jun 27, 2008 2:05 am Post subject: move mouse using keys |
|
|
Hello,
Is there a way to move the mouse a predefined distance and direction by pressing a key? I've heard you can move it to a predefined location on the screen (maybe you can mention what that's called so I can read about it too) but what I'm after has nothing to do with the location. Rather, I want to be able to specify a distance and direction (like a vector)from wherever it happens to be when the key is pressed.
Thanks, Steve |
|
| Back to top |
|
 |
Krogdor
Joined: 18 Apr 2008 Posts: 1145 Location: The Interwebs
|
Posted: Fri Jun 27, 2008 2:25 am Post subject: |
|
|
Use the relative option on the MouseMove command.
For example:
MouseMove, 5,5,,R
will move the mouse 5 units up and 5 units to the right from the current psition. |
|
| Back to top |
|
 |
SolSavant
Joined: 11 Jan 2008 Posts: 26
|
Posted: Sat Jun 28, 2008 6:35 am Post subject: |
|
|
Thank you for explaining MouseMove. It's just what I needed. However, I'm having trouble with what I'm trying to use it for. The application is World of Warcraft and due to a spinal cord injury resulting in paralysis of my fingers, I have to rely on macros for many actions normally done with a mouse.
The specific move I am working on is for when a character is running and being chased by a foe. It involves the following actions which in my keyboard configuration occur by what is shown in parentheses:
Jump (press z key)
Rotate left or right while in the air (move mouse left or right)
Cast instant Fire Blast (press 7 key)
Fire Blast can only be cast while facing the target so this move enables the running character to jump, rotate in air, Fire Blast the pursuing foe, finish rotating, land, and contiue running -- all without losing forward momentum.
After testing MouseMove a few times, I found that a horizontal mouse movement of 800 results in 180 degrees of rotation during a jump.
I first created the following macro to see if the jump, half rotation and Fire Blast would take place:
F2::
Send {z}
MouseMove, -800, 0,, R
Send {7}
This worked great but of course the character ended up running towards the foe since the rotation was only 180 degrees. The problem I've run into is getting the remaning 180 degrees rotation and not losing the Fire Blast. I can either get the 180 and the blast or 360 and no blast but I haven't been able to get both. I think the problem may be due to the fact that the rotation is almost instantaneous and therefore the Fire Blast doesn't happen. I've tried several different combinations but nothing works (below).
Any suggestions would be great.
Thanks, Steve
F2::
Send {z}
MouseMove, -800, 0,, R
Send {7}
MouseMove, -800, 0, 50, R
F2::
Send {z}
MouseMove, -800, 0,, R
Send {7}
Sleep, 300
MouseMove, -800, 0, 50, R
F2::
Send {z}
MouseMove, -800, 0,, R
Sleep, 50
Send {7}
Sleep, 1000
Send {z}
Sleep, 50
MouseMove, -800, 0,, R |
|
| Back to top |
|
 |
[VxE]
Joined: 07 Oct 2006 Posts: 1496
|
Posted: Sat Jun 28, 2008 9:55 am Post subject: |
|
|
You can try putting | Code: | | Sendmode, PLAY ; INPUT may also work | at the top of your script. _________________ My Home Thread
More Common Answers: [1]. It's in the FAQ [2]. Ternary ( a ? b : c ) guide [3]. Post code inside [code][/code] tags ! |
|
| Back to top |
|
 |
SolSavant
Joined: 11 Jan 2008 Posts: 26
|
Posted: Sat Jun 28, 2008 6:53 pm Post subject: |
|
|
Thanks again for the reply but I'm not quite sure what you mean. Is it simply one of the following or something different? Thanks.
Sendmode, PLAY
F2::
Send {z}
MouseMove, -800, 0,, R
Send {7}
Sleep, 300
MouseMove, -800, 0, 50, R
F2::
Sendmode, PLAY
Send {z}
MouseMove, -800, 0,, R
Send {7}
Sleep, 300
MouseMove, -800, 0, 50, R |
|
| Back to top |
|
 |
andrei901
Joined: 20 Jan 2008 Posts: 27
|
Posted: Sun Jun 29, 2008 4:05 am Post subject: |
|
|
i would go with:
| Code: |
F2::
Send {z}
MouseMove, -800, 0,, R
Sleep, 100
Send, {7}
Sleep, 100
MouseMove, 800, 0,, R ; the +800 will allow your mouse to not for example crash into the side of the screen, and will result in the character turning left, then right
|
then again, my solutions always use the sleep command, and if your computer is fast enough, try setting the sleep lower till it stops working, till you get it just right. _________________ -andrei901, your local wannabe AHK expert |
|
| Back to top |
|
 |
SolSavant
Joined: 11 Jan 2008 Posts: 26
|
Posted: Thu Jul 03, 2008 4:26 pm Post subject: |
|
|
| that did it...thanx! |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|