Advertisement
Guest User

Untitled

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