Advertisement
Guest User

Clicker Heroes Steam Auto-clicker v0.3

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