djr242

Untitled

Aug 15th, 2015
520
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. ; Revision: 08/15/15 djr242
  6. ;
  7. ; This script will auto-click the Clicker Heroes game window while attempting
  8. ; to collect all "clickables" (currently Easter Eggs) including the moving one.
  9. ; Significant changes have been made to the original code.
  10. ;
  11. ; The script will attempt to use two seperate sequences for ability usage.
  12. ; There are also a couple of features to help speed leveling along.
  13. ;
  14. ; Instructions:
  15. ; - Run .ahk file
  16. ; - F1 will start progression
  17. ; - F2 will level up adventurer in slots 1-4 to 100 and buy all abilities.
  18. ; - F3 will level up the adventurer in slot 1 only by 100 levels (does not buy abilities)
  19. ; - F4 will begin/resume the auto-clicker (no ability usage or leveling)
  20. ; - F5 will begin/resume the auto-clicker and level the 1st hero on the list
  21. ; - F6 will allow for time to buy guys/skills etc without losing combo
  22. ; - F7 will pause the auto-clicker
  23. ; - F10 will exit the script entirely
  24. ;
  25. ; Change "timing" variable to suit your needs if the script is running too fast or slow.
  26. ;
  27.  
  28. #SingleInstance force ; if script is opened again, replace instance
  29. #Persistent ; script stays in memory until ExitApp is called or script crashes
  30.  
  31. global title := "Clicker Heroes" ; we will exact match against this for steam version
  32. global stop := false
  33.  
  34. ; change this value to adjust script speed (milliseconds)
  35. global timing := 100
  36. global looper := 0
  37.  
  38. ; pass in frequency to check for clickables
  39. ; higher number means more clicks on moving clickable, less often for other clickables
  40. global frequency := 200
  41.  
  42. ; F1 will start progression
  43. F1::
  44.     ControlClick,, %title%,,,, x1115 y250 NA
  45.     return
  46.  
  47. ; F2 will level up adventurer in slots 1-4 to 100 and buy all abilities.
  48. F2::
  49.    
  50.    l := 1
  51.     while(l < 5) {
  52.     levelSlot(l)
  53.     l++
  54.     }
  55.    return
  56.  
  57. ; F3 will level up the adventurer in slot 1 only by 100 levels (does not buy abilities)
  58. F3::
  59.  
  60.     clickHeroInSlot(1, 1)
  61.     return
  62.  
  63. ; F4 will begin/resume the auto-clicker (no ability usage or leveling)
  64. F4::
  65.     frequency := 50
  66.     autoClicker(timing, frequency, false, false)
  67.     return
  68.  
  69. ; F5 will begin/resume the auto-clicker and level the 1st hero on the list
  70. F5::
  71.     frequency := 100
  72.     autoClicker(timing, frequency, true, true)
  73.     return
  74.  
  75. ; F6 will allow for time to buy guys/skills etc without losing combo
  76. F6::
  77.     while(!stop) {
  78.     getClickables()
  79.     sleep 9000
  80.     }
  81.     return
  82.  
  83. ; F7 will pause the auto-clicker
  84. F7::
  85.     stop := true
  86.     return
  87.  
  88. ; F10 will exit the script entirely
  89. F10::
  90.     ExitApp
  91.     return
  92.  
  93. ; pass in milliseconds to adjust click speed
  94. autoClicker(milli, p, levelup, useAbilities) {
  95.     stop := false
  96.  
  97.     setDefaults()
  98.  
  99.     i = 0
  100.     while(!stop) {
  101.         getSkillBonusClickable()
  102.  
  103.         if(i > p) {
  104.             getClickables()
  105.  
  106.             if(levelup) {
  107.                 clickHeroInSlot(1, 1)
  108.                 }
  109.         if(useAbilities) {
  110.             r :=1
  111.                 if(r < 3) {
  112.            if(r=1) {
  113.             useAbilities(1)
  114.             }
  115.            if(r=2) {
  116.             useAbilities(2)
  117.             }
  118.            }
  119.             }
  120.         r++
  121.         i = 0
  122.         }
  123.  
  124.     i++
  125.     Sleep milli
  126.     }
  127.  
  128.     return
  129. }
  130.  
  131. useAbilities(type) {
  132.     if(type=1) {
  133.         useAbility1()
  134.         useAbility2()
  135.         useAbility3()
  136.         useAbility9()
  137.         useAbility4()
  138.         useAbility5()
  139.     }
  140.     if(type=2) {
  141.         useAbility8()
  142.         useAbility3()
  143.         useAbility7()
  144.         useAbility6()
  145.     }
  146.     return
  147. }
  148.  
  149. useAbility1() {
  150.     ; 1. Clickstorm
  151.     ControlClick,, %title%,,,, x600 y170 NA
  152.     return
  153. }
  154. useAbility2() {
  155.     ; 2. Powersurge
  156.     ControlClick,, %title%,,,, x600 y220 NA
  157.     return
  158. }
  159. useAbility3() {
  160.     ; 3. Lucky Strikes
  161.     ControlClick,, %title%,,,, x600 y270 NA
  162.     return
  163. }
  164. useAbility4() {
  165.     ; 4. Metal Detector
  166.     ControlClick,, %title%,,,, x600 y325 NA
  167.     return
  168. }
  169. useAbility5() {
  170.     ; 5. Golden Clicks
  171.     ControlClick,, %title%,,,, x600 y375 NA
  172.     return
  173. }
  174. useAbility6() {
  175.     ; 6. Dark Ritual
  176.     ControlClick,, %title%,,,, x600 y425 NA
  177.     return
  178. }
  179. useAbility7() {
  180.     ; 7. Super Clicks
  181.     ControlClick,, %title%,,,, x600 y480 NA
  182.     return
  183. }
  184. useAbility8() {
  185.     ; 8. Energize
  186.     ControlClick,, %title%,,,, x600 y530 NA
  187.     return
  188. }
  189. useAbility9() {
  190.     ; 9. Reload
  191.     ControlClick,, %title%,,,, x600 y580 NA
  192.     return
  193. }
  194.  
  195. getSkillBonusClickable() {
  196.     ; click in a sequential area to try to catch mobile clickable
  197.     ControlClick,, %title%,,,, x770 y130 NA
  198.     ControlClick,, %title%,,,, x790 y130 NA
  199.     ControlClick,, %title%,,,, x870 y130 NA
  200.     ControlClick,, %title%,,,, x890 y130 NA
  201.     ControlClick,, %title%,,,, x970 y130 NA
  202.     ControlClick,, %title%,,,, x990 y130 NA
  203.  
  204.     return
  205. }
  206.  
  207. getClickables() {
  208.     ; clickable positions
  209.     ControlClick,, %title%,,,, x505 y460 NA
  210.     ControlClick,, %title%,,,, x730 y400 NA
  211.     ControlClick,, %title%,,,, x745 y450 NA
  212.     ControlClick,, %title%,,,, x745 y340 NA
  213.     ControlClick,, %title%,,,, x850 y480 NA
  214.     ControlClick,, %title%,,,, x990 y425 NA
  215.     ControlClick,, %title%,,,, x1030 y410 NA
  216.  
  217.     return
  218. }
  219.  
  220.  
  221. setDefaults() {
  222.     SendMode InputThenPlay
  223.     CoordMode, Mouse, Client
  224.     SetKeyDelay, 0, 0
  225.     SetMouseDelay 2 ; anything lower becomes unreliable for scrolling
  226.     SetControlDelay 2 ; anything lower becomes unreliable for scrolling
  227.     SetTitleMatchMode 3 ; window title is an exact match of the string supplied
  228.  
  229.     return
  230. }
  231.  
  232.  
  233. clickHeroInSlot(slot, times) {
  234.     if(slot = 1) {
  235.     send {Ctrl down}
  236.         ControlClick,, %title%,,, %times%, x50 y250 NA
  237.     send {Ctrl up}
  238.     }
  239.     if(slot = 2) {
  240.     send {Ctrl down}
  241.         ControlClick,, %title%,,, %times%, x50 y356 NA
  242.     send {Ctrl up}
  243.     }
  244.     if(slot = 3) {
  245.     send {Ctrl down}
  246.         ControlClick,, %title%,,, %times%, x50 y462 NA
  247.     send {Ctrl up}
  248.     }
  249.     if(slot = 4) {
  250.     send {Ctrl down}
  251.         ControlClick,, %title%,,, %times%, x50 y568 NA
  252.     send {Ctrl up}
  253.     }
  254.     return
  255. }
  256.  
  257. levelSlot(number) {
  258.     if(number = 1) {
  259.            clickHeroInSlot(1, 2)
  260.            Sleep 100
  261.     buyUpgrades(1)
  262.     }
  263.     if(number = 2) {
  264.            clickHeroInSlot(2, 2)
  265.            Sleep 100
  266.     buyUpgrades(2)
  267.     }
  268.     if(number = 3) {
  269.            clickHeroInSlot(3, 2)
  270.            Sleep 100
  271.     buyUpgrades(3)
  272.     }
  273.     if(number = 4) {
  274.            clickHeroInSlot(4, 2)
  275.            Sleep 100
  276.     buyUpgrades(4)
  277.     }
  278.  
  279.     return
  280. }
  281.  
  282. buyUpgrades(slot) {
  283.     if(slot = 1) {
  284.     ControlClick,, %title%,,,, x190 y250 NA
  285.     Sleep 5
  286.     ControlClick,, %title%,,,, x230 y250 NA
  287.     Sleep 5
  288.     ControlClick,, %title%,,,, x265 y250 NA
  289.     Sleep 5
  290.     ControlClick,, %title%,,,, x300 y250 NA
  291.     Sleep 5
  292.     ControlClick,, %title%,,,, x340 y250 NA
  293.     Sleep 5
  294.     ControlClick,, %title%,,,, x370 y250 NA
  295.     Sleep 5
  296.     ControlClick,, %title%,,,, x413 y250 NA
  297.     }
  298.     if(slot = 2) {
  299.     ControlClick,, %title%,,,, x190 y355 NA
  300.     Sleep 5
  301.     ControlClick,, %title%,,,, x230 y355 NA
  302.     Sleep 5
  303.     ControlClick,, %title%,,,, x265 y355 NA
  304.     Sleep 5
  305.     ControlClick,, %title%,,,, x300 y355 NA
  306.     Sleep 5
  307.     ControlClick,, %title%,,,, x340 y355 NA
  308.     Sleep 5
  309.     ControlClick,, %title%,,,, x370 y355 NA
  310.     Sleep 5
  311.     ControlClick,, %title%,,,, x413 y355 NA
  312.     }
  313.     if(slot = 3) {
  314.     ControlClick,, %title%,,,, x190 y465 NA
  315.     Sleep 5
  316.     ControlClick,, %title%,,,, x230 y465 NA
  317.     Sleep 5
  318.     ControlClick,, %title%,,,, x265 y465 NA
  319.     Sleep 5
  320.     ControlClick,, %title%,,,, x300 y465 NA
  321.     Sleep 5
  322.     ControlClick,, %title%,,,, x340 y465 NA
  323.     Sleep 5
  324.     ControlClick,, %title%,,,, x370 y465 NA
  325.     Sleep 5
  326.     ControlClick,, %title%,,,, x413 y465 NA
  327.     }
  328.     if(slot = 4) {
  329.     ControlClick,, %title%,,,, x190 y570 NA
  330.     Sleep 5
  331.     ControlClick,, %title%,,,, x230 y570 NA
  332.     Sleep 5
  333.     ControlClick,, %title%,,,, x265 y570 NA
  334.     Sleep 5
  335.     ControlClick,, %title%,,,, x300 y570 NA
  336.     Sleep 5
  337.     ControlClick,, %title%,,,, x340 y570 NA
  338.     Sleep 5
  339.     ControlClick,, %title%,,,, x370 y570 NA
  340.     Sleep 5
  341.     ControlClick,, %title%,,,, x413 y570 NA
  342.     }
  343.    
  344.     return
  345. }
Advertisement
Add Comment
Please, Sign In to add comment