Guest User

Untitled

a guest
May 22nd, 2015
1,772
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; Clicker Heroes Steam Version AutoHotkey script
  2. ; Version: 0.2.1
  3. ; Date: 5/22/2015
  4. ; Author: Andrux51 (http://github.com/Andrux51)
  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. ; The clicks per second should average roughly 50 consistently.
  9. ; (browser version... steam version avg. cps unknown)
  10. ; Other scripts may spike higher (I got as high as 90) but that is inconsistent.
  11. ;
  12. ; The script will not attempt to use skills in this version.
  13. ; These features may be added in the future but are not a priority for now.
  14. ;
  15. ; Instructions:
  16. ; - Run .ahk file
  17. ; - F7 will begin (and resume when paused) the clicker
  18. ; - F8 will pause the clicker
  19. ; - F9 will run at 1/4 speed (makes it easier to click for levels etc)
  20. ; - F10 will exit the script entirely
  21. ; - F11 will level the 4th character in the list (same position as Brittany by default)
  22. ; - F3 is the same as F7 but will not use abilities
  23. ;
  24. ; Change "timing" variable to suit your needs if the script is running too fast or slow.
  25. ;
  26.  
  27. #SingleInstance force ; if script is opened again, replace instance
  28. #Persistent ; script stays in memory until ExitApp is called or script crashes
  29.  
  30. global title := "Clicker Heroes" ; we will exact match against this for steam version
  31. global stop := false
  32.  
  33. ; change this value to adjust script speed (milliseconds)
  34. global timing := 150
  35.  
  36. ; pass in frequency to check for clickables
  37. ; ; higher number means more clicks on moving clickable, less often for other clickables
  38. global frequency := 0
  39.  
  40. ; F7 will begin/resume the auto-clicker
  41. F7::
  42.     frequency := 50
  43.     slacktivate(timing, frequency, false, true)
  44.     return
  45.  
  46. ; F11 will begin/resume the auto-clicker and level the 4th hero on the list
  47. F11::
  48.     frequency := 15
  49.     slacktivate(timing, frequency, true, true)
  50.     return
  51.  
  52. F3::
  53.     frequency := 50
  54.     slacktivate(timing, frequency, false, false)
  55.  
  56. ; F8 will pause the auto-clicker
  57. F8::
  58.     stop := true
  59.     return
  60.  
  61. ; F9 will allow for time to buy guys/skills etc without losing combo
  62. F9::
  63.     frequency := 1
  64.     slacktivate(timing * 4, frequency, false, false)
  65.     return
  66.  
  67. ; F10 will exit the script entirely
  68. F10::
  69.     ExitApp
  70.     return
  71.  
  72. ; pass in milliseconds to adjust click speed
  73. slacktivate(milli, p, levelup, useAbilities) {
  74.     stop := false
  75.     SetMouseDelay 0
  76.     SetControlDelay -1
  77.  
  78.     ; We get the title match for the Clicker Heroes game window
  79.     getWindowAttributes()
  80.  
  81.     i = 0
  82.     ; Send clicks to CH while the script is active (press F8 to stop)
  83.     while(!stop) {
  84.         ; try to catch skill bonus clickable
  85.         ; high priority- this requires a lot of focused clicks
  86.         getSkillBonusClickable()
  87.  
  88.         ; low priority- other clickables are moderately rare
  89.         if(i > p) {
  90.             ; try to get other clickables
  91.             getClickables()
  92.  
  93.             ; use abilities to power up
  94.             if(useAbilities) {
  95.                 useAbilities()
  96.             }
  97.  
  98.             ; if the script is set to level up the hero, do that here (25x)
  99.             if(levelup) {
  100.                 levelGildedHero()
  101.             }
  102.             i = 0
  103.         }
  104.  
  105.         i++
  106.         Sleep milli
  107.     }
  108.  
  109.     return
  110. }
  111.  
  112. getWindowAttributes() {
  113.     SetTitleMatchMode 3 ; window title contains the string supplied
  114.  
  115.     ; Activate window that contains Clicker Heroes
  116.     WinActivate %title%
  117.  
  118.     return
  119. }
  120.  
  121. levelGildedHero() {
  122.     ControlSend,, {z down}, %title%
  123.     Sleep 10
  124.     ControlClick, % "x" 60 " y" 600, %title%,,,, NA
  125.     ControlSend,, {z up}, %title%
  126.     Sleep 10
  127.  
  128.     return
  129. }
  130.  
  131. useAbilities() {
  132.     ; TODO: use abilities at more appropriate times
  133.  
  134.     ; due to the speed of this script, Clickstorm becomes almost useless
  135.     ; let's use it anyway just to be pressing buttons!
  136.     ControlSend,, 1, %title%
  137.  
  138.     ; use Powersurge
  139.     ControlSend,, 2, %title%
  140.  
  141.     ; use Lucky Strikes
  142.     ControlSend,, 3, %title%
  143.  
  144.     ; use Super Clicks
  145.     ControlSend,, 7, %title%
  146.  
  147.     ; use Metal Detector
  148.     ControlSend,, 4, %title%
  149.  
  150.     ; use Golden Clicks
  151.     ControlSend,, 5, %title%
  152.  
  153.     ; use Reload (best after Golden Clicks or Lucky Strikes?)
  154.     ControlSend,, 9, %title%
  155.  
  156.     return
  157. }
  158.  
  159. getSkillBonusClickable() {
  160.     ; click in a sequential area to try to catch mobile clickable
  161.     ControlClick, % "x" 780 " y" 160, %title%,,,, NA
  162.     ControlClick, % "x" 800 " y" 160, %title%,,,, NA
  163.     ControlClick, % "x" 880 " y" 160, %title%,,,, NA
  164.     ControlClick, % "x" 900 " y" 160, %title%,,,, NA
  165.     ControlClick, % "x" 980 " y" 160, %title%,,,, NA
  166.     ControlClick, % "x" 1000 " y" 160, %title%,,,, NA
  167.  
  168.     return
  169. }
  170.  
  171. getClickables() {
  172.     ; clickable positions
  173.     ControlClick, % "x" 515 " y" 490, %title%,,,, NA
  174.     ControlClick, % "x" 740 " y" 430, %title%,,,, NA
  175.     ControlClick, % "x" 755 " y" 480, %title%,,,, NA
  176.     ControlClick, % "x" 755 " y" 370, %title%,,,, NA
  177.     ControlClick, % "x" 860 " y" 510, %title%,,,, NA
  178.     ControlClick, % "x" 1000 " y" 455, %title%,,,, NA
  179.     ControlClick, % "x" 1040 " y" 440, %title%,,,, NA
  180.  
  181.     return
  182. }
Advertisement
Add Comment
Please, Sign In to add comment