AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Making RButton hold down 2 keys - need optimization

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
ottosen



Joined: 30 Jul 2009
Posts: 1

PostPosted: Thu Jul 30, 2009 12:50 pm    Post subject: Making RButton hold down 2 keys - need optimization Reply with quote

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 Smile

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
View user's profile Send private message
Hezzu



Joined: 08 Aug 2008
Posts: 117
Location: Raahe, Finland

PostPosted: Thu Jul 30, 2009 10:12 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group