 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
ottosen
Joined: 30 Jul 2009 Posts: 1
|
Posted: Thu Jul 30, 2009 12:50 pm Post subject: Making RButton hold down 2 keys - need optimization |
|
|
Hey,
I've been reading through the help file that came with AutoHotKey, but that didn't give me a solution.
I got a macro that looks like this:
| Code: | ~RButton::
loop
{
if getkeystate("RButton", "p") ;if a button is Physically held down by the user.
{
send, {LShift DOWN}
send, {w DOWN}
sleep, 10
send, {LShift UP}
send, {w UP}
}
else
{
break
}
}
return |
When I press the right mouse button, it'll quickly hold down shift and w for a very short period of time. This is pretty much what I want to achieve, however, the faster I press the right mouse button the better.. Is there any way to make it only react to 1 single press at a time? Perhaps through a delay of half a second until the next key press.
Another problem is, if I press too fast, it won't even get to execute the "shift" and the "w".
Btw the reason I'm using this loop (found it on this forum), is because it's the only way I could make a game recognize a key being held down.
Thanks in advance for any help
PS: Is there a way I can disable/terminate AutoHotKey from within a game? The Pause button for pausing scripts doesn't work..and even if I tab out, and pause, the script is still active. Not until I terminate the program, it'll stop working. |
|
| Back to top |
|
 |
Hezzu
Joined: 08 Aug 2008 Posts: 117 Location: Raahe, Finland
|
Posted: Thu Jul 30, 2009 10:12 pm Post subject: |
|
|
Delay:
| Code: | ~RButton::
loop
{
if getkeystate("RButton", "p") ;if a button is Physically held down by the user.
{
sleep, 500 ;half a second
send, {LShift DOWN}
send, {w DOWN}
sleep, 10
send, {LShift UP}
send, {w UP}
}
else
{
break
}
}
return |
_________________ Hezzu - excuse the english! |
|
| 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
|