Advertisement
Guest User

Clicker Heroes Steam Auto-clicker v0.3

a guest
May 28th, 2015
2,011
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.3
  3. ; Date: 5/28/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 := 75
  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.  
  71.     ; We get the title match for the Clicker Heroes game window
  72.     setDefaults()
  73.  
  74.     i = 0
  75.     ; Send clicks to CH while the script is active (press F8 to stop)
  76.     while(!stop) {
  77.         ; try to catch skill bonus clickable
  78.         ; high priority- this requires a lot of focused clicks
  79.         getSkillBonusClickable()
  80.  
  81.         ; low priority- other clickables are moderately rare
  82.         if(i > p) {
  83.             ; try to get other clickables
  84.             getClickables()
  85.  
  86.             ; use abilities to power up
  87.             useAbilities()
  88.  
  89.             ; if the script is set to level up the hero, do that here
  90.             if(levelup) {
  91.                 clickHeroInSlot(4, 25)
  92.                 ControlClick,, %title%,,,, x190 y590 NA
  93.                 ControlClick,, %title%,,,, x226 y590 NA
  94.                 ControlClick,, %title%,,,, x262 y590 NA
  95.                 ControlClick,, %title%,,,, x298 y590 NA
  96.             }
  97.             i = 0
  98.         }
  99.  
  100.         i++
  101.         Sleep milli
  102.     }
  103.  
  104.     return
  105. }
  106.  
  107. useAbilities() {
  108.     ; TODO: use abilities at more appropriate times
  109.     ; Combos: 123457, 1234, 12
  110.  
  111.     useAbility1()
  112.     useAbility2()
  113.     useAbility3()
  114.     useAbility4()
  115.     useAbility8()
  116.     useAbility5()
  117.     ;useAbility9() ; need to not press 5 again after Reload happens (Reload is currently
  118.  
  119. wasted)
  120.     useAbility7()
  121.  
  122.     return
  123. }
  124.  
  125. useAbility1() {
  126.     ; 1. Clickstorm
  127.     ControlClick,, %title%,,,, x600 y170 NA
  128.     return
  129. }
  130. useAbility2() {
  131.     ; 2. Powersurge
  132.     ControlClick,, %title%,,,, x600 y220 NA
  133.     return
  134. }
  135. useAbility3() {
  136.     ; 3. Lucky Strikes
  137.     ControlClick,, %title%,,,, x600 y270 NA
  138.     return
  139. }
  140. useAbility4() {
  141.     ; 4. Metal Detector
  142.     ControlClick,, %title%,,,, x600 y325 NA
  143.     return
  144. }
  145. useAbility5() {
  146.     ; 5. Golden Clicks
  147.     ControlClick,, %title%,,,, x600 y375 NA
  148.     return
  149. }
  150. useAbility6() {
  151.     ; 6. Dark Ritual
  152.     ControlClick,, %title%,,,, x600 y425 NA
  153.     return
  154. }
  155. useAbility7() {
  156.     ; 7. Super Clicks
  157.     ControlClick,, %title%,,,, x600 y480 NA
  158.     return
  159. }
  160. useAbility8() {
  161.     ; 8. Energize
  162.     ControlClick,, %title%,,,, x600 y530 NA
  163.     return
  164. }
  165. useAbility9() {
  166.     ; 9. Reload (best after Golden Clicks or Lucky Strikes?)
  167.     ControlClick,, %title%,,,, x600 y580 NA
  168.     return
  169. }
  170.  
  171. getSkillBonusClickable() {
  172.     ; click in a sequential area to try to catch mobile clickable
  173.     ControlClick,, %title%,,,, x770 y130 NA
  174.     ControlClick,, %title%,,,, x790 y130 NA
  175.     ControlClick,, %title%,,,, x870 y130 NA
  176.     ControlClick,, %title%,,,, x890 y130 NA
  177.     ControlClick,, %title%,,,, x970 y130 NA
  178.     ControlClick,, %title%,,,, x990 y130 NA
  179.  
  180.     return
  181. }
  182.  
  183. getClickables() {
  184.     ; clickable positions
  185.     ControlClick,, %title%,,,, x505 y460 NA
  186.     ControlClick,, %title%,,,, x730 y400 NA
  187.     ControlClick,, %title%,,,, x745 y450 NA
  188.     ControlClick,, %title%,,,, x745 y340 NA
  189.     ControlClick,, %title%,,,, x850 y480 NA
  190.     ControlClick,, %title%,,,, x990 y425 NA
  191.     ControlClick,, %title%,,,, x1030 y410 NA
  192.  
  193.     return
  194. }
  195.  
  196. F2::
  197.     setDefaults()
  198.     doMidasStart()
  199.     return
  200.  
  201. setDefaults() {
  202.     SendMode InputThenPlay
  203.     CoordMode, Mouse, Client
  204.     SetKeyDelay, 0, 0
  205.     SetMouseDelay 1 ; anything lower becomes unreliable for scrolling
  206.     SetControlDelay 1 ; anything lower becomes unreliable for scrolling
  207.     SetTitleMatchMode 3 ; window title is an exact match of the string supplied
  208.  
  209.     return
  210. }
  211.  
  212. clickDownArrow(times) {
  213.     i = 0
  214.     while(i < times) {
  215.         ControlClick,, %title%,,,, x545 y625 NA
  216.         Sleep 350
  217.         i++
  218.     }
  219.  
  220.     return
  221. }
  222.  
  223. clickForwardArrow(times) {
  224.     ControlClick,, %title%,,, %times%, x1035 y40 NA
  225.     return
  226. }
  227.  
  228. clickZone() {
  229.     ControlClick,, %title%,,,, x980 y40 NA
  230.     return
  231. }
  232.  
  233. clickHeroInSlot(slot, times) {
  234.     if(slot = 1) {
  235.         ControlClick,, %title%,,, %times%, x50 y250 NA
  236.     }
  237.     if(slot = 2) {
  238.         ControlClick,, %title%,,, %times%, x50 y356 NA
  239.     }
  240.     if(slot = 3) {
  241.         ControlClick,, %title%,,, %times%, x50 y462 NA
  242.     }
  243.     if(slot = 4) {
  244.         ControlClick,, %title%,,, %times%, x50 y568 NA
  245.     }
  246.     return
  247. }
  248.  
  249. slacktivation() {
  250.     setDefaults()
  251.  
  252.     return
  253. }
  254.  
  255. global looper := 0
  256.  
  257. getNatalia() {
  258.     ; with Khrysos maxed, Natalia is near the bottom of the list after ascension
  259.     scrollToListBottom()
  260.  
  261.     clickHeroInSlot(2, 1)
  262.  
  263.     return
  264. }
  265.  
  266. scrollToFarmZone(zone) {
  267.     ; subtract 3 because zone 3 is already on screen,
  268.     ; so it takes 3 less clicks to get there than the zone number
  269.     clicksToFarmZone := zone - 3
  270.     while(looper < clicksToFarmZone) {
  271.         clickForwardArrow(1)
  272.         Sleep 5
  273.         looper++
  274.     }
  275.  
  276.     ; let the screen catch up, then go to zone
  277.     Sleep 300
  278.     clickZone()
  279.  
  280.     ; reset the looping variable so we can reuse it
  281.     looper := 0
  282.  
  283.     return
  284. }
  285.  
  286. scrollToMidas() {
  287.     ; the number of clicks to scroll to Midas
  288.     ;clicksToMidas := 9
  289.     ;clickDownArrow(clicksToMidas)
  290.  
  291.     ; ControlClick,, %title%,,, %times%, x545 y490 NA
  292.  
  293.     ControlClick,, %title%,,,, x545 y494 NA
  294.    
  295.     ; let the screen catch up, then buy
  296.     Sleep 300
  297.     clickHeroInSlot(4, 1)
  298.  
  299.     return
  300. }
  301.  
  302. levelMidasUp() {
  303.     ; since we already have one level for Midas, we only need 99 more
  304.     while(looper < 15) {
  305.         collectGold()
  306.         clickHeroInSlot(4, 10)
  307.         Sleep 1
  308.         looper++
  309.     }
  310.  
  311.     ; reset the looping variable so we can reuse it
  312.     looper := 0
  313.  
  314.     return
  315. }
  316.  
  317. buyMidasUpgrades() {
  318.     ; buy all 5 upgrades to Midas
  319.     ControlClick,, %title%,,,, x190 y570 NA
  320.     Sleep 5
  321.     ControlClick,, %title%,,,, x226 y570 NA
  322.     Sleep 5
  323.     ControlClick,, %title%,,,, x262 y570 NA
  324.     Sleep 5
  325.     ControlClick,, %title%,,,, x298 y570 NA
  326.     Sleep 5
  327.     ControlClick,, %title%,,,, x334 y570 NA
  328.    
  329.     return
  330. }
  331.  
  332. collectGold() {
  333.     ControlClick,, %title%,,,, d x760 y420 NA
  334.     Sleep 5
  335.     ControlClick,, %title%,,,, d x800 y420 NA
  336.     Sleep 5
  337.     ControlClick,, %title%,,,, d x850 y420 NA
  338.     Sleep 5
  339.     ControlClick,, %title%,,,, d x910 y420 NA
  340.     Sleep 5
  341.     ControlClick,, %title%,,,, u x5 y300 NA
  342.  
  343.     return
  344. }
  345.  
  346. ; Before running this function, Idle mode should be engaged
  347. ; (have Siyalatas & no clicks for 1 minute)
  348. doMidasStart() {
  349.     ; milliseconds to wait before gathering gold
  350.     waitForGold := 10000
  351.  
  352.     ; 1. Scroll to a (non-boss) level in the 60's to farm some quick gold
  353.     scrollToFarmZone(61)
  354.     Sleep 500
  355.  
  356.     ; 2. Scroll down to  Natalia and buy a single level
  357.     getNatalia()
  358.  
  359.     ; 3. Pause for a moment to let gold rack up to buy Midas
  360.     ; *important* You can't scroll down until some gold has been collected
  361.     ; - try not to collect too much or it will skew the scroll bar
  362.     Sleep %waitForGold%
  363.     collectGold()
  364.     Sleep 2000
  365.  
  366.     ; 4. Scroll down to Midas and buy a single level
  367.     scrollToMidas()
  368.  
  369.     ; 5. Collect gold so we can buy 100 levels of Midas
  370.     Sleep %waitForGold%/3
  371.     collectGold()
  372.     Sleep 300
  373.  
  374.     ; 6. Level Midas to 100 and buy his abilities (golden clicks esp.)
  375.     levelMidasUp()
  376.     buyMidasUpgrades()
  377.  
  378.     ; 7. Turn on Progression Mode to go to the highest available level
  379.     ControlClick,, %title%,,,, x1110 y250 NA
  380.  
  381.     ; 8. Use Golden Clicks to rack up a ton of gold very quickly
  382.     useAbility5()
  383.  
  384.     getSkillBonusClickable()
  385.     getClickables()
  386.  
  387.     Sleep 100
  388.  
  389.     ; 9. Level up all the early heroes for bonuses like crit clicks, dps %, etc.
  390.     levelAllHeroes()
  391.  
  392.     Sleep 500
  393.     ControlClick,, %title%,,,, x545 y544 NA
  394.     Sleep 500
  395.  
  396.     ; 10. Turn on auto-clicker. You should now scroll to your gilded hero and buy it up!
  397.     Send {F11}
  398.  
  399.     ; 11. This function could be more complete if it scrolled to the gilded hero
  400.     ; but since scroll speed changes with the amount of moneys, it's difficult
  401.     ; (rake it in)
  402.     ; down arrow 19x @555, 650
  403.     ; ctrl-click @ gilded hero position (Frostleaf)
  404.     ; click through upgrades
  405.  
  406.     return
  407. }
  408.  
  409. levelAllHeroes() {
  410.     scrollToListTop()
  411.  
  412.     ; buy 200 levels at a time
  413.     ; something has to be better than doing it this way...
  414.     ; ControlSend messes up other keyboard usage when it's happening
  415.     clickHeroInSlot(1, 100)
  416.     clickHeroInSlot(2, 100)
  417.     clickHeroInSlot(3, 100)
  418.     clickHeroInSlot(4, 100)
  419.  
  420.     Sleep 500
  421.     ControlClick,, %title%,,,, x545 y298 NA
  422.     Sleep 500
  423.     clickHeroInSlot(1, 100)
  424.     clickHeroInSlot(2, 100)
  425.     clickHeroInSlot(3, 100)
  426.     clickHeroInSlot(4, 100)
  427.  
  428.     Sleep 500
  429.     ControlClick,, %title%,,,, x545 y350 NA
  430.     Sleep 500
  431.     clickHeroInSlot(1, 100)
  432.     clickHeroInSlot(2, 100)
  433.     clickHeroInSlot(3, 100)
  434.     clickHeroInSlot(4, 100)
  435.  
  436.     Sleep 500
  437.     ControlClick,, %title%,,,, x545 y402 NA
  438.     Sleep 500
  439.     clickHeroInSlot(1, 100)
  440.     clickHeroInSlot(2, 100)
  441.     clickHeroInSlot(3, 100)
  442.     clickHeroInSlot(4, 25) ; Midas
  443.  
  444.     Sleep 500
  445.     ControlClick,, %title%,,,, x545 y454 NA
  446.     Sleep 500
  447.     clickHeroInSlot(1, 125)
  448.     clickHeroInSlot(2, 100)
  449.     clickHeroInSlot(3, 100)
  450.     clickHeroInSlot(4, 150)
  451.  
  452.     Sleep 500
  453.     ControlClick,, %title%,,,, x545 y506 NA
  454.     Sleep 500
  455.     clickHeroInSlot(1, 100)
  456.     clickHeroInSlot(2, 100)
  457.     clickHeroInSlot(3, 100)
  458.     clickHeroInSlot(4, 100)
  459.  
  460.     Sleep 500
  461.     scrollToListBottom()
  462.     clickHeroInSlot(1, 100)
  463.     clickHeroInSlot(2, 100)
  464.  
  465.  
  466.  
  467.     ; at this point everyone is leveled down to Atlas
  468.  
  469.     ; Buy all available upgrades
  470.     Sleep 300
  471.     ControlClick,, %title%,,,, x280 y550 NA
  472.  
  473.     return
  474. }
  475.  
  476. scrollToListTop() {
  477.     ; scroll to the top of the hero list
  478.     ControlClick,, %title%,,,, x545 y208 NA
  479.     ; This pause is needed so the screen can catch up
  480.     Sleep 350
  481.     return
  482. }
  483.  
  484. scrollToListBottom() {
  485.     ; Scroll to far bottom of the hero list
  486.     ControlClick,, %title%,,,, x545 y605 NA
  487.     ; This pause is needed so the screen can catch up
  488.     Sleep 350
  489.     return
  490. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement