Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

1 Button Loop - Random Time (e.g: 0.3 - 0.5) between repeats



  • Please log in to reply
4 replies to this topic
Knox986
  • Members
  • 3 posts
  • Last active: May 21 2014 08:27 AM
  • Joined: 20 May 2014

Hey, So I have been browsing the forums for awhile trying to figure this all out, scripts are bit over my head but I managed to find the base of something that should do what I need, which is:

 

What I need help with...

I would like to press one button, say "e" on the keyboard which then repeatedly presses the number "5" untill I press "e" again.

The below does this (I think) what I need as an extra is that the times between the keypress/sending changes randomly so that its more human, and not picked up as a bot (see why below) so say picking a random time between 0.3 - 0.5 seconds each press.

 

Why I want the script...

In the Game Diablo 3, Theres a item called Wand of Woh, which you have to spam cast, this gets REALLY tiring really fast. So I was hoping to automate the pressing of this one button, but the game developers (Blizzard) are pretty strict with banning bot-like things, so I think the same key being pressed every 0.5 secs would get automatically banned.... :(

 

Current Script:

#MaxThreadsPerHotkey 2 
$+e:: 
PressKey := ! PressKey   ;Toggle PressKey True/False 
Loop 
{    
  If ! PressKey 
    Break         ;If PressKey is False, stop pressing key 
  Send +e 
  Sleep 500      ;Delay between keypresses 
} 
Return 
#MaxThreadsPerHotkey 1


RHCP
  • Members
  • 1228 posts
  • Last active: Apr 08 2017 06:17 PM
  • Joined: 29 May 2006
✓  Best Answer
$+e::
if (enable := !enable)
    setTimer, routine, -1
return

routine:
while enable
{
    Random, r, 300, 500
    sleep r
    sendInput +e
}
return 


Knox986
  • Members
  • 3 posts
  • Last active: May 21 2014 08:27 AM
  • Joined: 20 May 2014

Thanks for taking the time to reply @RHCP.

 

So would this be the final code and it would be "sending" the number "4" at random intervals between 0.3-0.5 seconds and toggled on and off by pressing "e" ?

$+e::
if (enable := !enable)
    setTimer, routine, -1
return

routine:
while enable
{
    Random, r, 300, 500
    sleep r
    sendInput +4
}
return 


RHCP
  • Members
  • 1228 posts
  • Last active: Apr 08 2017 06:17 PM
  • Joined: 29 May 2006

Within hotkey definitions and the send command the '+' character refers to the shift key.

 

It sends shift and 4 (shift modified). And it's toggled by pressing shift and e. 

 

Just remove the '+' characters if you don't want this.



Knox986
  • Members
  • 3 posts
  • Last active: May 21 2014 08:27 AM
  • Joined: 20 May 2014

Ah, I understand, Thanks!