Advertisement
Guest User

wizardwormholenospeed

a guest
Jun 11th, 2012
628
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.98 KB | None | 0 0
  1. ;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
  2. ;Thread: http://ownedcore.com/forums/diablo-3/diablo-3-bots-programs/354464-goldfarming-notares-sarkarth-dh-gold-script-autoit-script-1920x1080.html
  3. ;Please notice I changed some variable names around and added a variable for teleport time. $waittime is now appropriately named $loadtime.
  4. ;WONT WORK UNLESS MOVE IS BOUND TO MIDDLE MOUSE (Mouse 3) -- NOT MOVE/INTERACT
  5. ;Required build: http://us.battle.net/d3/en/calculator/demon-hunter#aRYXVT!aTW!YcaZbY
  6. ;Required movement speed: 25% (10% boots + 15% passive 'Hot Pursuit')
  7. ;Required display mode for cellar detection: "FULLSCREEN WINDOWED"
  8. ;Official supported resolution: 1920x1080
  9. ;;;;;
  10. ;Features:
  11. ;Loot scanning. Will only pick up rare/legendary/set pieces [IMPROVED]
  12. ;Randomized aiming coordinates (but still static path)
  13. ;Randomized pickup timers for variation in runs
  14. ;Automatic repair on yellow status icon
  15. ;Automatic resolution adjustment (16:9 only) [BUGGY - need someone to tweak coords]
  16. ;Death check
  17. ;Open window check (in rare case it gets stuck in menu)
  18. ;;;;;
  19. ;Original:
  20. ;[Goldfarming] AFK 150k-200k Gold Per Hour by mackus101 @ ownedcore
  21.  
  22. Global $Paused
  23. HotKeySet("=","Leave") ;script started by pressing =
  24. HotKeySet("-", "Pause") ;script paused by pressing -
  25. HotKeySet("x", "Stop") ;script stopped by pressing x
  26.  
  27. $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
  28. $loadtime = 3200 ; time in ms the script waits for the game to load before it starts pathfinding. Slow this down for slower hard drives
  29. $tptime = 6900 ; time in ms the script waits for teleport before exiting the game
  30. $yellow = 0xFFF000 ; yellow color code (repair icon)
  31. $red = 0xD90000 ; red color code (repair icon)
  32. $blueInventory = 0x161D35
  33.  
  34. $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)
  35. $LootBlues = True
  36. $LootGems = False ; Change this to true if you want to pick up gems (messy, can fill up bag with whites/blues)
  37. $BluesPickedUp = 0
  38. $MaxBluesBeforeSell = 25
  39. $Amethyst = 0xAC7FFF
  40. $Ruby = 0xB01D2D
  41. $Emerald = 0x58EE33
  42. $Topaz = 0xFFFF59
  43.  
  44. $go = True
  45. $Leave = False
  46. $Dead = False
  47. $Logout = False
  48. $Window = False
  49. $default_resolutionX = 1920
  50. $default_resolutionY = 1080
  51. $x_ratio = @Desktopwidth / $default_resolutionX
  52. $y_ratio = @Desktopheight / $default_resolutionY
  53. $i = 0
  54.  
  55. Call("RestartRun")
  56.  
  57. Func RestartRun()
  58. While $go
  59. if($Leave) Then
  60. $i = 0
  61. Sleep(1000) ;had to add this since the icon doesn't show up RIGHT away in game
  62. Call("CheckDead")
  63. Call("CheckRepair")
  64. if $BluesPickedUp >= $MaxBluesBeforeSell and $LootBlues Then
  65. Call("DoSellBlues")
  66. EndIf
  67. If $Window Then
  68. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  69. Sleep($loadtime)
  70. $Window = False
  71. ExitLoop
  72. ElseIf $Dead or $Logout Then
  73. ExitLoop
  74. EndIf
  75. MouseClick("left", Round(0 * $x_ratio),Round(250 * $y_ratio)) ;starts the main run
  76. Send("4")
  77. Sleep(140)
  78. Send("4")
  79. Sleep(140)
  80. Send("4")
  81. Sleep(140)
  82. Send("4")
  83. Sleep(80)
  84. Send("4")
  85. Sleep(80)
  86. Send("4")
  87. Sleep(80)
  88. Send("4")
  89. Sleep(80)
  90. Send("4")
  91. Sleep(80)
  92. Send("2")
  93. Send("1")
  94. Send("3")
  95. Sleep(300)
  96. MouseMove(Round(290*$x_ratio),Round(270*$y_ratio),1) ;moves cursor over to the cellar so the proper blue pixel becomes highlighted
  97. Sleep(1400)
  98. Call("CheckDead")
  99. If $Window Then
  100. MouseClick("left", Round(140*$x_ratio),Round(420*$y_ratio)) ;button to resume game from main menu
  101. Sleep($loadtime)
  102. $Window = False
  103. ExitLoop
  104. ElseIf $Dead or $Logout Then
  105. ExitLoop
  106. EndIf
  107. $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)
  108. If Not @error Then
  109. MouseClick("left",Round(290*$x_ratio),Round(270*$y_ratio)) ;Entrance to cellar
  110. Sleep(400)
  111. Send("2")
  112. Sleep(350) ; second cast in case the cooldown timer isn't quite right (rarely happens)
  113. Send("2")
  114. Sleep($walktime)
  115. MouseClick("middle",Round(110*$x_ratio),Round(1000*$y_ratio)) ;moves to doorway leading to rare inside cellar
  116. Sleep(2500)
  117. MouseMove(Round(440*$x_ratio),Round(80*$y_ratio),1) ;hovers over the rare Sarkoth
  118. Sleep(10)
  119. Send("{SHIFTDOWN}")
  120. MouseClick("left",Round(440*$x_ratio),Round(80*$y_ratio),2)
  121. MouseDown("right") ;attack middle
  122. Sleep(9000)
  123. MouseClick("right",Round(620*$x_ratio),Round(20*$y_ratio),2) ;break the table & chair
  124. Sleep(10)
  125. Send("{SHIFTUP}")
  126. Sleep(400)
  127. MouseClick("middle",Round(530*$x_ratio),Round(170*$y_ratio)) ;location of sarkoth after death
  128. Sleep(2100)
  129. MouseClick("middle",Round(580*$x_ratio),Round(460*$y_ratio)) ;move to left top corner for gold
  130. Sleep(1100)
  131. MouseClick("middle",Round(1330*$x_ratio),Round(330*$y_ratio)) ;move to right top corner for gold
  132. Sleep(1100)
  133. MouseClick("middle",Round(1010*$x_ratio),Round(940*$y_ratio)) ;move to middle before looting
  134. Call("CheckLoot")
  135. Send("t")
  136. Sleep($tptime)
  137. Call("CheckDead")
  138. If Not $Logout And Not $Dead And Not $Window Then
  139. Sleep(300)
  140. Send("{ESCAPE}") ;menu
  141. Sleep(200)
  142. MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  143. Sleep($loadtime)
  144. Call("CheckDead")
  145. If Not $Logout Then
  146. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  147. Sleep($loadtime)
  148. EndIf
  149. Else
  150. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  151. Sleep($loadtime)
  152. $Window = False ; reset the flag so it doesn't think a window is always up
  153. EndIf
  154. Else
  155. Sleep(5000)
  156. Send("t")
  157. Sleep($tptime)
  158. Call("CheckDead")
  159. If Not $Logout And Not $Dead And Not $Window Then
  160. Sleep(300)
  161. Send("{ESCAPE}") ;menu
  162. Sleep(200)
  163. MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  164. Sleep($loadtime)
  165. Call("CheckDead")
  166. If Not $Logout Then
  167. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  168. Sleep($loadtime)
  169. EndIf
  170. Else
  171. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  172. Sleep($loadtime)
  173. $Window = False ; reset the flag so it doesn't think a window is always up
  174. EndIf
  175. EndIf
  176. EndIf
  177. WEnd
  178. Call("RestartRun")
  179. EndFunc
  180.  
  181. Func CheckDead()
  182. Call("CheckWindow")
  183. $YouHaveDied = PixelSearch(Round(620*$x_ratio), Round(325*$y_ratio), Round(625*$x_ratio), Round(330*$y_ratio), 0xFFFFFF) ; checks for white text "YOU HAVE DIED"
  184. If Not @error Then
  185. If Not $Window Then
  186. $Dead = True
  187. Sleep(100)
  188. Send("{Escape}")
  189. Sleep(10)
  190. MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  191. Sleep(11000)
  192. Sleep($loadtime)
  193. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  194. Sleep($loadtime)
  195. Else
  196. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  197. Sleep($loadtime)
  198. $Dead = False
  199. EndIf
  200. Else
  201. $Dead = False
  202. EndIf
  203. $LogoutTimerCancel = PixelSearch(Round(900*$x_ratio), Round(240*$y_ratio), Round(1010*$x_ratio), Round(290*$y_ratio), 0x993827) ; checks for cancel button on logout timer
  204. If Not @error Then
  205. Sleep(11000)
  206. Sleep($loadtime)
  207. If Not $Window Then
  208. $Dead = True
  209. $Logout = True
  210. Sleep($loadtime)
  211. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  212. Sleep($loadtime)
  213. Else
  214. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  215. Sleep($loadtime)
  216. $Logout = False
  217. EndIf
  218. Else
  219. $Logout = False
  220. EndIf
  221. EndFunc
  222.  
  223. Func CheckWindow()
  224. $CloseButton = PixelSearch(Round(1570*$x_ratio), Round(110*$y_ratio), Round(1590*$x_ratio), Round(120*$y_ratio), 0x8C2300) ; checks for the red color of the "X" on an open window
  225. If Not @error Then
  226. Sleep(200)
  227. Send("{SPACE}") ;close any open windows
  228. $Window = True
  229. Else
  230. $Window = False
  231. EndIf
  232. EndFunc
  233.  
  234. Func CheckRepair()
  235. $RepairArea = PixelSearch(Round(1480*$x_ratio), 0, Round(1570*$x_ratio), Round(100*$y_ratio), $yellow)
  236. If Not @error Then
  237. Call("DoRepair")
  238. EndIf
  239. $RepairAreaRed = PixelSearch(Round(1480*$x_ratio), 0, Round(1570*$x_ratio), Round(100*$y_ratio), $red)
  240. If Not @error Then
  241. Call("DoRepair")
  242. EndIf
  243. EndFunc
  244.  
  245. Func DoSellBlues()
  246. Sleep(100)
  247. Send("t")
  248. Sleep($tptime)
  249. MouseClick("left", Round(1480*$x_ratio),Round(281*$y_ratio)) ;begin movement towards merchant
  250. Sleep(1500)
  251. MouseClick("left", Round(1316*$x_ratio),Round(206*$y_ratio)) ;moves to get merchant in screen
  252. Sleep(1500)
  253. MouseClick("left", Round(900*$x_ratio),Round(175*$y_ratio)) ;NPC Merchant to the right of cain's home
  254. Sleep(1200)
  255. ;Send("i")
  256. For $xInv = 1417 To 1846 Step 48
  257. For $yInv = 588 To 825 Step 48
  258. $bluePixel = PixelSearch(Round($xInv * $x_ratio),Round($yInv*$y_ratio),Round(($xInv + 48)*$x_ratio),Round($yInv +48*$y_ratio), $blueInventory,15)
  259. If @error Then
  260. ToolTip("No more blues!? or its a rare !?",0,0)
  261. Else
  262. MouseClick("right", $bluePixel[0], $bluePixel[1])
  263. sleep(1000)
  264. EndIf
  265. Next
  266. Next
  267. $BluesPickedUp = 0
  268. Call("CheckDead")
  269. If Not $Dead and Not $Logout Then
  270. Send("{ESCAPE}") ;closes repair tab
  271. Sleep(100)
  272. Send("{ESCAPE}") ;menu
  273. Sleep(10)
  274. MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  275. Sleep($loadtime)
  276. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  277. Sleep($loadtime)
  278. EndIf
  279. EndFunc
  280.  
  281. Func DoRepair()
  282. Sleep(100)
  283. Send("t")
  284. Sleep($tptime)
  285. MouseClick("left", Round(1480*$x_ratio),Round(281*$y_ratio)) ;begin movement towards merchant
  286. Sleep(1500)
  287. MouseClick("left", Round(1316*$x_ratio),Round(206*$y_ratio)) ;moves to get merchant in screen
  288. Sleep(1500)
  289. MouseClick("left", Round(900*$x_ratio),Round(175*$y_ratio)) ;NPC Merchant to the right of cain's home
  290. Sleep(1200)
  291. MouseClick("left", Round(521*$x_ratio),Round(506*$y_ratio)) ;button to open up repair menu
  292. Sleep(400)
  293. MouseClick("left", Round(260*$x_ratio),Round(595*$y_ratio)) ;button to pay for repairs
  294. Sleep(200)
  295. Call("CheckDead")
  296. If Not $Dead and Not $Logout Then
  297. Send("{ESCAPE}") ;closes repair tab
  298. Sleep(100)
  299. Send("{ESCAPE}") ;menu
  300. Sleep(10)
  301. MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  302. Sleep($loadtime)
  303. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  304. Sleep($loadtime)
  305. EndIf
  306. EndFunc
  307.  
  308. Func CheckLoot()
  309. Sleep(Random(500,2000))
  310. $SetLoot = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0x02CE01, 2) ; set loot
  311. If Not @error Then
  312. MouseClick ('left', $SetLoot[0], $SetLoot[1])
  313. Sleep(Random(800,1200))
  314. $i+= 1
  315. If $i <= 6 Then
  316. Call("CheckLoot")
  317. EndIf
  318. EndIf
  319. $LegendaryLoot= PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0xBF642F, 2) ; legendary loot
  320. If Not @error Then
  321. MouseClick ('left', $LegendaryLoot[0], $LegendaryLoot[1])
  322. Sleep(Random(800,1200))
  323. $i+= 1
  324. If $i <= 6 Then
  325. Call("CheckLoot")
  326. EndIf
  327. EndIf
  328. If $LootBlues Then
  329. $BlueLoot = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0x5555CD, 2) ; blue loot (darker for compatibility)
  330. If Not @error Then
  331. MouseClick ('left', $BlueLoot[0], $BlueLoot[1])
  332. Sleep(Random(700,900))
  333. $i+= 1
  334. $BluesPickedUp +=1
  335. If $i <= 6 Then
  336. Call("CheckLoot")
  337. EndIf
  338. EndIf
  339. EndIf
  340.  
  341. If $LootRares Then
  342. $RareLoot = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0xBBBB00, 2) ; rare loot (darker for compatibility)
  343. If Not @error Then
  344. MouseClick ('left', $RareLoot[0], $RareLoot[1])
  345. Sleep(Random(700,900))
  346. $i+= 1
  347. If $i <= 6 Then
  348. Call("CheckLoot")
  349. EndIf
  350. EndIf
  351. EndIf
  352. If $LootGems Then
  353. $AmethystDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Amethyst,8)
  354. If Not @error Then
  355. MouseClick("left", $AmethystDrop[0], $AmethystDrop[1])
  356. Sleep(Random(900,1400))
  357. $i+= 1
  358. If $i <= 10 Then
  359. Call("CheckLoot")
  360. EndIf
  361. EndIf
  362. $RubyDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Ruby,6)
  363. If Not @error Then
  364. MouseClick("left", $RubyDrop[0], $RubyDrop[1])
  365. Sleep(Random(900,1400))
  366. $i+= 1
  367. If $i <= 10 Then
  368. Call("CheckLoot")
  369. EndIf
  370. EndIf
  371. $EmeraldDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Emerald,11)
  372. If Not @error Then
  373. MouseClick("left", $EmeraldDrop[0], $EmeraldDrop[1])
  374. Sleep(Random(900,1400))
  375. $i+= 1
  376. If $i <= 10 Then
  377. Call("CheckLoot")
  378. EndIf
  379. EndIf
  380. $TopazDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Topaz,2)
  381. If Not @error Then ; change to 'If Not @error Then' if you want to search for topazes
  382. MouseClick("left", $TopazDrop[0], $TopazDrop[1])
  383. Sleep(Random(900,1400))
  384. $i+= 1
  385. If $i <= 10 Then
  386. Call("CheckLoot")
  387. EndIf
  388. EndIf
  389. EndIf
  390. EndFunc
  391.  
  392. Func Pause()
  393. $Leave = False
  394. EndFunc
  395.  
  396. Func Stop() ;to allow the script to stop
  397. Exit
  398. EndFunc
  399.  
  400. Func Leave()
  401. $Leave = True
  402. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement