Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Clicker Heroes Steam Version AutoHotkey script
- ; Version: 0.3
- ; Date: 5/28/2015
- ; Author: Andrux51 (http://github.com/Andrux51)
- ; Revision: 08/15/15 djr242
- ;
- ; This script will auto-click the Clicker Heroes game window while attempting
- ; to collect all "clickables" (currently Easter Eggs) including the moving one.
- ; Significant changes have been made to the original code.
- ;
- ; The script will attempt to use two seperate sequences for ability usage.
- ; There are also a couple of features to help speed leveling along.
- ;
- ; Instructions:
- ; - Run .ahk file
- ; - F1 will start progression, buying all abilities for adventurers through Phthalo if able.
- ; F1 will also start the autoclicker after adventurers are bought.
- ; - F2 will level up adventurer in slots 1-4 to 100 and buy all abilities.
- ; - F3 will level up the adventurer in slot 1 only by 100 levels (does not buy abilities)
- ; - F4 will begin/resume the auto-clicker (no ability usage or leveling)
- ; - F5 will begin/resume the auto-clicker and level the 1st hero on the list
- ; - F6 will allow for time to buy guys/skills etc without losing combo
- ; - F7 will pause the auto-clicker
- ; - F10 will exit the script entirely
- ;
- ; Change "timing" variable to suit your needs if the script is running too fast or slow.
- ;
- #SingleInstance force ; if script is opened again, replace instance
- #Persistent ; script stays in memory until ExitApp is called or script crashes
- global title := "Clicker Heroes" ; we will exact match against this for steam version
- global msgtitle := "ClickerHerosAuto.ahk"
- global stop := false
- ; change this value to adjust script speed (milliseconds)
- global timing := 100
- global looper := 0
- ; pass in frequency to check for clickables
- ; higher number means more clicks on moving clickable, less often for other clickables
- global frequency := 200
- ; F1 will start the autoleveler
- F1::
- frequency := 50
- autoLvler(timing, frequency)
- return
- ; F2 will level up adventurer in slots 1-4 to 100 and buy all abilities.
- F2::
- l := 1
- while(l < 5) {
- levelSlot(l)
- l++
- }
- return
- ; F3 will level up the adventurer in slot 1 only by 100 levels (does not buy abilities)
- F3::
- clickHeroInSlot(1, 1)
- return
- ; F4 will begin/resume the auto-clicker (no ability usage or leveling)
- F4::
- frequency := 50
- autoClicker(timing, frequency, false, false)
- return
- ; F5 will begin/resume the auto-clicker and level the masked samurai
- F5::
- frequency := 50
- autoClicker(timing, frequency, true, true)
- return
- ; F6 will allow for time to buy guys/skills etc without losing combo
- F6::
- while(!stop) {
- getClickables()
- sleep 9000
- }
- return
- ; F7 will pause the auto-clicker
- F7::
- stop := true
- return
- ; F10 will exit the script entirely
- F10::
- ExitApp
- return
- ; pass in milliseconds to adjust click speed
- autoClicker(milli, p, levelup, useAbilities) {
- SetWorkingDir, C:\Program Files (x86)\Steam\steamapps\common\Clicker Heroes\images
- stop := false
- ControlClick,, %title%,,,, x545 y215 NA
- ControlClick,, %title%,,,, x1113 y248 NA
- setDefaults()
- i = 0
- while(!stop) {
- getSkillBonusClickable()
- if(i > p) {
- getClickables()
- if(levelup) {
- ;find the masked samurai
- loop {
- xx :=0
- yy :=0
- sleep 500
- ImageSearch,xx,yy,140,150,450,560, *TransECD68A *75 6.jpg
- if(ErrorLevel=0) {
- goto level
- }
- if(ErrorLevel=1) {
- ImageSearch,xx,yy,140,150,450,560, *TransFFE267 *100 56.jpg
- if(ErrorLevel=0) {
- goto level
- }
- DArrow()
- DArrow()
- DArrow()
- }
- }
- level:
- x1 := xx-70
- y1 := yy+40
- send {Ctrl down}
- ControlClick,, %title%,,,, x%x1% y%y1% Na
- send {Ctrl up}
- }
- if(useAbilities) {
- n :=1
- if(n < 3) {
- if(n=1) {
- useAbilities(1)
- }
- else {
- useAbilities(2)
- n=1
- }
- }
- }
- i = 0
- }
- i++
- Sleep milli
- }
- return
- }
- autoLvler(milli, p) {
- stop := false
- SetWorkingDir, C:\Program Files (x86)\Steam\steamapps\common\Clicker Heroes\images
- setDefaults()
- ;go to top of screen
- ControlClick,, %title%,,,, x545 y215 NA
- ;Just random variables used to count
- i := 0
- m := i + 50
- loop,26 {
- loop {
- xx :=0
- yy :=0
- sleep 3000
- ;search for adeventurer %i%
- ImageSearch,xx,yy,140,150,450,560, *TransECD68A *75 %i%.jpg
- if(ErrorLevel=0) {
- goto outer
- }
- ;search for adeventurer %m% (this is adventurer %i% after guilding)
- if(ErrorLevel=1) {
- ImageSearch,xx,yy,140,150,450,560, *TransFFE267 *100 %m%.jpg
- if(ErrorLevel=0) {
- goto outer
- }
- DArrow()
- DArrow()
- DArrow()
- DArrow()
- DArrow()
- }
- }
- ;after finding the desired adventurer, level him up
- outer:
- if(ErrorLevel=0) {
- x1 := xx-70
- y1 := yy+40
- send {Ctrl down}
- sleep 50
- checkCost(x1, y1)
- send {Ctrl up}
- sleep 50
- send {z down}
- sleep 50
- checkCost(x1, y1)
- send {z up}
- sleep 50
- ;buy upgrades
- x2 := 170
- loop, 7 {
- x2 := x2 + 34
- if(a_index >2) {
- if(i=19||m=69) {
- goto index
- }
- }
- checkCost(x2, y1)
- Sleep 20
- }
- index:
- i++
- m++
- ;moves forward levels every iteration. must have Iris up to level 50
- ControlClick,, %title%,,,, x983 y44 NA
- sleep 500
- ControlClick,, %title%,,,, x983 y44 NA
- sleep 500
- ControlClick,, %title%,,,, x983 y44 NA
- sleep 500
- ControlClick,, %title%,,,, x983 y44 NA
- }
- }
- Send {F5}
- }
- checkCost(c1, c2) {
- PixelSearch,,,142,c2,146,c2+15, 2B6386, 100, Fast
- if(ErrorLevel=1) {
- ControlClick,, %title%,,,, X%c1% Y%c2% NA
- }
- else {
- ;send {F5}
- }
- return
- }
- DArrow() {
- ControlClick,, %title%,,,, x540 y623 NA
- return
- }
- UArrow() {
- ControlClick,, %title%,,,, x540 y190 NA
- return
- }
- useAbilities(type) {
- if(type=1) {
- useAbility1()
- useAbility2()
- useAbility3()
- useAbility9()
- useAbility4()
- useAbility5()
- }
- if(type=2) {
- useAbility8()
- useAbility3()
- useAbility7()
- useAbility6()
- }
- return
- }
- useAbility1() {
- ; 1. Clickstorm
- ControlClick,, %title%,,,, x600 y170 NA
- return
- }
- useAbility2() {
- ; 2. Powersurge
- ControlClick,, %title%,,,, x600 y220 NA
- return
- }
- useAbility3() {
- ; 3. Lucky Strikes
- ControlClick,, %title%,,,, x600 y270 NA
- return
- }
- useAbility4() {
- ; 4. Metal Detector
- ControlClick,, %title%,,,, x600 y325 NA
- return
- }
- useAbility5() {
- ; 5. Golden Clicks
- ControlClick,, %title%,,,, x600 y375 NA
- return
- }
- useAbility6() {
- ; 6. Dark Ritual
- ControlClick,, %title%,,,, x600 y425 NA
- return
- }
- useAbility7() {
- ; 7. Super Clicks
- ControlClick,, %title%,,,, x600 y480 NA
- return
- }
- useAbility8() {
- ; 8. Energize
- ControlClick,, %title%,,,, x600 y530 NA
- return
- }
- useAbility9() {
- ; 9. Reload
- ControlClick,, %title%,,,, x600 y580 NA
- return
- }
- getSkillBonusClickable() {
- ; click in a sequential area to try to catch mobile clickable
- ControlClick,, %title%,,,, x770 y130 NA
- ControlClick,, %title%,,,, x790 y130 NA
- ControlClick,, %title%,,,, x870 y130 NA
- ControlClick,, %title%,,,, x890 y130 NA
- ControlClick,, %title%,,,, x970 y130 NA
- ControlClick,, %title%,,,, x990 y130 NA
- return
- }
- getClickables() {
- ; clickable positions
- ControlClick,, %title%,,,, x505 y460 NA
- ControlClick,, %title%,,,, x730 y400 NA
- ControlClick,, %title%,,,, x745 y450 NA
- ControlClick,, %title%,,,, x745 y340 NA
- ControlClick,, %title%,,,, x850 y480 NA
- ControlClick,, %title%,,,, x990 y425 NA
- ControlClick,, %title%,,,, x1030 y410 NA
- return
- }
- setDefaults() {
- SendMode InputThenPlay
- CoordMode, Mouse, Client
- SetKeyDelay, 0, 0
- SetMouseDelay 2 ; anything lower becomes unreliable for scrolling
- SetControlDelay 2 ; anything lower becomes unreliable for scrolling
- SetTitleMatchMode 3 ; window title is an exact match of the string supplied
- return
- }
- clickHeroInSlot(slot, times) {
- if(slot = 1) {
- send {Ctrl down}
- ControlClick,, %title%,,, %times%, x50 y250 NA
- send {Ctrl up}
- }
- if(slot = 2) {
- send {Ctrl down}
- ControlClick,, %title%,,, %times%, x50 y356 NA
- send {Ctrl up}
- }
- if(slot = 3) {
- send {Ctrl down}
- ControlClick,, %title%,,, %times%, x50 y462 NA
- send {Ctrl up}
- }
- if(slot = 4) {
- send {Ctrl down}
- ControlClick,, %title%,,, %times%, x50 y568 NA
- send {Ctrl up}
- }
- return
- }
- levelSlot(number) {
- if(number = 1) {
- clickHeroInSlot(1, 2)
- Sleep 100
- buyUpgrades(1)
- }
- if(number = 2) {
- clickHeroInSlot(2, 2)
- Sleep 100
- buyUpgrades(2)
- }
- if(number = 3) {
- clickHeroInSlot(3, 2)
- Sleep 100
- buyUpgrades(3)
- }
- if(number = 4) {
- clickHeroInSlot(4, 2)
- Sleep 100
- buyUpgrades(4)
- }
- return
- }
- buyUpgrades(slot) {
- if(slot = 1) {
- ControlClick,, %title%,,,, x190 y250 NA
- Sleep 5
- ControlClick,, %title%,,,, x230 y250 NA
- Sleep 5
- ControlClick,, %title%,,,, x265 y250 NA
- Sleep 5
- ControlClick,, %title%,,,, x300 y250 NA
- Sleep 5
- ControlClick,, %title%,,,, x340 y250 NA
- Sleep 5
- ControlClick,, %title%,,,, x370 y250 NA
- Sleep 5
- ControlClick,, %title%,,,, x413 y250 NA
- }
- if(slot = 2) {
- ControlClick,, %title%,,,, x190 y355 NA
- Sleep 5
- ControlClick,, %title%,,,, x230 y355 NA
- Sleep 5
- ControlClick,, %title%,,,, x265 y355 NA
- Sleep 5
- ControlClick,, %title%,,,, x300 y355 NA
- Sleep 5
- ControlClick,, %title%,,,, x340 y355 NA
- Sleep 5
- ControlClick,, %title%,,,, x370 y355 NA
- Sleep 5
- ControlClick,, %title%,,,, x413 y355 NA
- }
- if(slot = 3) {
- ControlClick,, %title%,,,, x190 y465 NA
- Sleep 5
- ControlClick,, %title%,,,, x230 y465 NA
- Sleep 5
- ControlClick,, %title%,,,, x265 y465 NA
- Sleep 5
- ControlClick,, %title%,,,, x300 y465 NA
- Sleep 5
- ControlClick,, %title%,,,, x340 y465 NA
- Sleep 5
- ControlClick,, %title%,,,, x370 y465 NA
- Sleep 5
- ControlClick,, %title%,,,, x413 y465 NA
- }
- if(slot = 4) {
- ControlClick,, %title%,,,, x190 y570 NA
- Sleep 5
- ControlClick,, %title%,,,, x230 y570 NA
- Sleep 5
- ControlClick,, %title%,,,, x265 y570 NA
- Sleep 5
- ControlClick,, %title%,,,, x300 y570 NA
- Sleep 5
- ControlClick,, %title%,,,, x340 y570 NA
- Sleep 5
- ControlClick,, %title%,,,, x370 y570 NA
- Sleep 5
- ControlClick,, %title%,,,, x413 y570 NA
- }
- return
- }
Advertisement
Add Comment
Please, Sign In to add comment