Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;ASS(Autoit Sarkoth Script) ver 1.1.2
- ;WONT WORK UNLESS MOVE IS BOUND TO MIDDLE MOUSE (Mouse 3) -- NOT MOVE/INTERACT
- ;Tested With DH build: http://d3db.com/tool/calculator/demon-hunter/28243
- ;Required Max Discipline: 35
- ;Required display mode for cellar detection: "16:9, Tested with 1600*900"
- ;Features:
- ;Selling Junks Supported
- ;Loot scanning. You can choose which quality to loot.
- ;Automatic repair on yellow status icon
- ;Automatic resolution adjustment(need testing)
- ;Stuck Avoidance
- ;Tooltip on pause
- ;Very safe approach, almosot no deaths
- ;Original:
- ;[Goldfarming] AFK 150k-200k Gold Per Hour by mackus101 @ ownedcore
- Global $Paused
- HotKeySet("=","TogglePause") ;script can be START and PAUSE by pressing = Also Show some statistics
- HotKeySet("x", "Stop") ;script can be Stopped by pressing x
- Global $loadtime = 3500
- Global $waittime = 4000
- Global $LForLegendary = True, $TotalLegendary = 0 ;Loot Legendary Items
- Global $LForSet = True, $TotalSet = 0 ;Loot Set Items
- Global $LForRare = True, $TotalRare = 0 ;Loot Rare Items
- Global $LForMagic = True, $TotalMagic = 0 ;Loot Magic Items
- Global $LForJunk = True, $TotalJunk = 0 ;Loot Junk Items
- Global $Runs = 0 ;for tracking Number of Runs(Do not modify it)
- Global $VoidRuns = 0 ;To keep track of howmany times Cellar Spawns
- Global $SellItems = True ;If you want to sell Magic and Junk Items
- Global $SelPeriod = 12 ; How many Runs before Selling Junks
- $Run = False
- $default_resolutionX = 1920
- $default_resolutionY = 1080
- $x_ratio = @Desktopwidth / $default_resolutionX
- $y_ratio = @Desktopheight / $default_resolutionY
- While True
- if($Run) Then
- $Runs += 1
- Sleep(3000)
- If CheckInGame() Then
- If CheckRepair() Then ;Repair is needed
- Teleport()
- While Not CheckInTown() ;Wait till get in town
- If Not CheckDead() Then ;to prevent Teleporting after coming back to life
- Teleport()
- EndIf
- WEnd
- Sleep(100)
- Repair()
- Sleep(100)
- ResetRun()
- Else
- GetToMiddle()
- If CheckCellar() Then
- GetToCellar()
- CheckDead()
- FightSarkoth()
- MouseClick("left",Round(579 *$x_ratio),Round(209 * $y_ratio)) ;location of sarkoth after death
- $TotalMagic += 1 ;Counts Magic item at Sarkoth Location
- CheckLoot()
- MouseClick("left",Round(1100 *$x_ratio),Round(324 * $y_ratio)) ;moves to right top corner for gold
- Sleep(500)
- MouseClick("left",Round(487 *$x_ratio),Round(813 * $y_ratio)) ;moves to left top corner for gold
- Sleep(1500)
- If Not CheckDead() Then
- Teleport()
- While Not CheckInTown() ;Wait till get in town
- WEnd
- if ($Runs / $SelPeriod == Round($Runs/$SelPeriod)) AND $SellItems Then
- SellJunk()
- EndIf
- Sleep(300)
- ResetRun()
- EndIf
- Else
- $VoidRuns += 1
- GetToSafety()
- Teleport()
- While Not CheckInTown() ;Wait till get in town
- If Not CheckDead() Then ;to prevent Teleporting after coming back to life
- Teleport()
- EndIf
- WEnd
- if ($Runs / $SelPeriod == Round($Runs/$SelPeriod)) AND $SellItems Then
- SellJunk()
- EndIf
- Sleep(300)
- If CheckInTown() Then
- ResetRun()
- EndIf
- EndIf ;End of checkcellar
- EndIf ;End of checkrepair
- Else
- GetInGame();Resume the game
- EndIf ;End of checkingame
- EndIf ;End of Run
- WEnd ;End of Script
- Func CheckDead()
- $Pixeltest = PixelGetColor(Round(740*$x_ratio), Round(850*$y_ratio))
- If Hex($Pixeltest, 6) == "0C0404" OR Hex($Pixeltest, 6) == "310000" Then
- Sleep(100)
- Send("{Escape}")
- Sleep(10)
- MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
- Sleep(10000)
- Sleep($waittime)
- MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
- Sleep($loadtime)
- $Flag = True
- Else
- $Flag = False
- EndIf
- Return $Flag
- EndFunc
- Func CheckInGame()
- $TeleportButton = PixelSearch(Round(1104*$x_ratio), Round(1008*$y_ratio), Round(1134*$x_ratio), Round(1032*$y_ratio), 0xD9F3FD, 2);Detects If player is in game
- If Not @error Then
- Return True
- Else
- Return False
- EndIf
- EndFunc
- Func GetInGame()
- Send("{SPACE}") ;close any open windows
- Sleep(100)
- MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
- Sleep($loadtime)
- EndFunc
- Func CheckInTown()
- $TownBox = PixelSearch(Round(666*$x_ratio), Round(912*$x_ratio), Round(708*$y_ratio), Round(954*$x_ratio), 0x8D6F47);Detects If player is in Town
- If Not @error Then
- Return True
- Else
- Return False
- EndIf
- EndFunc
- Func CheckLoot()
- If $LForLegendary Then
- $i = 0
- While $i < 2
- Send("{LALT}")
- Sleep(200)
- $Legendary = PixelSearch(Round(756*$x_ratio), Round(360*$y_ratio), Round(1080*$x_ratio), Round(668*$y_ratio), 0xBF642F, 2, 3) ;searches main window for color of legendary lootz
- If Not @error Then
- ToolTip("Legendary Loot Has been Find",700, 450)
- Sleep(2000)
- ToolTip("")
- $TotalLegendary += 1
- if IsArray($Legendary) then
- MouseClick ('left', $Legendary[0], $Legendary[1])
- Sleep(Random(400,1200))
- EndIf
- EndIf
- $i = $i+1
- WEnd
- EndIf
- If $LForSet Then
- $i = 0
- While $i < 1
- Send("{LALT}")
- Sleep(200)
- $Set = PixelSearch(Round(756*$x_ratio), Round(360*$y_ratio), Round(1080*$x_ratio), Round(668*$y_ratio), 0x00FF00, 1, 3) ; searches main window for color of Set lootz
- If Not @error Then
- ToolTip("Set Loot Has been Find",700, 450)
- Sleep(2000)
- ToolTip("")
- $TotalSet += 1
- ToolTip("")
- if IsArray($Set) then
- MouseClick ('left', $Set[0], $Set[1])
- Sleep(Random(400,1200))
- EndIf
- EndIf
- $i = $i+1
- WEnd
- EndIf
- If $LForRare Then
- $i = 0
- While $i < 3
- Send("{LALT}")
- Sleep(200)
- $Rare = PixelSearch(Round(756*$x_ratio), Round(360*$y_ratio), Round(1080*$x_ratio), Round(668*$y_ratio), 0xFFFF00, 2, 3) ; rare lootz (also f3f45b)
- If Not @error Then
- ToolTip("Rare Loot Has been Find",700, 450)
- Sleep(1000)
- ToolTip("")
- $TotalRare += 1
- ToolTip("")
- if IsArray($Rare) then
- MouseClick ('left', $Rare[0], $Rare[1])
- Sleep(Random(400,1200))
- EndIf
- EndIf
- $i = $i+1
- WEnd
- EndIf
- If $LForMagic Then
- $i = 0
- While $i < 5
- Send("{LALT}")
- Sleep(200)
- $Magic = PixelSearch(630, 300, 900, 550, 0x6969FF, 5, 3) ; magic lootz
- If Not @error Then
- ;ToolTip("Magic Loot Has been Find",700, 450)
- Sleep(200)
- ;ToolTip("")
- $TotalMagic += 1
- if IsArray($Magic) then
- MouseClick ('left', $Magic[0], $Magic[1])
- Sleep(Random(400,1200))
- EndIf
- EndIf
- $i = $i+1
- WEnd
- EndIf
- If $LForJunk Then
- $i = 0
- While $i < 5
- Send("{LALT}")
- Sleep(200)
- $Junk = PixelSearch(Round(756*$x_ratio), Round(360*$y_ratio), Round(1080*$x_ratio), Round(668*$y_ratio), 0xFFFFFF, 3, 3) ; Junk lootz
- If Not @error Then
- ;ToolTip("Jagic Loot Has been Find",700, 450)
- Sleep(400)
- ;ToolTip("")
- $TotalJunk += 1
- if IsArray($Junk) then
- MouseClick ('left', $Junk[0], $Junk[1])
- Sleep(Random(400,1200))
- EndIf
- EndIf
- $i = $i+1
- WEnd
- EndIf
- EndFunc
- Func ResetRun()
- Send("{ESCAPE}") ;opens menu
- Sleep(100)
- MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
- Sleep($waittime) ;Wait to get in game menu
- Send("{SPACE}") ;close any open windows
- MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
- Sleep($loadtime)
- EndFunc
- Func Teleport()
- Send("t")
- Sleep(7500)
- EndFunc
- Func CheckRepair()
- $RepairArea = PixelSearch(Round(1480*$x_ratio), 0, Round(1900*$x_ratio), Round(50*$y_ratio), 0xFFF000, 2);searches top right screen for yellow of broken armor
- If Not @error Then
- Return True
- EndIf
- $RepairAreaRed = PixelSearch(Round(1480*$x_ratio), 0, Round(1900*$x_ratio), Round(50*$y_ratio), 0xD90000, 2);searches top right screen for red of broken armor
- If Not @error Then
- Return True
- EndIf
- Return False
- EndFunc
- Func Repair()
- MouseClick("middle", Round(1480*$x_ratio),Round(281*$y_ratio)) ;begin movement towards merchant
- Sleep(1500)
- MouseClick("left", Round(1316*$x_ratio),Round(206*$y_ratio)) ;moves to get merchant in screen
- Sleep(1500)
- MouseClick("left", Round(845*$x_ratio),Round(225*$y_ratio)) ;NPC Merchant to the right of cain's home
- Sleep(1500)
- MouseClick("left", Round(521*$x_ratio),Round(506*$y_ratio)) ;button to open up repair menu
- Sleep(1500)
- MouseClick("left", Round(260*$x_ratio),Round(595*$y_ratio)) ;button to pay for repairs
- Sleep(100)
- Send("{ESCAPE}") ;closes repair tab
- EndFunc
- Func SellJunk()
- $left = 1854*$x_ratio
- $right = 1882.8*$x_ratio
- MouseClick("left", Round(1480*$x_ratio),Round(281*$y_ratio)) ;begin movement towards merchant
- Sleep(1500)
- MouseClick("left", Round(1316*$x_ratio),Round(206*$y_ratio)) ;moves to get merchant in screen
- Sleep(1500)
- MouseClick("left", Round(845*$x_ratio),Round(225*$y_ratio)) ;NPC Merchant to the right of cain's home
- Sleep(1500)
- For $j = 1 To 10
- $top = 836.4*$y_ratio
- $bottom = 861.6*$y_ratio
- For $k = 1 To 6
- ;MouseMove($left, $top, 1)
- $JunkItem = PixelSearch($left, $top, $right, $bottom, 0x130B08, 1, 2) ;search Inventory for Junk Items to sell
- If Not @error Then
- if IsArray($JunkItem) then
- MouseClick ('right', $JunkItem[0], $JunkItem[1], 1)
- EndIf
- EndIf
- Sleep(200)
- $RareItem = PixelSearch($left, $top, $right, $bottom, 0x11213A, 5, 2) ;search Inventory for Magic Items to sell
- If Not @error Then
- if IsArray($RareItem) then
- MouseClick ('right', $RareItem[0], $RareItem[1], 1)
- EndIf
- EndIf
- $top -= 48*$y_ratio
- $bottom -= 48*$y_ratio
- Next
- $left -= 48*$x_ratio
- $right -= 48*$x_ratio
- Next
- Sleep(100)
- Send("{SPACE}") ;closes Merchant Window
- EndFunc
- Func GetToMiddle()
- MouseClick("middle", 587 * $x_ratio,335* $y_ratio) ;starts the main run
- Sleep(600)
- Sleep(1000)
- Send("2") ;Smoke Screen
- MouseClick("middle", 96 * $x_ratio,383 * $y_ratio)
- Sleep(800)
- Send("1")
- Sleep(1200)
- MouseClick("middle", Round(417 * $x_ratio),Round(422 * $y_ratio)) ;middle of area outside of cellar
- Sleep(100)
- Send("1")
- Sleep(1500)
- Send("3") ;Caltrops
- EndFunc
- Func GetToSafety()
- Send("{SHIFTDOWN}")
- MouseDown("left")
- Sleep(100)
- MouseUp("left")
- Send("{SHIFTUP}")
- Sleep(100)
- MouseClick("middle", Round(1115 *$x_ratio), Round(205 * $y_ratio), 1) ;moves up screen away from cellar in attempt for safety before teleporting back to town
- Sleep(100)
- Send("1")
- Sleep(300)
- EndFunc
- Func CheckCellar()
- Sleep(400)
- MouseMove(Round(115 * $x_ratio),Round(210 * $y_ratio),1) ;moves cursor over to the cellar so the proper blue pixel becomes highlighted
- Sleep(500)
- Global $Cellar = PixelSearch(0,0, Round(600*$x_ratio), Round(600*$y_ratio),0x334FB7,3) ;searches for the specific blue pixel that only occurs when mouse hovers over open cellar
- If Not @error Then
- Return True
- Else
- MouseMove(Round(150 * $x_ratio), Round(108 * $y_ratio), 1) ;moves cursor over to the Alternate cellar Location so the proper blue pixel becomes highlighted
- Sleep(800)
- $AltCellar = PixelSearch(0,0, Round(600*$x_ratio), Round(600*$y_ratio),0x334FB7,3) ;searches for the specific blue pixel
- If IsArray($AltCellar) Then
- Return True
- EndIf
- EndIf
- Return False
- EndFunc
- Func GetToCellar()
- Sleep(100)
- Send("2") ;Smoke Screen
- If IsArray($Cellar) Then
- MouseClick("left",Round(115 *$x_ratio),Round(210 * $y_ratio)) ;Entrance to cellar
- Sleep(4000)
- Else
- MouseClick("left",Round(150 *$x_ratio),Round(108 * $y_ratio)) ;Entrance to cellar
- Sleep(5000)
- EndIf
- EndFunc
- Func FightSarkoth()
- Send(2)
- Sleep(100)
- MouseClick("left",Round(531 *$x_ratio),Round(769 * $y_ratio))
- Sleep(600)
- MouseClick("left",Round(547 *$x_ratio),Round(490 * $y_ratio)) ;moves to doorway leading to rare inside cellar
- Sleep(1500)
- MouseMove(Round(579 * $x_ratio),Round(209 * $y_ratio),1) ;hovers over the rare Sarkoth
- Send(4)
- Sleep(1000)
- Send("{SHIFTDOWN}")
- MouseDown("right") ;attack middle
- Sleep(3800)
- MouseMove(Round(467 * $x_ratio),Round(269 * $y_ratio),1) ;attack left, add more sleep time if you can't kill minion on left
- Sleep(3000)
- MouseMove(Round(682 * $x_ratio),Round(147 * $y_ratio),1) ;attack right
- Sleep(800)
- MouseMove(Round(579 * $x_ratio),Round(209 * $y_ratio),1) ;move back to middle
- Sleep(1000)
- MouseUP("right")
- Sleep(300)
- Send("{SHIFTUP}")
- EndFunc
- Func TogglePause()
- $Run = Not $Run
- While Not $Run
- Sleep(100)
- ToolTip("So far "&$Runs&" Runs("&$VoidRuns&" Void Runs): "&$TotalLegendary&" Legendaries, "&$TotalSet&" Sets, "&$TotalRare&" Rares, "&$TotalMagic&" Magic, "&$TotalJunk&" Junks Looted",700, 450)
- WEnd
- ToolTip("")
- EndFunc ;==>TogglePause
- Func Stop() ;to allow the script to stop
- Exit 0
- EndFunc
Advertisement
Add Comment
Please, Sign In to add comment