RinArenna

Heroes Clicker

May 21st, 2015
6,924
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;
  2. ; AutoHotkey Version: 1.x
  3. ; Language:       English
  4. ; Platform:       Win9x/NT
  5. ; Author:         CrownFox
  6. ;
  7. ; Script Function:
  8. ;   Maximize Returns from Clicker Heroes
  9. ;
  10.  
  11. ;F7 Run the clicker
  12.    
  13. ;F8 Stop the clicker
  14.  
  15. ;F9 Toggle Hero Level
  16. global heroslot := 3
  17. global leveluphero := false
  18.    
  19. ;F10 Toggle Click Speed
  20. global clickdelay := 50 ;Delay after each click
  21. global multi = 1 ;Regular Speed
  22. global multialt = 0.5 ;Fast Speed
  23.  
  24. ;F11 Exit the clicker
  25.  
  26. #NoEnv  ;Recommended for performance and compatibility with future AutoHotkey releases.
  27. SendMode Input  ;Recommended for new scripts due to its superior speed and reliability.
  28. SetWorkingDir %A_ScriptDir%  ;Ensures a consistent starting directory.
  29. #SingleInstance force ;if script is opened again, replace instance
  30. #Persistent ;script stays in memory until ExitApp is called or script crashes
  31.  
  32.  
  33. ;Setup script title and current state
  34. global title := "Clicker Heroes"
  35. global gui := true
  36. global running := false
  37. global Count := 0
  38.  
  39. ;Setup ability variables
  40.  
  41. global abil_1 := true
  42. global abil_2 := true
  43. global abil_3 := true
  44. global abil_4 := true
  45. global abil_5 := true
  46. global abil_6 := true
  47. global abil_7 := true
  48. global abil_8 := true
  49. global abil_9 := true
  50.  
  51. global abilend_1 := 0
  52. global abilend_2 := 0
  53. global abilend_3 := 0
  54. global abilend_4 := 0
  55. global abilend_5 := 0
  56. global abilend_6 := 0
  57. global abilend_7 := 0
  58. global abilend_8 := 0
  59. global abilend_9 := 0
  60.  
  61. global abilname_1 := "Clickstorm"
  62. global abilname_2 := "Powersurge"
  63. global abilname_3 := "Lucky Strikes"
  64. global abilname_4 := "Metal Detector"
  65. global abilname_5 := "Golden Clicks"
  66. global abilname_6 := "The Dark Ritual"
  67. global abilname_7 := "Super Clicks"
  68. global abilname_8 := "Energize"
  69. global abilname_9 := "Reload"
  70.  
  71.  
  72. global lastabil := 0
  73.  
  74. global abilc_1 := 600000
  75. global abilc_2 := 600000
  76. global abilc_3 := 1800000
  77. global abilc_4 := 1800000
  78. global abilc_5 := 3600000
  79. global abilc_6 := 28800000
  80. global abilc_7 := 3600000
  81. global abilc_8 := 3600000
  82. global abilc_9 := 3600000
  83.  
  84. Gui,Font,S14 W550,Arial
  85. Gui,Add,Text,vCPS x0 y5 w250 h40 +Center,Clicks Per Second
  86.  
  87. Gui,Font,S25 CDefault Bold,Arial
  88. Gui,Add,Text,vText x0 y25 w250 h40 +Center,%Count%
  89.  
  90. Gui,Font,S10 CDefault Bold,Arial
  91. Gui,Add,Text,x5 y70 w125 h15 +Left,Clickstorm:
  92. Gui,Add,Text,vTimer1 x120 y70 w125 h15 +Right,Ready
  93.  
  94. Gui,Font,S10 CDefault Bold,Arial
  95. Gui,Add,Text,x5 y85 w125 h15 +Left,Powersurge:
  96. Gui,Add,Text,vTimer2 x120 y85 w125 h15 +Right,Ready
  97.  
  98. Gui,Font,S10 CDefault Bold,Arial
  99. Gui,Add,Text, x5 y100 w125 h15 +Left,Lucky Strikes:
  100. Gui,Add,Text,vTimer3 x120 y100 w125 h15 +Right,Ready
  101.  
  102. Gui,Font,S10 CDefault Bold,Arial
  103. Gui,Add,Text, x5 y115 w125 h15 +Left,Metal Detector:
  104. Gui,Add,Text,vTimer4 x120 y115 w125 h15 +Right,Ready
  105.  
  106. Gui,Font,S10 CDefault Bold,Arial
  107. Gui,Add,Text, x5 y130 w125 h15 +Left,Golden Clicks:
  108. Gui,Add,Text,vTimer5 x120 y130 w125 h15 +Right,Ready
  109.  
  110. Gui,Font,S10 CDefault Bold,Arial
  111. Gui,Add,Text, x5 y145 w125 h15 +Left,The Dark Ritual:
  112. Gui,Add,Text,vTimer6 x120 y145 w125 h15 +Right,Ready
  113.  
  114. Gui,Font,S10 CDefault Bold,Arial
  115. Gui,Add,Text, x5 y160 w125 h15 +Left,Super Clicks:
  116. Gui,Add,Text,vTimer7 x120 y160 w125 h15 +Right,Ready
  117.  
  118. Gui,Font,S10 CDefault Bold,Arial
  119. Gui,Add,Text, x5 y175 w125 h15 +Left,Energize:
  120. Gui,Add,Text,vTimer8 x120 y175 w125 h15 +Right,Ready
  121.  
  122. Gui,Font,S10 CDefault Bold,Arial
  123. Gui,Add,Text, x5 y190 w125 h15 +Left,Reload:
  124. Gui,Add,Text,vTimer9 x120 y190 w125 h15 +Right,Ready
  125.  
  126. Gui,Font,S10 CDefault Bold,Arial
  127. Gui,Add,Text, x5 y210 w125 h15 +Left,Level Hero(F9):
  128. Gui,Add,Text,vHeroLevel x120 y210 w125 h15 +Right,False
  129. Gui,Add,Text, x5 y225 w125 h15 +Left,Multiplier(F10):
  130. Gui,Add,Text,vMulti x120 y225 w125 h15 +Right,1
  131. Gui,Add,Text, x5 y240 w125 h15 +Left,Running:
  132. Gui,Add,Text,vRunning x120 y240 w125 h15 +Right,False
  133.  
  134. Gui, Show, w250 h265, Tester
  135.  
  136. ;The Actual Hotkeys
  137.  
  138. ;Run the script
  139. F7::
  140.     GuiControl,Text,Running,True
  141.     activate(clickdelay)
  142.     return
  143.    
  144. F8::
  145.     GuiControl,Text,Running,False
  146.     running := false
  147.     return
  148.    
  149. F9::
  150.     if (leveluphero = false)
  151.     {
  152.         GuiControl,Text,HeroLevel,True
  153.         leveluphero := true
  154.         return
  155.     }
  156.     else
  157.     {
  158.         GuiControl,Text,HeroLevel,False
  159.         leveluphero := false
  160.         return
  161.     }
  162.     return
  163.    
  164. F10::
  165.     if (multi = 1)
  166.     {
  167.         multi := multialt
  168.         GuiControl,Text,Multi,%multi%
  169.         return
  170.     }
  171.     else
  172.     {
  173.         multi := 1
  174.         GuiControl,Text,Multi,%multi%
  175.         return
  176.     }
  177.     return
  178.  
  179.    
  180.  
  181.    
  182. F11::
  183.     ExitApp
  184.     return
  185.  
  186. activate(milli)
  187. {
  188.     starttime := A_TickCount
  189.     Count := 0
  190.     running := true
  191.     SetMouseDelay 0
  192.     SetControlDelay -1
  193.     getWindowAttributes()
  194.     end := 10
  195.    
  196.     while(running)
  197.     {
  198.         newclickdelay := milli * (multi)
  199.         OutputDebug, %newclickdelay%
  200.         useAbilities(newclickdelay)
  201.         getSkillBonusClickable(newclickdelay)
  202.         getClickables(newclickdelay)
  203.        
  204.         if(leveluphero) {
  205.             if (i > end)
  206.             {
  207.                 levelHero(newclickdelay)
  208.                 i = 0
  209.             }
  210.            
  211.         i++
  212.         }
  213.        
  214.         if (gui)
  215.         {
  216.             ET := A_TickCount - starttime
  217.             Clicks_Second := Count / (ET / 1000)
  218.             GuiControl,Text,Text,%Clicks_Second%
  219.            
  220.             r=1
  221.             while (r<10)
  222.             {
  223.                 abil := abilend_%r%
  224.                 if (abil != 0)
  225.                 {
  226.                     ET := abil - A_TickCount
  227.                     TimeTill := ET / 1000
  228.                     GuiControl,Text,Timer%r%,% TimeTill "s"
  229.                 }
  230.                 else
  231.                 {
  232.                     GuiControl,Text,Timer%r%,Ready
  233.                 }
  234.                 r+=1
  235.             }
  236.            
  237.             if (leveluphero) {
  238.                 GuiControl,Text,HeroLevel,True
  239.             }
  240.             else {
  241.                 GuiControl,Text,HeroLevel,False
  242.             }
  243.            
  244.             GuiControl,Text,Multi,%multi%
  245.            
  246.             if (running)
  247.             {
  248.                 GuiControl,Text,Running,True
  249.             }
  250.             else
  251.             {
  252.                 GuiControl,Text,Running,False
  253.             }
  254.         }  
  255.        
  256.         sleep newclickdelay
  257.     }
  258.    
  259.     return
  260. }
  261.    
  262.    
  263.  
  264. ;Timer events for abilities
  265. AbilT_1:
  266.     abil_1 := true
  267.     abilend_1 := 0
  268. return
  269.  
  270. AbilT_2:
  271.     abil_2 := true
  272.     abilend_1 := 0
  273. return
  274.  
  275. AbilT_3:
  276.     abil_6 := true
  277.     abilend_1 := 0
  278. return
  279.  
  280. AbilT_4:
  281.     abil_4 := true
  282.     abilend_1 := 0
  283. return
  284.  
  285. AbilT_5:
  286.     abil_5 := true
  287.     abilend_1 := 0
  288. return
  289.  
  290. AbilT_6:
  291.     abil_6 := true
  292.     abilend_1 := 0
  293. return
  294.  
  295. AbilT_7:
  296.     abil_7 := true
  297.     abilend_1 := 0
  298. return
  299.  
  300. AbilT_8:
  301.     abil_8 := true
  302.     abilend_1 := 0
  303. return
  304.  
  305. AbilT_9:
  306.     abil_9 := true
  307.     abilend_1 := 0
  308. return
  309.  
  310. tryAbility(n, milli) {
  311.     if (lastabil = 9)
  312.     {
  313.         abil_%n% := true
  314.     }
  315.     if (abil_%n%) {
  316.         t := abilc_%n%
  317.         ControlSend,, %n%, %title%
  318.         abil_%n% := false
  319.         abilend_%n% := A_TickCount + t
  320.         SetTimer, AbilT_%n%, %t%
  321.         lastabil := %n%
  322.         sleep milli
  323.     }
  324.     return
  325. }
  326.  
  327. levelHero(milli) {
  328.     ControlSend,, {z down}, %title%
  329.     sleep milli*2
  330.    
  331.     math := 203 + (104 * (heroslot-1)) + 58
  332.     OutputDebug, y%math%
  333.    
  334.     ControlClick, x60 y%math%, %title%,,,, NA
  335.     sleep milli*2
  336.    
  337.     ControlSend,, {z up}, %title%
  338.     sleep milli*2
  339.    
  340.     return
  341. }
  342.  
  343. useAbilities(milli) {
  344.    
  345.     tryAbility(1, milli)
  346.     tryAbility(2, milli)
  347.     tryAbility(3, milli)
  348.     tryAbility(4, milli)
  349.    
  350.     tryAbility(8, milli) ;Double the next Golden Clicker
  351.     tryAbility(5, milli)
  352.     tryAbility(9, milli) ;Use two Golden Clickers
  353.     tryAbility(5, milli)
  354.    
  355.     tryAbility(6, milli)
  356.     tryAbility(7, milli)
  357.    
  358.     return
  359. }
  360.  
  361. getWindowAttributes() {
  362.     SetTitleMatchMode 3 ;Exact Match
  363.     WinActivate %title%
  364.     return
  365. }
  366.  
  367. getSkillBonusClickable(milli) {
  368.     ; click in a sequential area to try to catch mobile clickable
  369.     ControlClick, % "x" 780 " y" 160, %title%,,,, NA
  370.     Count++
  371.     sleep milli
  372.     ControlClick, % "x" 800 " y" 160, %title%,,,, NA
  373.     Count++
  374.     sleep milli
  375.     ControlClick, % "x" 880 " y" 160, %title%,,,, NA
  376.     Count++
  377.     sleep milli
  378.     ControlClick, % "x" 900 " y" 160, %title%,,,, NA
  379.     Count++
  380.     sleep milli
  381.     ControlClick, % "x" 980 " y" 160, %title%,,,, NA
  382.     Count++
  383.     sleep milli
  384.     ControlClick, % "x" 1000 " y" 160, %title%,,,, NA
  385.     Count++
  386.     sleep milli
  387.     return
  388. }
  389.  
  390. getClickables(milli) {
  391.     ; clickable positions
  392.     ControlClick, % "x" 515 " y" 490, %title%,,,, NA
  393.     Count++
  394.     sleep milli
  395.     ControlClick, % "x" 740 " y" 430, %title%,,,, NA
  396.     Count++
  397.     sleep milli
  398.     ControlClick, % "x" 755 " y" 480, %title%,,,, NA
  399.     Count++
  400.     sleep milli
  401.     ControlClick, % "x" 755 " y" 370, %title%,,,, NA
  402.     Count++
  403.     sleep milli
  404.     ControlClick, % "x" 860 " y" 510, %title%,,,, NA
  405.     Count++
  406.     sleep milli
  407.     ControlClick, % "x" 1000 " y" 455, %title%,,,, NA
  408.     Count++
  409.     sleep milli
  410.     ControlClick, % "x" 1040 " y" 440, %title%,,,, NA
  411.     Count++
  412.     sleep milli
  413.     return
  414. }
Advertisement
Add Comment
Please, Sign In to add comment