Advertisement
Guest User

Clicker Heroes Bot

a guest
May 28th, 2015
8,612
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; Clicker Heroes Steam Version Bot
  2. ; Version: 0.1
  3. ; Date: 5/27/2015
  4. ; Author: FlyinPoulpus
  5.  
  6. ; This script will auto-click the Clicker Heroes game window while attempting
  7. ; to collect all "clickables" (currently Easter Eggs) including the moving one.
  8. ; It  will also round through the skills and perform the dark ritual combo every time
  9. ; your energize/reload combo is available. When the damaging skills are activated,
  10. ; the script try to reactivate autoprogress mode. This option must only be used if you know you'll
  11. ; only progress to the next five zones with the use of this skills. It can be counterproductive if you
  12. ; instakill everything.
  13. ; At last, it will autolevel Treebeast, Ivan and Brittany automatically. Every X loop (with X = candyPeriodCheck)
  14. ; the script will click once on the leveling button for each hero. This will be improved in later version
  15. ; (level only one hero or more? I'll have to decide)
  16. ;
  17. ; Instructions:
  18. ; - Run .ahk file
  19. ; - F2 : enable or disable skills use (default: enabled)
  20. ; - F4 : enable or disable autoprogress use (default: enabled)
  21. ; - F6 : enable or disable hero leveling (default: enabled)
  22. ; - F7 : starts the bot
  23. ; - F8 : stops the bot
  24. ; - F12 : exit the bot
  25. ;
  26. ; Change "timing" variable to suit your needs if the script is running too fast or slow.
  27. ;
  28. ; Additions in 0.3:
  29. ;   - Improved skills use to perform the dark ritual combo. The timing between two combos
  30. ;   can be configured by the user
  31. ;   - The script will now regularly reactivate auto progress mode every time it uses the
  32. ;   damage skills. This will allow you to progress the furthest possible. DO NOT use this
  33. ;   if you instakill everything since it will deactivate autoprogress each time a DR combi is called
  34. ;   - All the above additions were made optional through config variables. Just set what you
  35. ;   want to use to true.  
  36. ;
  37. ; TODO :
  38. ;   - Improve skills use (double damage/critical strikes could be used more often)
  39. ;   - Improve hero leveling
  40.  
  41. #SingleInstance force ; if script is opened again, replace instance
  42. #Persistent ; script stays in memory until ExitApp is called or script crashes
  43.  
  44. ; ================================================================================================================
  45. ; Configuration variables section
  46. global title := "Clicker Heroes" ; we will exact match against this for steam version
  47. global stop := false
  48. ; pass in the duration to wait between two dark ritual combos. Default value is 905K, aka 15 minutes
  49. ; + a safety delay of 5 seconds, which is the time required between two energize/reload
  50. ; when Vaargur is maxed out
  51. skillsCooldown := 900000
  52. ; determine how often the script will click on the candies possible spawning location (the lower
  53. ; the number, the more it'll check...)
  54. candyPeriodCheck := 25
  55. ; change this value to adjust script speed (milliseconds), must be a multiple of 10, the lower the faster
  56. ; 600 seems to be the best value for steam. You can use lower value but the game gets laggy.
  57. timing := 400
  58.  
  59. global useSkills := true
  60. global autoProgress := true
  61. global autoLevelHeroes := true
  62. ; ================================================================================================================
  63.  
  64. ; ================================================================================================================
  65. ; Key configuration section
  66.  
  67. ; F2: toggle skill use
  68. F2::
  69.     useSkills := !useSkills
  70.     return
  71.    
  72. ; F4: toggle autoprogress
  73. F4::
  74.     autoProgress := !autoProgress
  75.     return
  76.  
  77. ; F6: toggle hero leveling
  78. F6::
  79.     autoLevelHeroes := !autoLevelHeroes
  80.     return
  81.    
  82. ; F7: uses everything (clickables, leveling heroes, autoprogress, DR Combo)
  83. F7::
  84.     MainLoop(skillsCooldown, timing, candyPeriodCheck)
  85.     return
  86.  
  87. ; F8 will pause the auto-clicker
  88. F8::
  89.     stop := true
  90.     return
  91.  
  92. ; F10 will exit the script entirely
  93. F10::
  94.     ExitApp
  95.     return
  96. ; ================================================================================================================
  97.  
  98. ; ================================================================================================================
  99. ; Logic section
  100.  
  101. MainLoop(skillsCooldown, timing, candyPeriodCheck)
  102. {
  103.     stop := false
  104.     SetMouseDelay 0
  105.     SetControlDelay -1
  106.     maxLoops := ceil(skillsCooldown / timing) ; number of loops corresponding to the skills cooldown
  107.     drAlreadyActivated := false ; Dark ritual flag (allows to circle between the two DR combo sequence
  108.    
  109.     FileAppend, %A_Hour%:%A_Min%:%A_Sec% === MainLoop began `n, logs.txt
  110.    
  111.     GetWindowAttributes()
  112.  
  113.     i := 0
  114.    
  115.     while(!stop)
  116.     {
  117.        
  118.         ClickFlyingBugArea(timing)
  119.        
  120.         ; If DRCombo option is set and skills have been reloaded, launching appropriate combo
  121.         if(i > maxLoops && useSkills)
  122.         {
  123.             if(!drAlreadyActivated)
  124.             {
  125.                 FileAppend, %A_Hour%:%A_Min%:%A_Sec% === Sending first combo`n, logs.txt
  126.                 UseDamagingAbilities()
  127.                 UseEnergizeDRReload()
  128.                 drAlreadyActivated := true
  129.             }
  130.             else
  131.             {
  132.                 FileAppend, %A_Hour%:%A_Min%:%A_Sec% === Sending second combo`n, logs.txt
  133.                 UseEnergizeReload()
  134.                 UseDamagingAbilities()
  135.                 drAlreadyActivated := false
  136.             }
  137.             i := 0
  138.         }
  139.        
  140.         ; Every cendyPeriodCheck loop, levels hero (if activated) and checks for candies
  141.         if( mod(i, candyPeriodCheck) = 0 )
  142.         {
  143.             if( autoLevelHeroes )
  144.             {
  145.                 ControlClick, % "x" 60 " y" 360, %title%,,,, NA
  146.                 ControlClick, % "x" 60 " y" 470, %title%,,,, NA
  147.                 ControlClick, % "x" 60 " y" 570, %title%,,,, NA
  148.             }
  149.             ClickCandiesLocations()
  150.         }
  151.  
  152.         i++
  153.  
  154.     }
  155.  
  156.     return
  157. }
  158.  
  159. GetWindowAttributes()
  160. {
  161.     SetTitleMatchMode 3 ; window title contains the string supplied
  162.     WinActivate %title%
  163.  
  164.     return
  165. }
  166.  
  167. UseDamagingAbilities()
  168. {
  169.     ControlSend,, 2, %title%
  170.     ControlSend,, 3, %title%
  171.     ControlSend,, 4, %title%
  172.     ControlSend,, 5, %title%
  173.     ControlSend,, 7, %title%
  174.     FileAppend, %A_Hour%:%A_Min%:%A_Sec% === Sent damaging abilites`n, logs.txt
  175.    
  176.     if( autoProgress )
  177.     {
  178.         enableAutoProgress()
  179.     }
  180.  
  181.     return
  182. }
  183.  
  184. UseEnergizeReload()
  185. {
  186.     ControlSend,, 8, %title%
  187.     ControlSend,, 9, %title%
  188.     FileAppend, %A_Hour%:%A_Min%:%A_Sec% === Sent EN + Reload `n, logs.txt
  189.    
  190.     return
  191. }
  192.  
  193. UseEnergizeDRReload()
  194. {
  195.     ControlSend,, 8, %title%
  196.     ControlSend,, 6, %title%
  197.     ControlSend,, 9, %title%
  198.     FileAppend, %A_Hour%:%A_Min%:%A_Sec% === Sent full DR combo `n, logs.txt
  199.    
  200.     return
  201. }
  202.  
  203. EnableAutoProgress()
  204. {
  205.     ControlSend,, A, %title%
  206.     FileAppend, %A_Hour%:%A_Min%:%A_Sec% === Sent autoprogress`n, logs.txt
  207.    
  208.     return
  209. }
  210.  
  211. ; Clicks on the top of the screen where the flying bug can appear.
  212. ; If no bug is here, will still damage the main mob.
  213. ; Sleeps a bit between each click to smooth the visual result (less stress for the game)
  214. ClickFlyingBugArea(timing)
  215. {
  216.     clickNumber := 10
  217.     clickDelay := floor( timing / 10 )
  218.  
  219.     Loop, %clickNumber%
  220.     {
  221.         x_coord := 800 + ( 20 * A_Index )
  222.         ControlClick, % "x" x_coord " y" 160, %title%,,,, NA
  223.         Sleep clickDelay
  224.     }
  225.  
  226.     return
  227. }
  228.  
  229. ; Clicks on the 6 possible spawn location for candies
  230. ClickCandiesLocations()
  231. {
  232.     ControlClick, % "x" 527 " y" 486, %title%,,,, NA
  233.     ControlClick, % "x" 751 " y" 432, %title%,,,, NA
  234.     ControlClick, % "x" 758 " y" 380, %title%,,,, NA
  235.     ControlClick, % "x" 871 " y" 510, %title%,,,, NA
  236.     ControlClick, % "x" 1004 " y" 453, %title%,,,, NA
  237.     ControlClick, % "x" 1057 " y" 444, %title%,,,, NA
  238.  
  239.     return
  240. }
  241. ; ================================================================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement