Advertisement
waylaidwanderer

CUTBot.ahk

May 19th, 2016
2,358
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;======================================================================================
  2. ; Cut trees automatically in Dota 2! To use, open the mini-game, and turn on Caps Lock
  3. ; to activate the script. To deactivate it, turn off Caps Lock.
  4. ;======================================================================================
  5.  
  6. #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
  7. #Warn  ; Enable warnings to assist with detecting common errors.
  8. #Persistent
  9. #SingleInstance force
  10. SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
  11. SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
  12.  
  13. ;============================================================================
  14. ; These are X,Y coordinates of the top left and bottom left of the mini-game.
  15. ; You will need to change this if your resolution is not 1920x1080.
  16. ;============================================================================
  17.  
  18. TOPLEFT_X := 270
  19. TOPLEFT_Y := 246
  20. BOTTOMRIGHT_X := 1268
  21. BOTTOMRIGHT_Y := 872
  22.  
  23. ; You may optionally wish to modify these two values to better suit your tastes.
  24. INCREMENT_BY_X := 100 ; This is how many pixels the mouse will move horizontally before clicking.
  25. INCREMENT_BY_Y := 100 ; This is how many pixels the mouse will move vertically after it has finished 1 row.
  26.  
  27. ;==================================
  28. ; Don't change anything below here
  29. ;==================================
  30.  
  31. CURRENT_X := TOPLEFT_X
  32. CURRENT_Y := TOPLEFT_Y
  33. DISTANCE_X := BOTTOMRIGHT_X - TOPLEFT_X
  34. DISTANCE_Y := BOTTOMRIGHT_Y - TOPLEFT_Y
  35. CURRENT_DISTANCE_X := 0
  36. CURRENT_DISTANCE_Y := 0
  37.  
  38. #IfWinActive, DOTA 2
  39.  
  40. SetTimer, CutTrees, 0
  41. return
  42.  
  43. CutTrees:
  44. if (GetKeyState("capslock","T"))
  45. {      
  46.     Click %CURRENT_X%, %CURRENT_Y%
  47.     CURRENT_X += %INCREMENT_BY_X%
  48.     CURRENT_DISTANCE_X += %INCREMENT_BY_X% 
  49.     if (CURRENT_DISTANCE_X > DISTANCE_X)
  50.     {
  51.         Click %BOTTOMRIGHT_X%, %CURRENT_Y%
  52.         CURRENT_X := TOPLEFT_X
  53.         CURRENT_DISTANCE_X := 0
  54.         CURRENT_Y += %INCREMENT_BY_Y%
  55.         CURRENT_DISTANCE_Y += %INCREMENT_BY_Y%
  56.     }
  57.     if (CURRENT_DISTANCE_Y > DISTANCE_Y)
  58.     {
  59.         CURRENT_Y := TOPLEFT_Y
  60.         CURRENT_DISTANCE_Y := 0
  61.     }
  62. }
  63. else
  64. {
  65.     CURRENT_X := TOPLEFT_X
  66.     CURRENT_Y := TOPLEFT_Y
  67. }
  68. return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement