SHARE
TWEET

Idle Champions Gem Farming AHK

a guest May 25th, 2019 230 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;LEVEL DETECTOR GEM FARM
  2. ;This script is designed to farm gems and boss chest drops by automatically progressing through low level areas, then resetting and starting over the same mission
  3. ;It achieves this by levelling click damage and clicking automatically to kill enemies as fast as possible. To ensure the fastest boss kills, and to pick up
  4. ;item drops, it utilizes a pixel-color detector to determine when the game is changing levels. This allows it to know when it is 'safe' to level champions
  5. ;or click damage without missing anything, and allows it to click in the right place to pick up items as they drop and to open the boss loot bag as soon
  6. ;as it reaches the middle of the screen. Overall this allows for a sub 11 minute run, with no down time; the script resets as soon as it reaches area 31.
  7.  
  8. ;Settings: Set your adventure map to show all, including completed adventures. Set level up mode to UPG, turn on autoprogress (though the script has
  9. ;limited ability to correct for autoprogress), and close the chat window if needed (the level up function will not scroll the roster, so if the chat covers
  10. ;a champion that will be used, it needs to be closed).
  11.  
  12. ; this is the point the transition test will occur at
  13. ; if you need to change it, pick at point as close to the left edge of the screen as possible and below the bottom-most champion
  14. ; to ensure that it doesn't pick up the champions transitioning into the screen
  15.  
  16. ;Script now contains a subroutine to move familiars, and 4 new farming loops for varying numbers of familiars
  17. ;USERS WILL NEED TO EDIT THE NEW LOOPS TO MAKE THEM USE THE FAMILIARS THE PLAYER HAS UNLOCKED
  18.  
  19. global transx := 15
  20. global transy := 555
  21.  
  22. global campselectx      := 115                      ; horizontal location of the tomb and tour buttons at the upper left of the screen
  23. global tombselecty      := 200                      ; vertical location of the tomb button
  24. global grandselecty     := 133                      ; vertical location of the tour button
  25. global campx            := 700                      ; horizontal location of the camp
  26. global campy            := 420                      ; vertical location of the camp
  27.  
  28.                                                     ; variables pertaining to manipulating the adventure list
  29. global listx            := 405                      ; horizontal location of the adventure list
  30. global listy            := 460                      ; vertical location of desired adventure in list after scrolling
  31. global campstartx       := 815                      ; horizontal location of adventure start button
  32. global campstarty       := 585                      ; vertical location of adventure start button
  33.  
  34.                                                     ; these variables give the position and color of a point in the dps banner
  35.                                                     ; used to check when the transition from the map to the adventure is finished
  36. global dpsx             := 200                      ; horizontal location of a point on the DPS banner
  37. global dpsy             := 46                       ; vertical location of a point on the DPS banner
  38. global dpsc             := 0x2B2C2C                 ; color of a point on the dps banner
  39.  
  40.                                                     ; variables pertaining to manipulating the champion roster (and click damage upgrade)
  41. global rosterx          := 180                      ; horizontal location of the middle of the click damage button
  42. global rostery          := 725                      ; vertical location of the middle of the click damage button
  43. global rosterinterval   := 105                      ; distance between the middle of the click damage button and the middle of bruenors level up button
  44.  
  45.                                                     ; variables pertaining to the formation presets
  46. global formx            := 25                       ; horizontal location of formation preset buttons
  47. global formy1           := 630                      ; vertical location of formation preset 1
  48. global formy2           := 660                      ; vertical location of formation preset 2
  49. global formy3           := 685                      ; vertical location of formation preset 3
  50.  
  51.                                                     ; variables for the field, defining cursor movements to pick up gold and items (including gems)
  52. global sweepright       := 1195                     ; horizontal location of the default spawn zone (right edge of the screen)
  53. global sweepport        := 1030                 ; horizontal location of the portal spawn zone
  54. global sweepvert        := 235                      ; vertical location of the upper spawn zone
  55. global sweepleft        := 640                      ; horizontal location of the middle of the screen
  56. global sweeplow         := 415                  ; vertical location of the lower spawn zone
  57. global bagclick         := 400                      ; vertical position of boss loot bag
  58.  
  59.                                                     ; error detection. these variable help the program determine if autoprogress is off or if a specialization
  60.                                                     ; selector has been opened and allows the program to resolve the issue
  61. global whitearrowx      := 1245                     ; horizontal location of a white pixel in the autoprogress arrow
  62. global whitearrowy      := 130                      ; vertical location of a white pixel in the autoprogress arrow
  63. global greyx            := 850                      ; horizontal location of grey space in specialization window (ensure your hex code matches the color of the pixel)
  64. global greyy            := 500                      ; vertical location of grey space in specialization window
  65. global greyc            := 0x191919                 ; colour of the location the specialization window check checks
  66. global selecty          := 725                      ; vertical location of specialization selector buttons
  67. global rightselect      := 390                      ; horizontal centre of Asharra's rightmost selector button
  68. global leftselect       := 895                      ; horizontal centre or Asharra's leftmost selector button
  69.  
  70.                                                     ; variables pertaining to using the complete adventure button and subsequent actions to reset the adventure
  71. global completex        := 315                      ; horizontal location of complete adventure button
  72. global completey        := 110                      ; vertical location of complete adventure button
  73. global confirmx         := 570                      ; horizontal location of confirm button
  74. global confirmy         := 520                      ; vertical location of confirm button
  75. global continuex        := 630                      ; horizontal location of continue button
  76. global continuey        := 625                      ; vertical location of continue button
  77.  
  78.                                                     ; variables regarding familiar manipulation
  79. global frosterx         := 680                  ; horizontal location of familiar roster button
  80. global frostery         := 560                      ; vertical location of familiar roster button
  81. global handx            := 290                      ; horizontal location of center of mage hand icon
  82. global handy            := 440                      ; vertical location of center of mage hand icon
  83. global frosterint       := 75                       ; horizontal distance between centers of familiar icons
  84. global click1x          := 950                      ; horizontal location of center of highest familiar click location
  85. global click1y          := 290                      ; vertical location of center of highest familiar click location
  86. global click2x          := 880                      ; horizontal location of center of second highest familiar click location
  87. global click2y          := 355                      ; vertical location of center of second highest familiar click location
  88. global click3x          := 880                      ; horizontal location of center of second lowest familiar click location
  89. global click3y          := 420                      ; vertical location of center of second lowest familiar click location
  90. global click4x          := 950                      ; horizontal location of center of lowest familiar click location
  91. global click4y          := 480                      ; vertical location of center of lowest familiar click location
  92. global clickdx          := 180                      ; horizontal location of center of familiar click damage leveling location
  93. global clickdy          := 725                      ; vertical location of center of familiar click damage leveling location
  94.  
  95. `::                                                 ; Press ` to Exit the program
  96. Send {Shift Up}
  97. Send {Alt Up}
  98. exitapp
  99.  
  100. ^r::Reload                                          ; Soft Reset. Reloads the script, which will exit all current threads without exiting the program
  101.  
  102. ; Main program. Opens the Mad Wizard free play from the main map, then progresses through the adventure to reset after level 30
  103. ; Levels champions and click damage at the start of levels and chooses and autoclick mode based on the current level
  104. ^g::GoSub Main
  105.  
  106. Main:
  107. {
  108.     Loop
  109.     {
  110.         GoSub CampStart                             ;Starts Campaign
  111.        
  112.         ;Area 1
  113.         Sleep 100
  114.         Familiar(5)
  115.         Sleep 100
  116.         Familiar(2)
  117.         Sleep 100
  118.         Loop 1
  119.         {
  120.             interval    := ( sweeplow - sweepvert ) / 4
  121.             sweepy      := sweepvert
  122.             MouseMove sweepright, sweepvert
  123.             Loop 5
  124.             {
  125.                 Click  %sweepright%, %sweepy%
  126.                 MouseMove %sweepport%, %sweepy%, 10
  127.                 Click
  128.                 sweepy := sweepy + interval
  129.                 Sleep 50
  130.             }
  131.         }
  132.         GoSub Autoprogress
  133.         Level(0,10)
  134.         Zone(1)
  135.         GoSub TransWait
  136.        
  137.         ;Area 2
  138.         Level(0)
  139.         Zone(1)
  140.         GoSub TransWait
  141.        
  142.         ;Area 3
  143.         Level(0, 2)
  144.         Level(1)
  145.         Level(2)
  146.         Level(3)
  147.         Level(4)
  148.         Zone(3)
  149.         GoSub TransWait
  150.        
  151.         ;Area 4
  152.         Level(0)
  153.         Zone(3)
  154.         GoSub TransWait
  155.        
  156.         ;Area 5
  157.         Level (0, 2)
  158.         Level(1)
  159.         Level(2)
  160.         Level(3)
  161.         Level(4)
  162.         Sleep 100           ;Script tends to miss later champions, Level() is too fast
  163.         Level(5)            ;Champions far to the right must be levelled on a delay to give the screen time to clear
  164.         Zone(5)
  165.         GoSub TransWait
  166.  
  167.         ;Area 6
  168.         Level(0)
  169.         Zone(1)
  170.         GoSub TransWait
  171.        
  172.         ;Area 7
  173.         Level(0)
  174.         Zone(2)             ;Note, moving level with items
  175.         GoSub TransWait
  176.        
  177.         ;Area 8
  178.         Level(0)
  179.         Zone(3)             ;Ward not portal, single item drop
  180.         GoSub TransWait
  181.        
  182.         ;Area 9
  183.         Level(0)
  184.         Zone(1)
  185.         GoSub TransWait
  186.        
  187.         ;Area 10
  188.         Level (0, 2)
  189.         Level(1)
  190.         Level(2)
  191.         Level(3)
  192.         Level(4)
  193.         Sleep 100           ;Script tends to miss later champions, Level() is too fast
  194.         Level(5)            ;Champions far to the right must be levelled on a delay to give the screen time to clear
  195.         Level(6)
  196.         Zone(5)
  197.         GoSub TransWait
  198.    
  199.         ;Area 11
  200.         Level (0)
  201.         Zone(1)
  202.         GoSub TransWait
  203.  
  204.         ;Area 12
  205.         Level(0)
  206.         Zone(1)
  207.         GoSub TransWait
  208.        
  209.         ;Area 13
  210.         Level(0)
  211.         Zone(1)        
  212.         GoSub TransWait
  213.        
  214.         ;Area 14
  215.         Level(0, 2)
  216.         Level(1)
  217.         Level(2)
  218.         Level(3)
  219.         Level(4)
  220.         Sleep 100           ;Script tends to miss later champions, Level() is too fast
  221.         Level(5)            ;Champions far to the right must be levelled on a delay to give the screen time to clear
  222.         Level(7)
  223.         FormationSet(1)
  224.         Zone(3)             ;Strange Orb. Champion levels needed       
  225.         GoSub TransWait
  226.        
  227.         ;Area 15
  228.         Level(0, 2)
  229.         Zone(5)
  230.         GoSub TransWait
  231.  
  232.         ;Area 16
  233.         Level (0, 2)
  234.         Zone(3)             ;first portal with item drops
  235.         GoSub TransWait
  236.  
  237.         ;Area 17
  238.         Level(0, 2)
  239.         Zone(2)             ;Note, moving level with items
  240.         GoSub TransWait
  241.        
  242.         ;Area 18
  243.         Level(0, 2)
  244.         Zone(1)        
  245.         GoSub TransWait
  246.        
  247.         ;Area 19
  248.         Level(0, 2)
  249.         Zone(1)            
  250.         GoSub TransWait
  251.        
  252.         ;Area 20
  253.         Level(0, 2)
  254.         Zone(5)
  255.         GoSub TransWait
  256.  
  257.         ;Area 21
  258.         Level (0, 2)
  259.         Zone(1)
  260.         GoSub TransWait
  261.  
  262.         ;Area 22
  263.         Level(0, 2)
  264.         Zone(3)
  265.         GoSub TransWait
  266.        
  267.         ;Area 23
  268.         Level(0, 2)
  269.         Zone(3)        
  270.         GoSub TransWait
  271.        
  272.         ;Area 24
  273.         Level(0, 2)
  274.         Zone(3)            
  275.         GoSub TransWait
  276.        
  277.         ;Area 25
  278.         Level(0, 2)
  279.         Zone(5)
  280.         GoSub TransWait
  281.  
  282.         ;Area 26
  283.         Level (0, 2)
  284.         Zone(3)
  285.         GoSub TransWait
  286.  
  287.         ;Area 27
  288.         Level(0, 2)
  289.         Zone(3)
  290.         GoSub TransWait
  291.        
  292.         ;Area 28
  293.         Level(0, 2)
  294.         Zone(3)        
  295.         GoSub TransWait
  296.        
  297.         ;Area 29
  298.         Level(0, 2)
  299.         Zone(3)            
  300.         GoSub TransWait
  301.        
  302.         ;Area 30
  303.         Level(0, 2)
  304.         Zone(5)
  305.         GoSub TransWait
  306.  
  307.         ;Area 31
  308.         GoSub Reset
  309.         GoSub TransWait
  310.         Sleep 3000
  311.     }
  312.     Return
  313. }
  314.  
  315. ;semi-afk one familiar setup
  316. ;this does the normal reset and startup opertations, but uses a familiar to click so you can tab away from the game.
  317. ;It returns every 15 minutes to either level click damage or reset
  318. ^h::
  319. {
  320.     Loop
  321.     {
  322.         GoSub CampStart
  323.        
  324.         Loop 7
  325.         {
  326.             GoSub NoPortSweep
  327.             Level(0)
  328.         }
  329.    
  330.         Familiar(1)
  331.         Level(0, 20)
  332.         Level(2)
  333.         Level(3)
  334.         Level(4)
  335.        
  336.         Loop 15
  337.         {
  338.             Sleep 60000
  339.         }
  340.        
  341.         IfWinExist, Idle Champions
  342.             WinActivate
  343.            
  344.         Level(0, 20)
  345.        
  346.         Loop 15
  347.         {
  348.             Sleep 60000
  349.         }
  350.        
  351.         IfWinExist, Idle Champions
  352.             WinActivate    
  353.        
  354.         GoSub Reset
  355.         GoSub TransWait
  356.         Sleep 3000     
  357.     }
  358. }
  359.  
  360. ;semi-afk two familiar setup
  361. ;this versions uses one familiar for clicking and one for leveling click damage
  362. ;this allows it to skip the mid-run maintenance
  363. ^j::
  364. {
  365.     Loop
  366.     {
  367.         GoSub CampStart
  368.  
  369.         Loop 7
  370.         {
  371.             GoSub NoPortSweep
  372.             Level(0)
  373.         }
  374.        
  375.         Familiar(1)
  376.         Familiar(5)
  377.         Level(2)
  378.         Level(3)
  379.         Level(4)
  380.        
  381.         Loop 25
  382.         {
  383.             Sleep 60000
  384.         }
  385.  
  386.         IfWinExist, Idle Champions
  387.             WinActivate
  388.        
  389.         GoSub Reset
  390.         GoSub TransWait
  391.         Sleep 3000
  392.     }
  393. }
  394.  
  395. ;semi-afk three familiar setup
  396. ;with all three familiars clicking, you can get back down to the 10 minute run
  397. ;however, without a familiar upgrading click damage a mid-run maintenance is required
  398. ^k::
  399. {
  400.     Loop
  401.     {
  402.         GoSub CampStart
  403.  
  404.         Loop 7
  405.         {
  406.             GoSub NoPortSweep
  407.             Level(0)
  408.         }
  409.        
  410.         Familiar(1)
  411.         Familiar(2)
  412.         Familiar(3)
  413.         Level(0, 20)
  414.         Level(2)
  415.         Level(3)
  416.         Level(4)
  417.        
  418.         Loop 6
  419.         {
  420.             Sleep 60000
  421.         }
  422.        
  423.         IfWinExist, Idle Champions
  424.             WinActivate
  425.            
  426.         Level(0, 20)
  427.        
  428.         Loop 6
  429.         {
  430.             Sleep 60000
  431.         }
  432.        
  433.         IfWinExist, Idle Champions
  434.             WinActivate    
  435.        
  436.        
  437.         GoSub Reset
  438.         GoSub TransWait
  439.         Sleep 3000
  440.     }
  441. }
  442.  
  443. ;semi-afk four familiar setup
  444. ;three familiars clicking and one upgrading click damage, this version can do a 10 minute run with no maintenance needed.
  445. ;the primary loop is still better when truly afk, since the level detection allows it to reset as soon as level 30 is done, avoiding wasted time
  446. ^l::
  447. {
  448.     Loop
  449.     {
  450.         GoSub CampStart
  451.  
  452.         Loop 7
  453.         {
  454.             GoSub NoPortSweep
  455.             Level(0)
  456.         }
  457.        
  458.         Familiar(5)
  459.         Familiar(1)
  460.         Familiar(2)
  461.         Familiar(3)
  462.         Level(2)
  463.         Level(3)
  464.         Level(4)
  465.        
  466.         Loop 11
  467.         {
  468.             Sleep 60000
  469.         }
  470.        
  471.         IfWinExist, Idle Champions
  472.             WinActivate    
  473.        
  474.        
  475.         GoSub Reset
  476.         GoSub TransWait
  477.         Sleep 3000
  478.     }
  479. }
  480.  
  481. ^y:: ;makos ult farming, window activate version
  482. Toggle := !Toggle
  483. Loop
  484. {
  485.     If (!Toggle)
  486.         Break
  487.     IfWinExist, Idle Champions
  488.         WinActivate
  489.     Sleep 55
  490.     FormationSet(1)
  491.     Sleep 55
  492.     send, 8
  493.     Sleep 5000
  494.     send, 259
  495.     Sleep 300000
  496.     FormationSet(2)
  497. }
  498. Return
  499.  
  500. ; Action length tester
  501. ; Starts a timer, calls subroutines and functions, then calls TransitionTest, then reports the total time elapsed
  502. ; In order to ensure proper testing function, time elapsed must be under 900 milliseconds
  503. ^m::
  504. {
  505.     starttime := A_TickCount
  506.     Loop 1
  507.     {
  508. ;       GoSub BossClick
  509. ;       GoSub NoPortSweep
  510. ;       Level(0)
  511. ;       FormationSet(2)
  512.         GoSub Reset
  513.         GoSub CampStart
  514.         Level(0, 5)
  515.         Level(1, 2)
  516.         Familiar(5)
  517.         Familiar(2)
  518.     }
  519. ;   carenot := TransitionTest()
  520.     wipelength := A_TickCount - starttime
  521.     MsgBox, Loop length %wipelength% milliseconds
  522.     Return
  523. }
  524.  
  525. ; Transition detector loop test
  526. ; Runs an loop of a function or subroutine followed by TransitionTest until a transition is detected
  527. ; To test, turn off autoprogress and go to a level besides your current highets.
  528. ; Activate the macro, then hit g to start a level transition.
  529. ; Use this function then initiate a level transition to ensure the function/subroutine being tested remains under time
  530. ^t::
  531. {
  532.     Loop 10
  533.     {
  534. ;       GoSub BossClick
  535.         GoSub NoPortSweep
  536.         If TransitionTest()
  537.             Break
  538.     }
  539.     MsgBox, Transition Detection successful
  540.     Return
  541. }
  542.  
  543. CampStart:                                          ; Starts the campaign from the map screen
  544. {
  545.     Loop 15                                         ; Zooms out campaign map
  546.     {
  547.         MouseClick, WheelDown, %campx%, %campy%
  548.         Sleep 5
  549.     }
  550.     Sleep 200
  551.     Click %campselectx%, %tombselecty%              ; Select Tomb of Annihilation
  552.     Sleep 200
  553.     Click %campselectx%, %grandselecty%             ; Select A Grand Tour
  554.     Sleep 200
  555.     Click %campx%, %campy%                          ; Click the campaign icon
  556.     Sleep 200
  557.     Click
  558.     Sleep 200
  559.     Loop 15                                         ; Makes sure campaign list is at the top
  560.     {                                               ; Hide completed and hide locked are OFF
  561.         MouseClick, WheelUp, listx, listy
  562.         Sleep 55
  563.     }
  564.     Loop 5                                          ; Scrolls down until Mad Wizard Free Play is visible
  565.     {
  566.         MouseClick, WheelDown, listx, listy
  567.         Sleep 55
  568.     }
  569.     MouseMove %listx%, %listy%                      ; Clicks Mad Wizard
  570.     Sleep 200
  571.     Click %listx%, %listy%
  572.     Sleep 200
  573.     MouseMove campstartx, campstarty                ; Clicks campaign start
  574.     Sleep 200
  575.     Click %campstartx%, %campstarty%
  576.     Sleep 200
  577.     MouseMove dpsx, dpsy
  578.     Sleep 2000
  579.     ;Loop
  580.     ;{
  581.     ;   PixelGetColor, colour, dpsx, dpsy
  582.     ;   IfEqual, colour, %dpsc%
  583.     ;       Break
  584.     ;}
  585.     MouseMove dpsx + 100, dpsy + 100
  586.    
  587.     Return
  588. }
  589.  
  590. ; color checker. you can use this to check the color of a point and return it for updating the global variables at the top of the file
  591. ; change the last two variables after PixelGetColor to the point you want to check, reload the script, then press CTRL-Q while in Idle Champions
  592. ; a message box will appear with the hex code of the color under the point
  593. ^q::
  594. {
  595.         PixelGetColor, colour, dpsx, dpsy
  596.         MsgBox %colour%
  597. }
  598.  
  599. Autoprogress:
  600. {
  601.     PixelGetColor, colour, whitearrowx, whitearrowy
  602.     IfEqual, colour, 0xFFFFFF
  603.     {
  604.         send, g
  605.         Return
  606.     }
  607.     Else
  608.         Return
  609. }
  610.  
  611. Reset:
  612. {
  613.     MouseMove completex, completey, 0               ; Clicks complete adventure button
  614.     PixelGetColor, colour, completex, completey     ; Checks to make sure a level transition is not in progress before attempting to reset
  615.     IfEqual, colour, 0x000000
  616.         Sleep 3500
  617.     Sleep 200
  618.     Click
  619.     Sleep 450
  620.    
  621.     MouseMove confirmx, confirmy, 0                 ; Clicks confirm
  622.     Sleep 200
  623.     Click
  624.     Sleep 200
  625.     Click
  626.     Sleep 200                                       ; Longer to allow for animation
  627.  
  628.     MouseMove continuex, continuey, 0               ; Clicks continue
  629.     Loop
  630.     {
  631.     Click
  632.     If TransitionTest()
  633.         Break
  634.     Sleep 55
  635.     }
  636.     Return
  637. }
  638.  
  639. ; Autoclicker for boss levels. Clicks in the middle of the screen where the bag will spawn and jiggles the cursor to pick up gems.
  640. BossClick:
  641. {
  642.     MouseMove sweepleft, bagclick
  643.     Sleep 50
  644.     Loop 4
  645.     {
  646.         Click
  647.         Sleep 50
  648.     }
  649.     MouseMove sweepleft, bagclick + 5
  650.     Sleep 50
  651.     Loop 4
  652.     {
  653.         Click
  654.         Sleep 50
  655.     }  
  656.     Return
  657. }
  658.  
  659. ; Autoclicker for non-boss levels that don't have a portal. Clicks at the right edge of the screen and progresses the cursor up and down to pick up drops
  660. NoPortSweep:
  661. {
  662.     interval    := ( sweeplow - sweepvert ) / 4
  663.     sweepy      := sweepvert
  664.     MouseMove sweepright, sweepvert
  665.     Loop 5
  666.     {
  667.         Click  %sweepright%, %sweepy%
  668.         sweepy := sweepy + interval
  669.         Sleep 50
  670.     }
  671.     Return
  672. }
  673.  
  674. ; Autoclicker levels where the stage moves and items spawn. Offsets the clicker slightly from the NoPortSweep baseline to ensure drops aren't missed
  675. RollItemSweep:
  676. {
  677.     interval    := ( sweeplow - sweepvert ) / 4
  678.     sweepy      := sweepvert
  679.     sweepx      := sweepright - 10
  680.     MouseMove sweepright, sweepvert
  681.     Loop 5
  682.     {
  683.         Click  %sweepx%, %sweepy%
  684.         sweepy := sweepy + interval
  685.         Sleep 50
  686.     }
  687.     Return
  688. }
  689.  
  690. ; Autoclicker for non-boss levels that have a portal. Clicks a a little to left of the portal and progresses the cursor up and down to pick up drops
  691. PortSweep:
  692. {
  693.     interval    := ( sweeplow - sweepvert ) / 4
  694.     sweepy      := sweepvert
  695.     MouseMove sweepport, sweepvert
  696.     Loop 5
  697.     {
  698.         Click  %sweepport%, %sweepy%
  699.         sweepy := sweepy + interval
  700.         Sleep 50
  701.     }
  702.     Return
  703. }
  704.  
  705. Level(champ, num := 1)                              ; Levels/unlocks a champion or click damage
  706. {                                                   ; Recieves a number corresponding to the champion's location in the roster
  707.     x := rosterx + rosterinterval * champ
  708.     if(champ = 0)
  709.     {
  710.     x := rosterx + 30
  711.     }
  712.     Loop 3                     
  713.     {                          
  714.         MouseClick, WheelUp, %x%, %rostery%         ; Scrolls roster to ensure click damage is visible at the far right
  715.         Sleep 5                                     ; Script will sometime inadvertently move the roster when interacting
  716.     }
  717.     MouseMove, x, rostery
  718.     Sleep 200
  719.     Loop %num%                                      ; Bruenor is 1, for example. Click damage is 0
  720.     {                                               ; Will level once by default, caller can send an integer to level more than once
  721.         Click ; %x%, %rostery%
  722.         Sleep 100
  723.     }
  724.     Loop 2
  725.     {
  726.         PixelGetColor, colour, greyx, greyy         ; Checks for upgrade selector window. As noted above, the roster sometime gets scrolled
  727.         IfEqual, colour, %greyc%                    ; if it does, and Bruenor gets levelled to his selector, this is needed to escape
  728.         {
  729.             interval    := ( leftselect - rightselect ) / 4
  730.             selectx     := rightselect
  731.             MouseMove selectx, selecty
  732.             Loop 5
  733.             {
  734.                 Click  %selectx%, %selecty%
  735.                 selectx := selectx + interval
  736.                 Sleep 50
  737.                 Click
  738.                 Sleep 50
  739.             }
  740.         }
  741.     }
  742.     Return
  743. }
  744.  
  745. FormationSet(number)
  746. {
  747.     If (number = 1)
  748.         Send, q
  749.     If (number = 2)
  750.         Send, w
  751.     If (number = 3)
  752.         Send, e
  753.     Return
  754. }
  755.  
  756. ; Locks the script until the level transition screen begins clearing
  757. ; Makes sure the main function passes to the next level at a more consistent timing
  758. ; since the Zone function has nearly a second of variability in when it detects a transition
  759. TransWait:
  760. {
  761.     Loop
  762.     {
  763.         if !TransitionTest()
  764.             Return
  765.     }
  766. }
  767.  
  768. ; final loop for each zone. After setup (if any), will loop the correct autoclicker and check for level completion, then return so the main function can progress
  769. Zone(Type)
  770. {
  771.     If (Type = 5)                                   ; Boss level loop
  772.     {
  773.         Loop 180
  774.         {
  775.             GoSub BossClick
  776.             If TransitionTest()
  777.                 Return
  778.         }
  779.     }
  780.     If (Type = 3)                                   ; Portal level loop
  781.     {
  782.         Loop 180
  783.         {
  784.             GoSub PortSweep
  785.             If TransitionTest()
  786.                 Return
  787.         }
  788.     }
  789.     If (Type = 2)                                   ; Non portal, non boss level loop
  790.     {
  791.         Loop 180
  792.         {
  793.             GoSub RollItemSweep
  794.             If TransitionTest()
  795.                 Return
  796.         }
  797.     }
  798.     If (Type = 1)                                   ; Non portal, non boss level loop
  799.     {
  800.         Loop 180
  801.         {
  802.             GoSub NoPortSweep
  803.             If TransitionTest()
  804.                 Return
  805.         }
  806.     }
  807.     IfWinExist, Idle Champions
  808.     {  
  809.         WinActivate
  810.         Sleep 150
  811.         GoSub Reset
  812.         GoSub TransWait
  813.         Sleep 3000
  814.         GoSub Main
  815.     }
  816.     Else
  817.     {
  818.         Reload
  819.     }  
  820. }  
  821.  
  822. Familiar(Place)
  823. {
  824.     If(Place = 1)
  825.     {
  826.         finalx := click1x
  827.         finaly := click1y
  828.     }
  829.     If(Place = 2)
  830.     {
  831.         finalx := click2x
  832.         finaly := click2y
  833.     }
  834.     If(Place = 3)
  835.     {
  836.         finalx := click3x
  837.         finaly := click3y
  838.     }
  839.     If(Place = 4)
  840.     {
  841.         finalx := click4x
  842.         finaly := click4y
  843.     }
  844.     If(Place = 5)
  845.     {
  846.         finalx := clickdx - 5
  847.         finaly := clickdy
  848.     }
  849.     MouseMove frosterx, frostery
  850.     Sleep 100
  851.     Click Down
  852.     Sleep 100
  853.     MouseMove, finalx, finaly, 20
  854.     Sleep 100
  855.     Click Up
  856.     Return
  857. }
  858.  
  859. ; Checks if a level transition is in progress, returns true if so
  860. ; Must be called every 900 milliseconds or less in order to ensure that it catches each transition
  861. TransitionTest()
  862. {
  863.     ;MouseMove, transx, transy
  864.     PixelGetColor, colour, transx, transy
  865.     If (colour == 0x000000)
  866.         Return True
  867.     Else
  868.         Return False
  869. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top