| User |
 |
Joined: Sun Jun 10, 2012 3:07 am
|
I also have not found a single legendary or set item and yet millions of gold. It's just bad luck I think (I also have no magic find). Updated my code, it now detects for the blue door frame once inside the cellar, and will leave game if it doesn't find it. This way when you miss the cellar but it still shows up on the minimap it won't walk around shooting at random things until it dies Working good so far  Here are the skills you will need:  1 = Smoke Screen (Lingering Fog) 2 = Caltrops (Hooked Spines) 3 = Spike Trap (Scatter) 4 = Companion (Ferrets) Leftclick = Hungering Arrow (Devouring Arrow) Rightclick = Cluster Arrow (Loaded for Bear) Must set middle mouse to movePassives: Hot Pursuit, Vengeance, Perfectionist #Include <File.au3> #Include <Date.au3> Opt('MouseCoordMode', 0) Opt('PixelCoordMode', 0) HotKeySet('{END}', 'Quit') HotKeySet('{HOME}', 'Pause')
$FLog = True ; Change this to false if you don't want the bot to compile a txt log file
Global $Paused Global $Picked = False Global $Run = 0 Global $SuccessfulRuns = 0 Global $StartTime = 0 ; True - Show current status tooltip (Screen top left) Global $StatusTip = True
; CONFIGURATION $Overnight = False ; Set to true if you want it to only pick up rares and legendaries, false if you want to pick up magic items as well wich fills your inventory up fast $LegendaryBackup = True ; Set to true if you want to set a backup to attempt to loot legendary items twice (a bit messy and will pick up whites/greys) $RareBackup = True ; Set to true if you want to set a backup to attempt to loot rare items twice $LootGems = False ; Set to true if you want to pick up gems (doesn't work very well, I suggest keeping it to false) $BluesPickedUp = 0 $MaxBluesBeforeSell = 10 $i = 0 $Amethyst = 0xA56DF1 $Ruby = 0xFA8078 $Emerald = 0x51965B $Topaz = 0xFFFF59 $Left = 64 $Top = 42 $Right = 720 $Bottom = 519 $Color = 0xFFFF00 ;rare color code $Color2 = 0x6969FF ;blue color code $Color3 = 0xBF642F ;legendary color code $Color4 = 0x00FF00 ;SET color
$walktime = 3500 ; time in ms the script waits for you to enter and load the cellar. Slow this down for slower move speeds and loading times $tptime = 7600 ; time in ms the script waits for teleport before exiting the game $loadtime = 1900 ; time in ms the script waits for the game to load before it tries to clear error windows
; Bot starts paused. Press HOME in lobby to start! Pause() LogToFile("Starting Log...") WinActivate('Diablo III') Call("CheckResumeGame")
Func CheckResumeGame() ; Resume game function starts here ;PRINT("Resume game") While 1 ;MouseClick('left', 751, 91, 1, 0) ; prevent of being stuck on the menu ;Send("{enter}") ;Clearing any error message, 1st check ;Sleep(400) ;Send("{enter}") ;Clearing any error message, 2nd check ;Sleep(400) ;Send("{space}") ;Clearing any option/profile window ;$resumeButton = PixelSearch(90,250,140,270,0x8f492f,30) ;check if resume button is enabled $resumeButton = PixelSearch(97,258,177,265,0xA25738, 30) ;check if resume button is enabled If Not @error Then Sleep(1000) Send("{enter}") ;Clearing any error message, 1st check Sleep(600) Send("{enter}") ;Clearing any error message, 2nd check Sleep(600) Send("{space}") ;Clearing any option/profile window Sleep(600) $Run += 1 PRINT("Joining Game [" & $Run & "]") LogToFile("Joining Game [" & $Run & "]") MouseClick('left',134, 255,1,0) Sleep($loadtime); Game loading time Call("Ready") EndIf Sleep(12000) Send("{enter}") ;Clearing any error message, 1st check Sleep(600) Send("{enter}") ;Clearing any error message, 2nd check Sleep(600) Send("{space}") ;Clearing any option/profile window Sleep(600) Call("CheckDead") WEnd EndFunc ; Resume game function ends here
Func Ready() ; Function ready starts here PRINT("Loading Game [" & $Run & "]") While 1 $green = PixelSearch(515,333,515,333,0x416855,15) ;searches green ground If Not @error Then PRINT("In-game [" & $Run & "]") LogToFile("In-game [" & $Run & "]") $StartTime = _NowCalc() Call("Route") EndIf WEnd EndFunc ; Function ready ends here
Func Route() PRINT("Run[" & $Run & "]") If WinActive('Diablo III') Then $repair = PixelSearch(569,39,597,84,0xFFF000) ; This is the start of the repair script, I don't suggest changing anything If Not @error Then PRINT("Going to repair") Send("t") Sleep($tptime) Call("CheckDead") Sleep(100) MouseClick("left", 710, 40) ; Walks towards merchant Sleep(2400) MouseClick("left", 480, 140) ; NPC Merchant to the right of cain's home Sleep(3000) MouseClick("left", 280, 275) ; Button to open up repair menu Sleep(1500) MouseClick("left", 140, 330) ; Button to pay for repairs Sleep(1500) Send("{ESC}") ; Opens menu Sleep(1000) Send("{ESC}") ; Opens menu Sleep(1000) LogToFile("Sell/Repair game.") ; Marks repairing in log LogToFile("Exiting game. (Lasted: " & _DateDiff("s", $StartTime, _NowCalc()) & "s)") MouseClick("left", 400, 350) ; Button to leave game Sleep(2400) ; End of repair script Call("CheckResumeGame") Else PRINT("Starting route [" & $Run & "]") ; Route start, I don't suggest changing anything in this route MouseClick("middle", 110, 145) ; Walks to waypoint 1 PRINT("Walking to waypoint 1 [" & $Run & "]") Sleep(900) PRINT("Walking to waypoint 1 - Smoke Screen [" & $Run & "]") Send("1") ; Uses Smoke Screen Sleep(300) MouseClick("middle", 10, 320) ; Walks to waypoint 2 PRINT("Walking to waypoint 2 [" & $Run & "]") Sleep(1400) MouseClick("middle", 10, 320) ; Walks to waypoint 3 PRINT("Walking to waypoint 3 [" & $Run & "]") Sleep(1400) MouseClick("middle", 170, 215) ; Walks to waypoint 4 PRINT("Walking to waypoint 4 [" & $Run & "]") Sleep(300) Call("CheckDead") Sleep(80) PRINT("Looking for cellar [" & $Run & "]") MouseMove(185, 135, 1) ; Moves cursor over to the cellar so the proper blue pixel becomes highlighted Sleep(500) Send("2") ; Sets caltrops Sleep(80) $Pixel2 = PixelSearch(688,123, 697, 137, 0x9F643A, 30) ; Checks on the minimap the orange door If Not @error Then PRINT("Walking to cellar entrance [" & $Run & "]") Sleep(40) Send("1") ; Uses smoke screen Sleep(100) MouseClick("left", 185, 135) ; Entrance to cellar Sleep(3100) PRINT("Checking if in cellar [" & $Run & "]") Call("CheckIn") Sleep(350) MouseClick("middle", 10, 500) ; Moves to doorway leading to rare inside cellar PRINT("Walking to doorway [" & $Run & "]") Sleep(1100) MouseClick("middle", 290, 270) ; Moves to doorway leading to rare inside cellar Sleep(800) PRINT("Killing Sarkoth [" & $Run & "]") MouseMove(225, 140, 1) ; Hovers over the rare Sarkoth Call("CheckDead") PRINT("Killing Sarkoth - Cluster Arrow [" & $Run & "]") MouseDown("right") ; Fires Cluster Arrow Sleep(40) MouseUp("right") Sleep(150) PRINT("Killing Sarkoth - Spike trap 1 [" & $Run & "]") Send("3") ; Lays Spike Traps 1 Sleep(300) Send("4") ; Call ferrets Send("{SHIFTDOWN}") MouseDown("left") ; Uses Hungering Arrow Sleep(2200) Send("3") ; Lays Spike traps 2 PRINT("Killing Sarkoth - Spike trap 2 [" & $Run & "]") Sleep(2000) MouseUp("left") MouseMove(80, 160, 1) ;attack left Sleep(40) MouseDown("right") ; Fires Cluster Arrow Sleep(40) Send("{SHIFTUP}") PRINT("Sarkoth death [" & $Run & "]") MouseUp("right") Sleep(800) MouseClick("middle", 210, 190) ; Location of sarkoth after death Sleep(1200) Send("!") Call("CheckDead") PRINT("Looting [" & $Run & "]") Call("CheckLoot") ; Loots LogToFile("Run Successful.") Send("4") Sleep(500) Call("CheckLoot") ; Loots again Sleep(500) $SuccessfulRuns += 1 PRINT("Looting complete [" & $Run & "]") Send("t") Sleep($tptime) Else PRINT("No cellar [" & $Run & "]") Call("CheckDead") PRINT("Leaving game [" & $Run & "]") LogToFile("Cellar not found.") Send("1") ; Uses smoke screen Sleep(10) Send("t") Sleep($tptime) EndIf EndIf ; Route end Sleep(40) Call("CheckDead") PRINT("Run complete [" & $Run & "]") ;check if the inventory is full If(CheckInv() == 1) Then InvRepair() EndIf PRINT("Quitting [" & $Run & "]") Sleep(40) Send("{ESC}") ;opens menu Sleep(100) LogToFile("Exiting game. (Lasted: " & _DateDiff("s", $StartTime, _NowCalc()) & "s)") MouseClick("left", 400, 350) ;button to leave game $Picked = True Sleep(5000) Call("CheckResumeGame") EndIf EndFunc
Func Move($x, $y) If Not $Picked Then FindItems() EndIf If Not $Picked Then ;MouseClick('middle', Random($x - 3, $x + 3), Random($y - 3, $y + 3), 1, Random(0, 1)) MouseClick('middle',$x,$y,1,0) ;Sleep(Random(2000, 2500)) Sleep(2000) EndIf EndFunc ;==>Move
Func Click($x, $y) If Not $Picked Then FindItems() EndIf If Not $Picked Then ;MouseClick('left', Random($x - 3, $x + 3), Random($y - 3, $y + 3), 1, Random(0, 1)) MouseClick('left',$x,$y,1,0) ;Sleep(Random(1000, 1500)) Sleep(1000) EndIf EndFunc ;==>Click
Func Shoot($x, $y) If Not $Picked Then FindItems() EndIf If Not $Picked Then ;MouseClick('right', Random($x - 2, $x + 2), Random($y - 2, $y + 2), 1, 0) MouseClick('right',$x,$y,1,0) ;Sleep(Random(550, 700)) Sleep(550) EndIf EndFunc ;==>Shoot
Func CheckDead() Sleep(500) ;Local $dead = PixelSearch(200, 190, 240, 230, 0xFFFFFF, 2) Local $dead = PixelSearch(220, 210, 221, 211, 0xFFFFFF, 1) If Not @error Then PRINT("Dead [" & $Run & "]") LogToFile("-* Character Death. *-") Send("{ESC}") MouseClick('left', 400, 350) Sleep(18000) Call("CheckResumeGame") EndIf EndFunc
Func CheckGems() If $LootGems Then $AmethystDrop = PixelSearch(150, 200, 700,700, $Amethyst,8) If Not @error Then MouseClick("left", $AmethystDrop[0], $AmethystDrop[1]) PRINT("Amethyst") Sleep(Random(900,1400)) $i+= 1 If $i <= 10 Then EndIf EndIf $RubyDrop = PixelSearch(150, 200, 700,400, $Ruby,10) If Not @error Then MouseClick("left", $RubyDrop[0], $RubyDrop[1]) PRINT("Ruby") Sleep(Random(900,1400)) $i+= 1 If $i <= 10 Then EndIf EndIf $EmeraldDrop = PixelSearch(150, 200, 700,400, $Emerald,20) If Not @error Then MouseClick("left", $EmeraldDrop[0], $EmeraldDrop[1]) PRINT("Emerald") Sleep(Random(900,1400)) $i+= 1 If $i <= 10 Then EndIf EndIf $TopazDrop = PixelSearch(150, 200, 700,400, $Topaz,20) If Not @error Then ; change to 'If Not @error Then' if you want to search for topazes MouseClick("left", $TopazDrop[0], $TopazDrop[1]) PRINT("Topaz") Sleep(Random(900,1400)) $i+= 1 If $i <= 10 Then EndIf EndIf EndIf EndFunc
Func CheckLoot()
Sleep(Random(800,1800)) If $Overnight = false Then $BlueLoot= PixelSearch(150, 200, 700,400, 0x585ad3, 4) ; blue loot If Not @error Then MouseClick ('left', $BlueLoot[0], $BlueLoot[1]) PRINT("Blue loot [" & $Run & "]") Sleep(Random(1500,1900)) $i+= 1 If $i <= 6 Then EndIf EndIf Endif If $Overnight = false Then $BlueLoot= PixelSearch(150, 200, 700,400, 0x585ad3, 5) ; blue loot If Not @error Then MouseClick ('left', $BlueLoot[0], $BlueLoot[1]) PRINT("Blue loot 2 [" & $Run & "]") Sleep(Random(1100,1500)) $i+= 1 If $i <= 6 Then EndIf EndIf Endif $RareLoot = PixelSearch(150, 200, 700,400, 0xd2d307, 2) ; rare loot (darker for compatibility) If Not @error Then MouseClick ('left', $RareLoot[0], $RareLoot[1]) PRINT("Rare loot [" & $Run & "]") Sleep(Random(1200,1800)) $i+= 1 If $i <= 6 Then EndIf EndIf $LegendaryLoot= PixelSearch(150, 200, 700,400, 0x8d4d28, 1) ; legendary loot If Not @error Then MouseClick ('left', $LegendaryLoot[0], $LegendaryLoot[1]) PRINT("Legendary loot [" & $Run & "]") Sleep(Random(900,1300)) $i+= 1 If $i <= 6 Then EndIf EndIf $SetLoot = PixelSearch(150, 200, 700,400, 0x02CE01, 8) ; set loot If Not @error Then MouseClick ('left', $SetLoot[0], $SetLoot[1]) PRINT("Set loot [" & $Run & "]") Sleep(Random(800,1200)) $i+= 1 If $i <= 6 Then EndIf EndIf If $LegendaryBackup Then $LegendaryLootBackup= PixelSearch(150, 200, 700,400, 0xa1572b, 1) ; legendary loot backup If Not @error Then MouseClick ('left', $LegendaryLootBackup[0], $LegendaryLootBackup[1]) PRINT("Legendary backup loot [" & $Run & "]") Sleep(Random(900,1200)) $i+= 1 If $i <= 6 Then EndIf EndIf Endif If $RareBackup Then $RareLootBackup = PixelSearch(150, 200, 700,400, 0xd4d60b, 4) ; rare loot backup If Not @error Then MouseClick ('left', $RareLootBackup[0], $RareLootBackup[1]) PRINT("Rare loot backup [" & $Run & "]") Sleep(Random(1000,1900)) $i+= 1 If $i <= 6 Then EndIf EndIf EndIf EndFunc
Func RandomSleep() If $Timer And Random(1,20) = 20 Then Sleep(Random(30000,60000) EndIf EndFunc
Func Pause() $Paused = Not $Paused While $Paused Sleep(100) ToolTip('Paused...', 0, 0) WEnd ToolTip("") EndFunc ;==>Pause
Func PRINT($message) if $StatusTip Then ToolTip($message, 0, 0) EndIf EndFunc ;==>Debug Info
Func InvRepair() Call("CheckDead") PRINT("Going to sell and repair [" & $Run & "]") $slot1x = 538 $slot1y = 367 $offset = 27 ;Send("t") ;Sleep(8000) MouseClick("left", 700, 147) ;begin movement towards merchant Sleep(2400) MouseClick("left", 531, 51) ;moves to get merchant in screen Sleep(3000) Call("CheckDead") PRINT("Checking if at merchant before selling [" & $Run & "]") Sleep(3000) $inBag = PixelSearch(150, 75, 160, 79, 0xc0bd55, 5) ; Checking if merchant window is open before selling If Not @error Then PRINT("Selling items [" & $Run & "]") For $i = 0 To 9 For $j = 0 To 5 MouseClick("right", $slot1x + ($i * $offset), $slot1y + ($j * $offset),1,3) Sleep(40) ;Next ;Next ;For $i = 5 To 9 ; For $j = 4 To 5 ; MouseClick("right", $slot1x + ($i * $offset), $slot1y + ($j * $offset),1,3) ; Sleep(40) Next Next MouseClick("left", 294, 296) ;button to open up repair menu Sleep(1500) MouseClick("left", 186, 326) ;button to pay for repairs Sleep(1500) Call("CheckDead") LogToFile("Items sold/repaired.") Send("{ESCAPE}") ;close menu EndIf EndFunc
Func CheckInv() Call("CheckDead") PRINT("Checking inventory") Send("{i}") ;opens inv Sleep(200) $full = PixelSearch(780, 474, 782, 476, 0x130C08,5) If @error Then PRINT("FULL") Send("{i}") ;close inv Return 1 EndIf $full = PixelSearch(754, 474, 756, 476, 0x130C08,5) If @error Then PRINT("FULL") Send("{i}") ;close inv Return 1 EndIf $full = PixelSearch(754, 485, 758, 488, 0x130C08,5) If @error Then PRINT("FULL") Send("{i}") ;close inv Return 1 EndIf $full = PixelSearch(724, 482, 732, 488, 0x130C08,5) If @error Then PRINT("FULL") Send("{i}") ;close inv Return 1 EndIf Send("{i}") ;close inv Return 0 EndFunc
Func LogToFile($message) if $FLog Then ;PRINT("Starting log") $file = FileOpen("\Log.txt", 1) if $file <> -1 Then FileWriteLine($file, "[" & @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & "] " & $message) FileClose($file) EndIf EndIf EndFunc
Func CheckIn() $Pixel3 = PixelSearch(462, 173, 474, 178, 0x96f8fe, 70) ; Checks on the minimap for the blue outline of the cellar door icon once inside. If @error Then PRINT("Leaving game because didn't make it in cellar[" & $Run & "]") LogToFile("Missed cellar click.") Sleep(80) Send("2") ; Sets caltrops Sleep(40) Send("{ESC}") ; Opens menu Sleep(40) LogToFile("Exiting game. (Lasted: " & _DateDiff("s", $StartTime, _NowCalc()) & "s)") MouseClick("left", 400, 350) ;button to leave game $Picked = True Sleep(5000) Call("CheckResumeGame") Else EndIf EndFunc
Func Quit() if $FLog Then $file = FileOpen("\Log.txt", 1) if $file <> -1 Then FileWriteLine($file, "[" & @YEAR & "-" & @MON & "-" & @MDAY & " " & @HOUR & ":" & @MIN & ":" & @SEC & "] End Log...") FileWriteLine($file, "----------") FileWriteLine($file, "Total Runs: " & $Run) FileWriteLine($file, "Successful Runs: " & $SuccessfulRuns) FileWriteLine($file, "----------") FileClose($file) EndIf EndIf Exit EndFunc
only problem I have encountered is if you happen to get a rare in the 3rd last spot from the bottom right on your inventory. it uses this spot to detect when it is full and see if an unidentified item gets placed there by chance it will keep selling after every single run. I have been solving this simply by checking the bot and moving the item from that spot if it happens edit: another tip is to set your desktop background to something simple like solid light blue. sometimes when you have a messy background with many colours it can screw with some of the pixelsearch functions (seems to happen in the CheckDead function when searching to see if character is dead) For some reason your script doesn't go all the way to the cellar and ends up leaving every time before detecting it. Do you know why? Also I am on 800x600 resolution on windowed mode.
|
|