Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

How to make a key press repeatedly while it's down


  • Please log in to reply
19 replies to this topic
ClarenceT
  • Guests
  • Last active:
  • Joined: --
Hi guys, what would i have to type down for:

If I hold down the W button, it will keep spamming W at 100times a second while it's down. And when I'm not holding down W anymore, it stops?

Thanks.

[Deleted double post. ~jaco0646]

MasterFocus
  • Moderators
  • 4323 posts
  • Last active: Jan 28 2016 01:38 AM
  • Joined: 08 Apr 2009
Next time, try searching.
Anyway...
$w::
  While GetKeyState("w","P")
  {
    Send, w
    Sleep, 10 ; every 10 miliseconds
  }
Return
If it's not fast enough, try SetBatchLines, -1 and/or remove the Sleep.

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Antonio França -- git.io -- github.com -- ahk4.net -- sites.google.com -- ahkscript.org

Member of the AHK community since 08/Apr/2009. Moderator since mid-2012.


ClarenceT
  • Guests
  • Last active:
  • Joined: --
oh thanks, can change the sleep to 1?

ClarenceT
  • Guests
  • Last active:
  • Joined: --
Is this Repeat or like repress. because i kinda needed repressing of the key. thx.

MasterFocus
  • Moderators
  • 4323 posts
  • Last active: Jan 28 2016 01:38 AM
  • Joined: 08 Apr 2009
"Why do Hotstrings, Send, and Click have no effect in certain games?"
<!-- m -->http://www.autohotke...s/FAQ.htm#games<!-- m -->

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Antonio França -- git.io -- github.com -- ahk4.net -- sites.google.com -- ahkscript.org

Member of the AHK community since 08/Apr/2009. Moderator since mid-2012.


ClarenceT
  • Guests
  • Last active:
  • Joined: --
Okay i'm ashamed to say i'm bad with computers. What does that mean?

ClarenceT
  • Guests
  • Last active:
  • Joined: --
could u please help me write it down?

ClarenceT
  • Guests
  • Last active:
  • Joined: --
Is it something like this?

$w::
While GetKeyState("w","P")
{
Send, w
SetKeyDelay, 0, 50
SetKeyDelay, 0, 50, Play
}
Return

I'm not sure how it should go.

Rapte_Of_Suzaku
  • Members
  • 901 posts
  • Last active: Jul 08 2011 02:12 PM
  • Joined: 29 Feb 2008
What isn't working? The code MasterFocus posted works. The code you posted even works.

None
  • Members
  • 3199 posts
  • Last active: Nov 05 2015 09:55 PM
  • Joined: 28 Nov 2009
SetKeyDelay, 0, 50 ;it does not need to be in the loop 

$w:: 

While GetKeyState("w","P") 

{ 

Send, w 

} 

Return


ClarenceT
  • Guests
  • Last active:
  • Joined: --
Well i wanted one that represses. cus i'm using one with xmouse that spams the mouse and the other with w (walk infront) this way it can animation cancel for my game.

ClarenceT
  • Guests
  • Last active:
  • Joined: --
Ok basically for the game, When i press attack there is an animation, but it cancels when i press W to move infront, this way i can attack fast. So i Already have a macro that spams my mouse 100times a second so anytime i want to fire, i hold on the mouse button and spam W with my other hand. What I would like is Where i could just hold down my mouse button and also just hold down on the W button, that way i can attack many times really fast without getting my fingers tired on the keyboard.

Rapte_Of_Suzaku
  • Members
  • 901 posts
  • Last active: Jul 08 2011 02:12 PM
  • Joined: 29 Feb 2008
The send command pushes the button then releases it.

But I'm not sure I understand the difference when you say "repress" vs "repeat".

Rapte_Of_Suzaku
  • Members
  • 901 posts
  • Last active: Jul 08 2011 02:12 PM
  • Joined: 29 Feb 2008
Try using MasterFocus' script in notepad. The script should work. If it doesn't work for a specific game, then that is an entirely separate issue. But the script does exactly what you originally asked for.

ClarenceT
  • Guests
  • Last active:
  • Joined: --
Which command was the one that sends are releases? Maybe I would have to use AutoHotkey with my mouse instead of using another program. If i were to do that, wat would i have to type if i wanted

When holding down the Mbutton, spam press the [Pause] Button?

thx to all who are helping me.