Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;LEVEL DETECTOR GEM FARM
- ;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
- ;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
- ;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
- ;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
- ;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.
- ;Settings: Set your adventure map to show all, including completed adventures. Set level up mode to UPG, turn on autoprogress (though the script has
- ;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
- ;a champion that will be used, it needs to be closed).
- ; this is the point the transition test will occur at
- ; 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
- ; to ensure that it doesn't pick up the champions transitioning into the screen
- ;Script now contains a subroutine to move familiars, and 4 new farming loops for varying numbers of familiars
- ;USERS WILL NEED TO EDIT THE NEW LOOPS TO MAKE THEM USE THE FAMILIARS THE PLAYER HAS UNLOCKED
- global transx := 15
- global transy := 555
- global campselectx := 115 ; horizontal location of the tomb and tour buttons at the upper left of the screen
- global tombselecty := 200 ; vertical location of the tomb button
- global grandselecty := 133 ; vertical location of the tour button
- global campx := 700 ; horizontal location of the camp
- global campy := 420 ; vertical location of the camp
- ; variables pertaining to manipulating the adventure list
- global listx := 405 ; horizontal location of the adventure list
- global listy := 460 ; vertical location of desired adventure in list after scrolling
- global campstartx := 815 ; horizontal location of adventure start button
- global campstarty := 585 ; vertical location of adventure start button
- ; these variables give the position and color of a point in the dps banner
- ; used to check when the transition from the map to the adventure is finished
- global dpsx := 200 ; horizontal location of a point on the DPS banner
- global dpsy := 46 ; vertical location of a point on the DPS banner
- global dpsc := 0x2B2C2C ; color of a point on the dps banner
- ; variables pertaining to manipulating the champion roster (and click damage upgrade)
- global rosterx := 180 ; horizontal location of the middle of the click damage button
- global rostery := 725 ; vertical location of the middle of the click damage button
- global rosterinterval := 105 ; distance between the middle of the click damage button and the middle of bruenors level up button
- ; variables pertaining to the formation presets
- global formx := 25 ; horizontal location of formation preset buttons
- global formy1 := 630 ; vertical location of formation preset 1
- global formy2 := 660 ; vertical location of formation preset 2
- global formy3 := 685 ; vertical location of formation preset 3
- ; variables for the field, defining cursor movements to pick up gold and items (including gems)
- global sweepright := 1195 ; horizontal location of the default spawn zone (right edge of the screen)
- global sweepport := 1030 ; horizontal location of the portal spawn zone
- global sweepvert := 235 ; vertical location of the upper spawn zone
- global sweepleft := 640 ; horizontal location of the middle of the screen
- global sweeplow := 415 ; vertical location of the lower spawn zone
- global bagclick := 400 ; vertical position of boss loot bag
- ; error detection. these variable help the program determine if autoprogress is off or if a specialization
- ; selector has been opened and allows the program to resolve the issue
- global whitearrowx := 1245 ; horizontal location of a white pixel in the autoprogress arrow
- global whitearrowy := 130 ; vertical location of a white pixel in the autoprogress arrow
- global greyx := 850 ; horizontal location of grey space in specialization window (ensure your hex code matches the color of the pixel)
- global greyy := 500 ; vertical location of grey space in specialization window
- global greyc := 0x191919 ; colour of the location the specialization window check checks
- global selecty := 725 ; vertical location of specialization selector buttons
- global rightselect := 390 ; horizontal centre of Asharra's rightmost selector button
- global leftselect := 895 ; horizontal centre or Asharra's leftmost selector button
- ; variables pertaining to using the complete adventure button and subsequent actions to reset the adventure
- global completex := 315 ; horizontal location of complete adventure button
- global completey := 110 ; vertical location of complete adventure button
- global confirmx := 570 ; horizontal location of confirm button
- global confirmy := 520 ; vertical location of confirm button
- global continuex := 630 ; horizontal location of continue button
- global continuey := 625 ; vertical location of continue button
- ; variables regarding familiar manipulation
- global frosterx := 680 ; horizontal location of familiar roster button
- global frostery := 560 ; vertical location of familiar roster button
- global handx := 290 ; horizontal location of center of mage hand icon
- global handy := 440 ; vertical location of center of mage hand icon
- global frosterint := 75 ; horizontal distance between centers of familiar icons
- global click1x := 950 ; horizontal location of center of highest familiar click location
- global click1y := 290 ; vertical location of center of highest familiar click location
- global click2x := 880 ; horizontal location of center of second highest familiar click location
- global click2y := 355 ; vertical location of center of second highest familiar click location
- global click3x := 880 ; horizontal location of center of second lowest familiar click location
- global click3y := 420 ; vertical location of center of second lowest familiar click location
- global click4x := 950 ; horizontal location of center of lowest familiar click location
- global click4y := 480 ; vertical location of center of lowest familiar click location
- global clickdx := 180 ; horizontal location of center of familiar click damage leveling location
- global clickdy := 725 ; vertical location of center of familiar click damage leveling location
- `:: ; Press ` to Exit the program
- Send {Shift Up}
- Send {Alt Up}
- exitapp
- ^r::Reload ; Soft Reset. Reloads the script, which will exit all current threads without exiting the program
- ; Main program. Opens the Mad Wizard free play from the main map, then progresses through the adventure to reset after level 30
- ; Levels champions and click damage at the start of levels and chooses and autoclick mode based on the current level
- ^g::GoSub Main
- Main:
- {
- Loop
- {
- GoSub CampStart ;Starts Campaign
- ;Area 1
- Sleep 100
- Familiar(5)
- Sleep 100
- Familiar(2)
- Sleep 100
- Loop 1
- {
- interval := ( sweeplow - sweepvert ) / 4
- sweepy := sweepvert
- MouseMove sweepright, sweepvert
- Loop 5
- {
- Click %sweepright%, %sweepy%
- MouseMove %sweepport%, %sweepy%, 10
- Click
- sweepy := sweepy + interval
- Sleep 50
- }
- }
- GoSub Autoprogress
- Level(0,10)
- Zone(1)
- GoSub TransWait
- ;Area 2
- Level(0)
- Zone(1)
- GoSub TransWait
- ;Area 3
- Level(0, 2)
- Level(1)
- Level(2)
- Level(3)
- Level(4)
- Zone(3)
- GoSub TransWait
- ;Area 4
- Level(0)
- Zone(3)
- GoSub TransWait
- ;Area 5
- Level (0, 2)
- Level(1)
- Level(2)
- Level(3)
- Level(4)
- Sleep 100 ;Script tends to miss later champions, Level() is too fast
- Level(5) ;Champions far to the right must be levelled on a delay to give the screen time to clear
- Zone(5)
- GoSub TransWait
- ;Area 6
- Level(0)
- Zone(1)
- GoSub TransWait
- ;Area 7
- Level(0)
- Zone(2) ;Note, moving level with items
- GoSub TransWait
- ;Area 8
- Level(0)
- Zone(3) ;Ward not portal, single item drop
- GoSub TransWait
- ;Area 9
- Level(0)
- Zone(1)
- GoSub TransWait
- ;Area 10
- Level (0, 2)
- Level(1)
- Level(2)
- Level(3)
- Level(4)
- Sleep 100 ;Script tends to miss later champions, Level() is too fast
- Level(5) ;Champions far to the right must be levelled on a delay to give the screen time to clear
- Level(6)
- Zone(5)
- GoSub TransWait
- ;Area 11
- Level (0)
- Zone(1)
- GoSub TransWait
- ;Area 12
- Level(0)
- Zone(1)
- GoSub TransWait
- ;Area 13
- Level(0)
- Zone(1)
- GoSub TransWait
- ;Area 14
- Level(0, 2)
- Level(1)
- Level(2)
- Level(3)
- Level(4)
- Sleep 100 ;Script tends to miss later champions, Level() is too fast
- Level(5) ;Champions far to the right must be levelled on a delay to give the screen time to clear
- Level(7)
- FormationSet(1)
- Zone(3) ;Strange Orb. Champion levels needed
- GoSub TransWait
- ;Area 15
- Level(0, 2)
- Zone(5)
- GoSub TransWait
- ;Area 16
- Level (0, 2)
- Zone(3) ;first portal with item drops
- GoSub TransWait
- ;Area 17
- Level(0, 2)
- Zone(2) ;Note, moving level with items
- GoSub TransWait
- ;Area 18
- Level(0, 2)
- Zone(1)
- GoSub TransWait
- ;Area 19
- Level(0, 2)
- Zone(1)
- GoSub TransWait
- ;Area 20
- Level(0, 2)
- Zone(5)
- GoSub TransWait
- ;Area 21
- Level (0, 2)
- Zone(1)
- GoSub TransWait
- ;Area 22
- Level(0, 2)
- Zone(3)
- GoSub TransWait
- ;Area 23
- Level(0, 2)
- Zone(3)
- GoSub TransWait
- ;Area 24
- Level(0, 2)
- Zone(3)
- GoSub TransWait
- ;Area 25
- Level(0, 2)
- Zone(5)
- GoSub TransWait
- ;Area 26
- Level (0, 2)
- Zone(3)
- GoSub TransWait
- ;Area 27
- Level(0, 2)
- Zone(3)
- GoSub TransWait
- ;Area 28
- Level(0, 2)
- Zone(3)
- GoSub TransWait
- ;Area 29
- Level(0, 2)
- Zone(3)
- GoSub TransWait
- ;Area 30
- Level(0, 2)
- Zone(5)
- GoSub TransWait
- ;Area 31
- GoSub Reset
- GoSub TransWait
- Sleep 3000
- }
- Return
- }
- ;semi-afk one familiar setup
- ;this does the normal reset and startup opertations, but uses a familiar to click so you can tab away from the game.
- ;It returns every 15 minutes to either level click damage or reset
- ^h::
- {
- Loop
- {
- GoSub CampStart
- Loop 7
- {
- GoSub NoPortSweep
- Level(0)
- }
- Familiar(1)
- Level(0, 20)
- Level(2)
- Level(3)
- Level(4)
- Loop 15
- {
- Sleep 60000
- }
- IfWinExist, Idle Champions
- WinActivate
- Level(0, 20)
- Loop 15
- {
- Sleep 60000
- }
- IfWinExist, Idle Champions
- WinActivate
- GoSub Reset
- GoSub TransWait
- Sleep 3000
- }
- }
- ;semi-afk two familiar setup
- ;this versions uses one familiar for clicking and one for leveling click damage
- ;this allows it to skip the mid-run maintenance
- ^j::
- {
- Loop
- {
- GoSub CampStart
- Loop 7
- {
- GoSub NoPortSweep
- Level(0)
- }
- Familiar(1)
- Familiar(5)
- Level(2)
- Level(3)
- Level(4)
- Loop 25
- {
- Sleep 60000
- }
- IfWinExist, Idle Champions
- WinActivate
- GoSub Reset
- GoSub TransWait
- Sleep 3000
- }
- }
- ;semi-afk three familiar setup
- ;with all three familiars clicking, you can get back down to the 10 minute run
- ;however, without a familiar upgrading click damage a mid-run maintenance is required
- ^k::
- {
- Loop
- {
- GoSub CampStart
- Loop 7
- {
- GoSub NoPortSweep
- Level(0)
- }
- Familiar(1)
- Familiar(2)
- Familiar(3)
- Level(0, 20)
- Level(2)
- Level(3)
- Level(4)
- Loop 6
- {
- Sleep 60000
- }
- IfWinExist, Idle Champions
- WinActivate
- Level(0, 20)
- Loop 6
- {
- Sleep 60000
- }
- IfWinExist, Idle Champions
- WinActivate
- GoSub Reset
- GoSub TransWait
- Sleep 3000
- }
- }
- ;semi-afk four familiar setup
- ;three familiars clicking and one upgrading click damage, this version can do a 10 minute run with no maintenance needed.
- ;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
- ^l::
- {
- Loop
- {
- GoSub CampStart
- Loop 7
- {
- GoSub NoPortSweep
- Level(0)
- }
- Familiar(5)
- Familiar(1)
- Familiar(2)
- Familiar(3)
- Level(2)
- Level(3)
- Level(4)
- Loop 11
- {
- Sleep 60000
- }
- IfWinExist, Idle Champions
- WinActivate
- GoSub Reset
- GoSub TransWait
- Sleep 3000
- }
- }
- ^y:: ;makos ult farming, window activate version
- Toggle := !Toggle
- Loop
- {
- If (!Toggle)
- Break
- IfWinExist, Idle Champions
- WinActivate
- Sleep 55
- FormationSet(1)
- Sleep 55
- send, 8
- Sleep 5000
- send, 259
- Sleep 300000
- FormationSet(2)
- }
- Return
- ; Action length tester
- ; Starts a timer, calls subroutines and functions, then calls TransitionTest, then reports the total time elapsed
- ; In order to ensure proper testing function, time elapsed must be under 900 milliseconds
- ^m::
- {
- starttime := A_TickCount
- Loop 1
- {
- ; GoSub BossClick
- ; GoSub NoPortSweep
- ; Level(0)
- ; FormationSet(2)
- GoSub Reset
- GoSub CampStart
- Level(0, 5)
- Level(1, 2)
- Familiar(5)
- Familiar(2)
- }
- ; carenot := TransitionTest()
- wipelength := A_TickCount - starttime
- MsgBox, Loop length %wipelength% milliseconds
- Return
- }
- ; Transition detector loop test
- ; Runs an loop of a function or subroutine followed by TransitionTest until a transition is detected
- ; To test, turn off autoprogress and go to a level besides your current highets.
- ; Activate the macro, then hit g to start a level transition.
- ; Use this function then initiate a level transition to ensure the function/subroutine being tested remains under time
- ^t::
- {
- Loop 10
- {
- ; GoSub BossClick
- GoSub NoPortSweep
- If TransitionTest()
- Break
- }
- MsgBox, Transition Detection successful
- Return
- }
- CampStart: ; Starts the campaign from the map screen
- {
- Loop 15 ; Zooms out campaign map
- {
- MouseClick, WheelDown, %campx%, %campy%
- Sleep 5
- }
- Sleep 200
- Click %campselectx%, %tombselecty% ; Select Tomb of Annihilation
- Sleep 200
- Click %campselectx%, %grandselecty% ; Select A Grand Tour
- Sleep 200
- Click %campx%, %campy% ; Click the campaign icon
- Sleep 200
- Click
- Sleep 200
- Loop 15 ; Makes sure campaign list is at the top
- { ; Hide completed and hide locked are OFF
- MouseClick, WheelUp, listx, listy
- Sleep 55
- }
- Loop 5 ; Scrolls down until Mad Wizard Free Play is visible
- {
- MouseClick, WheelDown, listx, listy
- Sleep 55
- }
- MouseMove %listx%, %listy% ; Clicks Mad Wizard
- Sleep 200
- Click %listx%, %listy%
- Sleep 200
- MouseMove campstartx, campstarty ; Clicks campaign start
- Sleep 200
- Click %campstartx%, %campstarty%
- Sleep 200
- MouseMove dpsx, dpsy
- Sleep 2000
- ;Loop
- ;{
- ; PixelGetColor, colour, dpsx, dpsy
- ; IfEqual, colour, %dpsc%
- ; Break
- ;}
- MouseMove dpsx + 100, dpsy + 100
- Return
- }
- ; 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
- ; 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
- ; a message box will appear with the hex code of the color under the point
- ^q::
- {
- PixelGetColor, colour, dpsx, dpsy
- MsgBox %colour%
- }
- Autoprogress:
- {
- PixelGetColor, colour, whitearrowx, whitearrowy
- IfEqual, colour, 0xFFFFFF
- {
- send, g
- Return
- }
- Else
- Return
- }
- Reset:
- {
- MouseMove completex, completey, 0 ; Clicks complete adventure button
- PixelGetColor, colour, completex, completey ; Checks to make sure a level transition is not in progress before attempting to reset
- IfEqual, colour, 0x000000
- Sleep 3500
- Sleep 200
- Click
- Sleep 450
- MouseMove confirmx, confirmy, 0 ; Clicks confirm
- Sleep 200
- Click
- Sleep 200
- Click
- Sleep 200 ; Longer to allow for animation
- MouseMove continuex, continuey, 0 ; Clicks continue
- Loop
- {
- Click
- If TransitionTest()
- Break
- Sleep 55
- }
- Return
- }
- ; Autoclicker for boss levels. Clicks in the middle of the screen where the bag will spawn and jiggles the cursor to pick up gems.
- BossClick:
- {
- MouseMove sweepleft, bagclick
- Sleep 50
- Loop 4
- {
- Click
- Sleep 50
- }
- MouseMove sweepleft, bagclick + 5
- Sleep 50
- Loop 4
- {
- Click
- Sleep 50
- }
- Return
- }
- ; 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
- NoPortSweep:
- {
- interval := ( sweeplow - sweepvert ) / 4
- sweepy := sweepvert
- MouseMove sweepright, sweepvert
- Loop 5
- {
- Click %sweepright%, %sweepy%
- sweepy := sweepy + interval
- Sleep 50
- }
- Return
- }
- ; Autoclicker levels where the stage moves and items spawn. Offsets the clicker slightly from the NoPortSweep baseline to ensure drops aren't missed
- RollItemSweep:
- {
- interval := ( sweeplow - sweepvert ) / 4
- sweepy := sweepvert
- sweepx := sweepright - 10
- MouseMove sweepright, sweepvert
- Loop 5
- {
- Click %sweepx%, %sweepy%
- sweepy := sweepy + interval
- Sleep 50
- }
- Return
- }
- ; 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
- PortSweep:
- {
- interval := ( sweeplow - sweepvert ) / 4
- sweepy := sweepvert
- MouseMove sweepport, sweepvert
- Loop 5
- {
- Click %sweepport%, %sweepy%
- sweepy := sweepy + interval
- Sleep 50
- }
- Return
- }
- Level(champ, num := 1) ; Levels/unlocks a champion or click damage
- { ; Recieves a number corresponding to the champion's location in the roster
- x := rosterx + rosterinterval * champ
- if(champ = 0)
- {
- x := rosterx + 30
- }
- Loop 3
- {
- MouseClick, WheelUp, %x%, %rostery% ; Scrolls roster to ensure click damage is visible at the far right
- Sleep 5 ; Script will sometime inadvertently move the roster when interacting
- }
- MouseMove, x, rostery
- Sleep 200
- Loop %num% ; Bruenor is 1, for example. Click damage is 0
- { ; Will level once by default, caller can send an integer to level more than once
- Click ; %x%, %rostery%
- Sleep 100
- }
- Loop 2
- {
- PixelGetColor, colour, greyx, greyy ; Checks for upgrade selector window. As noted above, the roster sometime gets scrolled
- IfEqual, colour, %greyc% ; if it does, and Bruenor gets levelled to his selector, this is needed to escape
- {
- interval := ( leftselect - rightselect ) / 4
- selectx := rightselect
- MouseMove selectx, selecty
- Loop 5
- {
- Click %selectx%, %selecty%
- selectx := selectx + interval
- Sleep 50
- Click
- Sleep 50
- }
- }
- }
- Return
- }
- FormationSet(number)
- {
- If (number = 1)
- Send, q
- If (number = 2)
- Send, w
- If (number = 3)
- Send, e
- Return
- }
- ; Locks the script until the level transition screen begins clearing
- ; Makes sure the main function passes to the next level at a more consistent timing
- ; since the Zone function has nearly a second of variability in when it detects a transition
- TransWait:
- {
- Loop
- {
- if !TransitionTest()
- Return
- }
- }
- ; 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
- Zone(Type)
- {
- If (Type = 5) ; Boss level loop
- {
- Loop 180
- {
- GoSub BossClick
- If TransitionTest()
- Return
- }
- }
- If (Type = 3) ; Portal level loop
- {
- Loop 180
- {
- GoSub PortSweep
- If TransitionTest()
- Return
- }
- }
- If (Type = 2) ; Non portal, non boss level loop
- {
- Loop 180
- {
- GoSub RollItemSweep
- If TransitionTest()
- Return
- }
- }
- If (Type = 1) ; Non portal, non boss level loop
- {
- Loop 180
- {
- GoSub NoPortSweep
- If TransitionTest()
- Return
- }
- }
- IfWinExist, Idle Champions
- {
- WinActivate
- Sleep 150
- GoSub Reset
- GoSub TransWait
- Sleep 3000
- GoSub Main
- }
- Else
- {
- Reload
- }
- }
- Familiar(Place)
- {
- If(Place = 1)
- {
- finalx := click1x
- finaly := click1y
- }
- If(Place = 2)
- {
- finalx := click2x
- finaly := click2y
- }
- If(Place = 3)
- {
- finalx := click3x
- finaly := click3y
- }
- If(Place = 4)
- {
- finalx := click4x
- finaly := click4y
- }
- If(Place = 5)
- {
- finalx := clickdx - 5
- finaly := clickdy
- }
- MouseMove frosterx, frostery
- Sleep 100
- Click Down
- Sleep 100
- MouseMove, finalx, finaly, 20
- Sleep 100
- Click Up
- Return
- }
- ; Checks if a level transition is in progress, returns true if so
- ; Must be called every 900 milliseconds or less in order to ensure that it catches each transition
- TransitionTest()
- {
- ;MouseMove, transx, transy
- PixelGetColor, colour, transx, transy
- If (colour == 0x000000)
- Return True
- Else
- Return False
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement