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 

Faster than "sleep 1"?

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





PostPosted: Sun May 10, 2009 5:30 pm    Post subject: Faster than "sleep 1"? Reply with quote

I'm looking for a script where when space is pressed, it can press space faster than it does in something like this:

Code:
*~$Space::
Sleep 200
Loop
{
    GetKeyState, SpaceState, Space, P
    If SpaceState = U
        break 
    Sleep 1
    Send, {Blind}{Space}
}
Return


The purpose of this is a "bunny hop" script for Counter-Strike: Source. It jumps rapidly, and when combined with strafing that I can easily do, it allows the player to move faster than he would if he simply walked. This works decently, but many times I'm finding it not efficient enough. If anyone could make one that would do so faster, or point me in the right direction to make my own, I'd appreciate it.

If it's not possible to do a loop faster than what I already have, just delete the thread. I don't know much about programming, so bear with me.[/code]
Back to top
Jex



Joined: 01 Aug 2008
Posts: 101

PostPosted: Sun May 10, 2009 5:47 pm    Post subject: Reply with quote

"Sleep 0" is faster then "Sleep 1"
And removing Sleep altogether is fastest.
_________________
Woot.

Please read forum etiquette
Back to top
View user's profile Send private message
Yandols



Joined: 29 Dec 2008
Posts: 29
Location: Malaysia

PostPosted: Mon May 11, 2009 10:35 am    Post subject: Reply with quote

If im not mistaken theres "sleep 0.1" "sleep 0.01" "sleep 0.001" but i don't think theres more.
Back to top
View user's profile Send private message Send e-mail Yahoo Messenger
Tseik



Joined: 09 Oct 2008
Posts: 180
Location: Finland

PostPosted: Mon May 11, 2009 11:55 am    Post subject: Reply with quote

Code:
*~$Space::
SetKeyDelay, 0
Sleep 200
Loop
{
    GetKeyState, SpaceState, Space, P
    If SpaceState = U
        break
    Send, {Blind}{Space}
}
Return

_________________
was i wrong, it makes me a very sad panda!
Back to top
View user's profile Send private message
Guest






PostPosted: Mon May 11, 2009 9:09 pm    Post subject: Reply with quote

sleep -1
Back to top
Lexikos



Joined: 17 Oct 2006
Posts: 7295
Location: Australia

PostPosted: Tue May 12, 2009 11:43 am    Post subject: Reply with quote

Yandols wrote:
If im not mistaken
You are. Even Sleep 1 typically sleeps for at least 10ms.
Dump wrote:
many times I'm finding it not efficient enough
The only way that you could jump as fast as that can send Space is if the game is hogging all CPU resources, leaving none for the script to operate. If you try the script with Notepad, you should see it sends keystrokes much faster than you could jump. It seems more likely that the script is sending Space (press and release) too fast for the game to detect. In that case, increase the duration of each press via SetKeyDelay.
Back to top
View user's profile Send private message 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