Advertisement
Guest User

Untitled

a guest
Feb 4th, 2019
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #IfWinActive, Diablo II ahk_class Diablo II
  2.  
  3.  
  4. global Stop := 0    ;Variables defined within functions will only exist within that function
  5. global Wait := 0    ;Global variables are shared between functions
  6.  
  7. Numpad1::Start() ;
  8. Numpad2::Stop() ;Was this meant to intentionally be a reload or just a stop?
  9. Numpad4::Exit ;I assume you had this here as a kill-switch so I left it
  10.  
  11.  
  12.  
  13. Start() {
  14.     Stop++ ;Adds 1 to Stop
  15.     While(Stop > 0) && (WinActive("Diablo II")){ ;Will continue looping while Stop is greater than 0 and Diablo II is the active window
  16.         While(Wait = 0) && (Stop > 0) && (WinActive("Diablo II")){ ;If Wait does not equal 0, Stop is greater than 0, or Diablo II isn't the active window, this block is skipped, we return to the first "While"
  17.             Send, {F10}
  18.             Click, Right
  19.             Sleep 800
  20.             Send, {F11}
  21.             Click, Right
  22.             Sleep 800
  23.             Send, {F12}
  24.             Click, Right
  25.             ;Sleep 150
  26.             ;Send, {F9} ;Remove the semicolon before "Send" and "Sleep" to un-comment this line and restore fuctionality
  27.             Wait++ ;Adds 1 to Wait, so this block no longer fires
  28.             Wait() ;Begins the Wait() function
  29.             }
  30.         }
  31.     }
  32.    
  33. Wait() { ;This is in a separate function to allow the While(Stop > 0) loop to continue
  34.     Sleep 17000 ;17 seconds to allow the cooldowns to fully finish, can be configured to your liking
  35.     Wait := 0 ;Returns Wait to 0, allowing the block checking for it in Start() to function again
  36.     }
  37.    
  38. Stop() {
  39.     Stop := 0 ;Returns the Stop variable to 0, thereby ending the loop
  40.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement