Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;notAres' Sarkoth DH Gold Script 1.3a - 6/9/2012 - Holy shit look how beautiful this code is. Utilized ExitLoop to perfect the efficiency when dead/logging out/in need of repair
- ;Thread: http://ownedcore.com/forums/diablo-3/diablo-3-bots-programs/354464-goldfarming-notares-sarkarth-dh-gold-script-autoit-script-1920x1080.html
- ;Please notice I changed some variable names around and added a variable for teleport time. $waittime is now appropriately named $loadtime.
- ;WONT WORK UNLESS MOVE IS BOUND TO MIDDLE MOUSE (Mouse 3) -- NOT MOVE/INTERACT
- ;Required build: http://us.battle.net/d3/en/calculator/demon-hunter#aRYXVT!aTW!YcaZbY
- ;Required movement speed: 25% (10% boots + 15% passive 'Hot Pursuit')
- ;Required display mode for cellar detection: "FULLSCREEN WINDOWED"
- ;Official supported resolution: 1920x1080
- ;;;;;
- ;Features:
- ;Loot scanning. Will only pick up rare/legendary/set pieces [IMPROVED]
- ;Randomized aiming coordinates (but still static path)
- ;Randomized pickup timers for variation in runs
- ;Automatic repair on yellow status icon
- ;Automatic resolution adjustment (16:9 only) [BUGGY - need someone to tweak coords]
- ;Death check
- ;Open window check (in rare case it gets stuck in menu)
- ;;;;;
- ;Original:
- ;[Goldfarming] AFK 150k-200k Gold Per Hour by mackus101 @ ownedcore
- Opt('MouseCoordMode', 2)
- Opt('PixelCoordMode', 2)
- Global $Paused
- HotKeySet("=","Leave") ;script started by pressing =
- HotKeySet("-", "Pause") ;script paused by pressing -
- HotKeySet("x", "Stop") ;script stopped by pressing x
- $walktime = 3000 ; time in ms the script waits for you to enter and load the cellar. Slow this down for slower move speeds and loading times
- $loadtime = 3200 ; time in ms the script waits for the game to load before it starts pathfinding. Slow this down for slower hard drives
- $tptime = 6900 ; time in ms the script waits for teleport before exiting the game
- $yellow = 0xFFF000 ; yellow color code (repair icon)
- $red = 0xD90000 ; red color code (repair icon)
- $blueInventory = 0x161D35
- $LootRares = True ; Change this to false if you don't want the bot to pick up rares (good for legendary/set only, recommend setting LootGems to False)
- $LootBlues = True
- $LootGems = True ; Change this to true if you want to pick up gems (messy, can fill up bag with whites/blues)
- $Amethyst = 0xAC7FFF
- $Ruby = 0xB01D2D
- $Emerald = 0x58EE33
- $Topaz = 0xFFFF59
- $runMade = 0
- $go = True
- $Leave = False
- $Dead = False
- $Logout = False
- $Window = False
- $default_resolutionX = 1920
- $default_resolutionY = 1080
- $x_ratio = 1600 / $default_resolutionX
- $y_ratio = 900 / $default_resolutionY
- $i = 0
- Call("RestartRun")
- Func RestartRun()
- While $go
- if($Leave) Then
- $i = 0
- Sleep(1000) ;had to add this since the icon doesn't show up RIGHT away in game
- Call("CheckDead")
- Call("CheckRepair")
- If $Window Then
- MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
- Sleep($loadtime)
- $Window = False
- ExitLoop
- ElseIf $Dead or $Logout Then
- ExitLoop
- EndIf
- MouseClick("left", Round(0 * $x_ratio),Round(250 * $y_ratio)) ;starts the main run
- Send("2")
- Send("4")
- Sleep(140)
- Send("4")
- Sleep(140)
- Send("4")
- Sleep(140)
- Send("4")
- Sleep(80)
- Send("4")
- Sleep(80)
- Send("4")
- Sleep(80)
- Send("4")
- Sleep(80)
- Send("4")
- Sleep(80)
- Sleep(300)
- MouseMove(Round(290*$x_ratio),Round(270*$y_ratio),1) ;moves cursor over to the cellar so the proper blue pixel becomes highlighted
- Sleep(700)
- Call("CheckDead")
- If $Window Then
- MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
- Sleep($loadtime)
- $Window = False
- ExitLoop
- ElseIf $Dead or $Logout Then
- ExitLoop
- EndIf
- $Pixel2 = PixelSearch(0,0, Round(600*$x_ratio), Round(600*$y_ratio),0x334FB7,3) ;checks for open cellar (in a 600x400 box from the top left - where it should always be)
- If Not @error Then
- MouseClick("left",Round(290*$x_ratio),Round(270*$y_ratio)) ;Entrance to cellar
- Sleep(400)
- Send("1")
- Send("3")
- Sleep($walktime)
- MouseClick("middle",Round(110*$x_ratio),Round(1000*$y_ratio)) ;moves to doorway leading to rare inside cellar
- Sleep(2500)
- MouseMove(Round(440*$x_ratio),Round(80*$y_ratio),1) ;hovers over the rare Sarkoth
- Sleep(10)
- Send("{SHIFTDOWN}")
- MouseClick("left",Round(440*$x_ratio),Round(80*$y_ratio),2)
- MouseDown("right") ;attack middle
- Sleep(6100)
- MouseClick("right",Round(620*$x_ratio),Round(20*$y_ratio),2) ;break the table & chair
- Sleep(10)
- Send("{SHIFTUP}")
- Sleep(400)
- MouseClick("middle",Round(530*$x_ratio),Round(170*$y_ratio)) ;location of sarkoth after death
- Sleep(2100)
- MouseClick("middle",Round(580*$x_ratio),Round(460*$y_ratio)) ;move to left top corner for gold
- Sleep(1100)
- MouseClick("middle",Round(1330*$x_ratio),Round(330*$y_ratio)) ;move to right top corner for gold
- Sleep(1100)
- MouseClick("middle",Round(1010*$x_ratio),Round(940*$y_ratio)) ;move to middle before looting
- Call("CheckLoot")
- Send("t")
- Sleep($tptime)
- Call("Town")
- Call("CheckDead")
- If Not $Dead And Not $Window Then
- Sleep(100)
- Send("{ESCAPE}") ;menu
- Sleep(20)
- MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
- Sleep(2500)
- Send("{SPACE}") ;close any open windows
- Sleep(500)
- Call("MainMenu")
- MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
- Sleep($loadtime)
- ElseIf $Window Then
- MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
- Sleep($loadtime)
- $Window = False ; reset the flag so it doesn't think a window is always up
- EndIf
- Else
- Sleep(50)
- Send("t")
- Sleep($tptime)
- Call("CheckDead")
- Call("CheckWindow")
- If Not $Dead And Not $Window Then
- Sleep(100)
- Send("{ESCAPE}") ;menu
- Sleep(10)
- MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
- Sleep(2500)
- Send("{SPACE}") ;close any open windows
- Sleep(500)
- Call("MainMenu")
- MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
- Sleep($loadtime)
- ElseIf $Window Then
- Call("MainMenu")
- MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
- Sleep($loadtime)
- $Window = False ; reset the flag so it doesn't think a window is always up
- EndIf
- EndIf
- EndIf
- WEnd
- EndFunc
- Func CheckDead()
- Call("CheckWindow")
- $Pixeltest = PixelGetColor(Round(740*$x_ratio), Round(850*$y_ratio))
- If Hex($Pixeltest, 6) == "0C0404" OR Hex($Pixeltest, 6) == "310000" Then
- If Not $Window Then
- $Dead = True
- Sleep(100)
- Send("{Escape}")
- Sleep(10)
- MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
- Sleep(2500)
- Call("MainMenu")
- MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
- Sleep($loadtime)
- ElseIf $Window Then
- Call("MainMenu")
- MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
- Sleep($loadtime)
- $Window = False
- EndIf
- ElseIf Hex($Pixeltest, 6) == "0C0000" OR Hex($Pixeltest, 6) == "030101" Then
- Sleep(10000)
- If Not $Window Then
- $Dead = True
- Sleep($loadtime)
- Call("MainMenu")
- MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
- Sleep($loadtime)
- ElseIf $Window Then
- Call("MainMenu")
- MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
- Sleep($loadtime)
- $Window = False
- EndIf
- Else
- $Dead = False
- EndIf
- EndFunc
- Func CheckWindow()
- $Pixeltest2 = PixelGetColor(Round(1580*$x_ratio), Round(100*$y_ratio))
- If Hex($Pixeltest2, 6) == "653B23" Then
- Sleep(200)
- Send("{SPACE}") ;close any open windows
- $Window = True
- Else
- $Window = False
- EndIf
- Sleep(300)
- EndFunc
- Func CheckRepair()
- $RepairArea = PixelSearch(Round(1480*$x_ratio), 0, Round(1570*$x_ratio), Round(100*$y_ratio), $yellow)
- If Not @error Then
- Call("DoRepair")
- EndIf
- $RepairAreaRed = PixelSearch(Round(1480*$x_ratio), 0, Round(1570*$x_ratio), Round(100*$y_ratio), $red)
- If Not @error Then
- Call("DoRepair")
- EndIf
- EndFunc
- Func DoRepair()
- Sleep(100)
- Send("t")
- Sleep($tptime)
- 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(1200)
- MouseClick("left", Round(521*$x_ratio),Round(506*$y_ratio)) ;button to open up repair menu
- Sleep(400)
- MouseClick("left", Round(260*$x_ratio),Round(595*$y_ratio)) ;button to pay for repairs
- Sleep(200)
- Call("CheckDead")
- If Not $Dead and Not $Logout Then
- Send("{ESCAPE}") ;closes repair tab
- Sleep(100)
- Send("{ESCAPE}") ;menu
- Sleep(10)
- MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
- Sleep($loadtime)
- MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
- Sleep($loadtime)
- EndIf
- EndFunc
- Func MainMenu() ;verifies the screen is at the main menu before attempting to start the next game to avoid getting trapped in menus.
- Local $Menu = False
- While $Menu = False
- $Pixeltestmm = PixelGetColor(Round(251*$x_ratio), Round(284*$y_ratio)) ;tests for main menu
- If Hex($Pixeltestmm, 6) == "683C02" Then
- $Menu = True
- Else
- $Pixeltestgm = PixelGetColor(Round(937*$x_ratio), Round(246*$y_ratio)) ;checks if game menu is open
- If Hex($Pixeltestgm, 6) == "621610" Then
- Send("{Escape}") ;return to main menu
- $Menu = True
- Else
- $Pixeltestgmexit = PixelGetColor(Round(975*$x_ratio), Round(428*$y_ratio)) ;checks if exit game menu is open
- If Hex($Pixeltestgmexit, 6) == "FFA300" Then
- Send("{Escape}")
- Send("{Escape}")
- $Menu = True
- Else
- $Pixeltestbm = PixelGetColor(Round(958*$x_ratio), Round(150*$y_ratio)) ;checks if banner customization window is open
- If Hex($Pixeltestbm, 6) == "933618" Then
- Send("{Escape}")
- $Menu = True
- Else
- $Pixeltestpm = PixelGetColor(Round(1506*$x_ratio), Round(138*$y_ratio)) ;checks if player window is open
- If Hex($Pixeltestpm, 6) == "320c08" Then
- Send("{Escape}")
- $Menu = True
- EndIf
- EndIf
- EndIf
- EndIf
- EndIf
- WEnd
- EndFunc
- Func Town()
- $runMade = $runMade + 1
- If $runMade > 5 Then
- MouseClick("left", 890, 253) ;go to chest
- Sleep(2000)
- MouseClick("left", 438, 223) ; 1st tab
- Sleep(500);
- Call("DropInChest");
- MouseClick("left", 436, 328) ; 2nd tab
- Sleep(500);
- Call("DepositRare")
- MouseClick("left", 436, 430) ; 3rd tab
- Sleep(500);
- Call("DepositRare")
- Send("{ESCAPE}") ;close windows
- Sleep(500)
- MouseClick("left", 767, 559) ;go back to tp spot
- Sleep(1500)
- 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(1200)
- VendorAll()
- ;SellBlue()
- ;Sleep(500)
- ;SellWhite()
- MouseClick("left", Round(521*$x_ratio),Round(506*$y_ratio)) ;button to open up repair menu
- Sleep(400)
- MouseClick("left", Round(260*$x_ratio),Round(595*$y_ratio)) ;button to pay for repairs
- Sleep(200)
- Send("{ESCAPE}") ;close windows
- Sleep(500)
- $runMade = 0
- EndIf
- EndFunc
- Func DropInChest()
- $Tomes = PixelSearch(1170,513,1593,758,0x7B4B1D)
- If Not @error Then
- MouseClick("right", $Tomes[0], $Tomes[1])
- Sleep(500)
- $i+= 1
- If $i <= 10 Then
- Call("DropInChest")
- EndIf
- EndIf
- $Amethyst1 = PixelSearch(1170,513,1593,758,0xC246FD)
- If Not @error Then
- MouseClick("right", $Amethyst1[0], $Amethyst1[1])
- Sleep(500)
- $i+= 1
- If $i <= 10 Then
- Call("DropInChest")
- EndIf
- EndIf
- $Amethyst2 = PixelSearch(1170,513,1593,758,0xC140FB)
- If Not @error Then
- MouseClick("right", $Amethyst2[0], $Amethyst2[1])
- Sleep(500)
- $i+= 1
- If $i <= 10 Then
- Call("DropInChest")
- EndIf
- EndIf
- $Ruby1 = PixelSearch(1170,513,1593,758,0xE0110D)
- If Not @error Then
- MouseClick("right", $Ruby1[0], $Ruby1[1])
- Sleep(500)
- $i+= 1
- If $i <= 10 Then
- Call("DropInChest")
- EndIf
- EndIf
- $Ruby2 = PixelSearch(1170,513,1593,758,0xF10E10)
- If Not @error Then
- MouseClick("right", $Ruby2[0], $Ruby2[1])
- Sleep(500)
- $i+= 1
- If $i <= 10 Then
- Call("DropInChest")
- EndIf
- EndIf
- $Emerald1 = PixelSearch(1170,513,1593,758,0x46E245)
- If Not @error Then
- MouseClick("right", $Emerald1[0], $Emerald1[1])
- Sleep(500)
- $i+= 1
- If $i <= 10 Then
- Call("DropInChest")
- EndIf
- EndIf
- $Emerald2 = PixelSearch(1170,513,1593,758,0x49DE45)
- If Not @error Then
- MouseClick("right", $Emerald2[0], $Emerald2[1])
- Sleep(500)
- $i+= 1
- If $i <= 10 Then
- Call("DropInChest")
- EndIf
- EndIf
- $Topaz1 = PixelSearch(1170,513,1593,758,0xDE930F)
- If Not @error Then
- MouseClick("right", $Topaz1[0], $Topaz1[1])
- Sleep(500)
- $i+= 1
- If $i <= 10 Then
- Call("DropInChest")
- EndIf
- EndIf
- $Topaz2 = PixelSearch(1170,513,1593,758,0xCB8100)
- If Not @error Then
- MouseClick("right", $Topaz2[0], $Topaz2[1])
- Sleep(500)
- $i+= 1
- If $i <= 10 Then
- Call("DropInChest")
- EndIf
- EndIf
- EndFunc
- Func VendorAll()
- For $i = 0 To 9 Step 1
- MouseClick("right", 1206 + (40 * $i), 525)
- Sleep(25)
- MouseClick("right", 1206 + (40 * $i), 525 + 40)
- Sleep(25)
- MouseClick("right", 1206 + (40 * $i), 525 + 80)
- Sleep(25)
- MouseClick("right", 1206 + (40 * $i), 525 + 120)
- Sleep(25)
- MouseClick("right", 1206 + (40 * $i), 525 + 160)
- Sleep(25)
- MouseClick("right", 1206 + (40 * $i), 525 + 200)
- Sleep(25)
- Next
- EndFunc
- Func DepositRare()
- Sleep(Random(200,700))
- $unique1 = PixelSearch(1170,513,1593,758,0x693B0E) ; unique1
- If Not @error Then
- MouseClick ('right', $unique1[0], $unique1[1])
- Sleep(Random(300,600))
- $i+= 1
- If $i <= 8 Then
- Call("DepositRare")
- EndIf
- EndIf
- $unique2= PixelSearch(1170,513,1593,758,0x9B6429) ; unique2
- If Not @error Then
- MouseClick ('right', $unique2[0], $unique2[1])
- Sleep(Random(200,600))
- $i+= 1
- If $i <= 8 Then
- Call("DepositRare")
- EndIf
- EndIf
- $rare1 = PixelSearch(1170,513,1593,758,0x554914) ; rare1
- If Not @error Then
- MouseClick ('right', $rare1[0], $rare1[1])
- Sleep(Random(200,500))
- $i+= 1
- If $i <= 8 Then
- Call("DepositRare")
- EndIf
- EndIf
- $rare2 = PixelSearch(1170,513,1593,758,0x7E711B) ; rare2
- If Not @error Then
- MouseClick ('right', $rare2[0], $rare2[1])
- Sleep(Random(300,500))
- $i+= 1
- If $i <= 8 Then
- Call("DepositRare")
- EndIf
- EndIf
- $rare3 = PixelSearch(1170,513,1593,758,0x8E8725) ; rare3
- If Not @error Then
- MouseClick("right", $rare3[0], $rare3[1])
- Sleep(500)
- $i+= 1
- If $i <= 8 Then
- Call("DepositRare")
- EndIf
- EndIf
- $rare4 = PixelSearch(1170,513,1593,758,0x817726) ; rare4
- If Not @error Then
- MouseClick("right", $rare4[0], $rare4[1])
- Sleep(500)
- $i+= 1
- If $i <= 8 Then
- Call("DepositRare")
- EndIf
- EndIf
- $rare5 = PixelSearch(1170,513,1593,758,0x5B4A08) ; rare5
- If Not @error Then
- MouseClick("right", $rare5[0], $rare5[1])
- Sleep(500)
- $i+= 1
- If $i <= 8 Then
- Call("DepositRare")
- EndIf
- EndIf
- $rare6 = PixelSearch(1170,513,1593,758,0x8D831F) ; rare6
- If Not @error Then
- MouseClick("right", $rare6[0], $rare6[1])
- Sleep(500)
- $i+= 1
- If $i <= 8 Then
- Call("DepositRare")
- EndIf
- EndIf
- EndFunc
- Func CheckLoot()
- Sleep(Random(500,2000))
- $SetLoot = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0x02CE01, 2) ; set loot
- If Not @error Then
- MouseClick ('left', $SetLoot[0], $SetLoot[1])
- Sleep(Random(800,1200))
- $i+= 1
- If $i <= 6 Then
- Call("CheckLoot")
- EndIf
- EndIf
- $LegendaryLoot= PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0xBF642F, 2) ; legendary loot
- If Not @error Then
- MouseClick ('left', $LegendaryLoot[0], $LegendaryLoot[1])
- Sleep(Random(800,1200))
- $i+= 1
- If $i <= 6 Then
- Call("CheckLoot")
- EndIf
- EndIf
- If $LootRares Then
- $RareLoot = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0xBBBB00, 2) ; rare loot (darker for compatibility)
- If Not @error Then
- MouseClick ('left', $RareLoot[0], $RareLoot[1])
- Sleep(Random(700,900))
- $i+= 1
- If $i <= 6 Then
- Call("CheckLoot")
- EndIf
- EndIf
- EndIf
- If $LootBlues Then
- $BlueLoot = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0x5555CD, 2) ; blue loot (darker for compatibility)
- If Not @error Then
- MouseClick ('left', $BlueLoot[0], $BlueLoot[1])
- Sleep(Random(700,900))
- $i+= 1
- If $i <= 6 Then
- Call("CheckLoot")
- EndIf
- EndIf
- EndIf
- If $LootGems Then
- $AmethystDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Amethyst,8)
- If Not @error Then
- MouseClick("left", $AmethystDrop[0], $AmethystDrop[1])
- Sleep(Random(900,1400))
- $i+= 1
- If $i <= 10 Then
- Call("CheckLoot")
- EndIf
- EndIf
- $RubyDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Ruby,6)
- If Not @error Then
- MouseClick("left", $RubyDrop[0], $RubyDrop[1])
- Sleep(Random(900,1400))
- $i+= 1
- If $i <= 10 Then
- Call("CheckLoot")
- EndIf
- EndIf
- $EmeraldDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Emerald,11)
- If Not @error Then
- MouseClick("left", $EmeraldDrop[0], $EmeraldDrop[1])
- Sleep(Random(900,1400))
- $i+= 1
- If $i <= 10 Then
- Call("CheckLoot")
- EndIf
- EndIf
- $TopazDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Topaz,2)
- If Not 1 = 1 Then ; change to 'If Not @error Then' if you want to search for topazes
- MouseClick("left", $TopazDrop[0], $TopazDrop[1])
- Sleep(Random(900,1400))
- $i+= 1
- If $i <= 10 Then
- Call("CheckLoot")
- EndIf
- EndIf
- EndIf
- EndFunc
- Func Pause()
- $Leave = False
- EndFunc
- Func Stop() ;to allow the script to stop
- Exit
- EndFunc
- Func Leave()
- $Leave = True
- EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement