Advertisement
Guest User

Untitled

a guest
Jun 12th, 2012
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.01 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 = 5000 ; 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.  
  33. $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)
  34. $LootGems = False ; Change this to true if you want to pick up gems (messy, can fill up bag with whites/blues)
  35. $Amethyst = 0xAC7FFF
  36. $Ruby = 0xB01D2D
  37. $Emerald = 0x58EE33
  38. $Topaz = 0xFFFF59
  39.  
  40. $go = True
  41. $Leave = False
  42. $Dead = False
  43. $Logout = False
  44. $Window = False
  45. $default_resolutionX = 1920
  46. $default_resolutionY = 1080
  47. $x_ratio = @Desktopwidth / $default_resolutionX
  48. $y_ratio = @Desktopheight / $default_resolutionY
  49. $i = 0
  50. $timeBetweenGames = 83000 + Random(10000, 30000)
  51.  
  52. Call("RestartRun")
  53.  
  54. Func RestartRun()
  55. While $go
  56. if($Leave) Then
  57. $i = 0
  58. Sleep(800) ;had to add this since the icon doesn't show up RIGHT away in game
  59. Call("CheckDead")
  60. Call("CheckRepair")
  61. If $Window Then
  62. Sleep($timeBetweenGames)
  63. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  64. Sleep($loadtime)
  65. $Window = False
  66. ExitLoop
  67. ElseIf $Dead or $Logout Then
  68. ExitLoop
  69. EndIf
  70. Send("3")
  71. Sleep(435)
  72. MouseClick("middle", Round(500*$x_ratio), Round(350*$y_ratio)) ;starts the run [waypoint 1]
  73. Sleep(900)
  74. Send("1")
  75. Sleep(50)
  76. Send("1")
  77. Sleep(100)
  78. Send("1")
  79. Sleep(100)
  80. Send("1")
  81. Sleep(100)
  82. Send("1")
  83. Sleep(100)
  84. MouseClick("middle", Round(400*$x_ratio), Round(600*$y_ratio)) ;middle of courtyard [waypoint 3]
  85. Sleep(400)
  86. MouseClick("middle", Round(400*$x_ratio), Round(600*$y_ratio)) ;middle of courtyard [waypoint 3]
  87. Sleep(300)
  88. MouseClick("middle", Round(400*$x_ratio), Round(600*$y_ratio)) ;middle of courtyard [waypoint 3]
  89. Sleep(300)
  90. MouseClick("middle", Round(400*$x_ratio), Round(600*$y_ratio)) ;middle of courtyard [waypoint 3]
  91. Sleep(300)
  92. MouseClick("middle", Round(400*$x_ratio), Round(600*$y_ratio)) ;middle of courtyard [waypoint 3]
  93. Sleep(300)
  94. MouseMove(Round(300*$x_ratio),Round(100*$y_ratio),1) ;moves cursor over to the cellar so the proper blue pixel becomes highlighted
  95. Sleep(790)
  96. Call("CheckDead")
  97. If $Window Then
  98. Sleep($timeBetweenGames)
  99. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  100. Sleep($loadtime)
  101. $Window = False
  102. ExitLoop
  103. ElseIf $Dead or $Logout Then
  104. ExitLoop
  105. EndIf
  106. $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)
  107. If Not @error Then
  108. MouseClick("middle",Round(300*$x_ratio),Round(300*$y_ratio))
  109. Sleep(1000)
  110. MouseClick("middle",Round(700*$x_ratio),Round(300*$y_ratio))
  111. Sleep(800)
  112. MouseClick("left",Round(1050*$x_ratio),Round(370*$y_ratio)) ;Entrance to cellar
  113. Sleep(1200)
  114. Send("2")
  115. Sleep(500)
  116. Send("3")
  117. Sleep($walktime *1.10)
  118. MouseClick("middle",Round(110*$x_ratio),Round(1000*$y_ratio)) ;moves to doorway leading to rare inside cellar
  119. Sleep(2500)
  120. MouseClick("left",Round(850*$x_ratio),Round(400*$y_ratio)) ;Moves into doorway
  121. Sleep(400)
  122. MouseMove(Round(440*$x_ratio),Round(80*$y_ratio),1) ;hovers over the rare Sarkoth
  123. Sleep(10)
  124. Send("{SHIFTDOWN}")
  125. MouseDown("left") ;attack middle
  126. MouseClick("left",Round(200*$x_ratio),Round(80*$y_ratio)) ;Blizzard 2
  127. Sleep(1200)
  128. Send("4")
  129. Sleep(3000)
  130. MouseMove(Round(240*$x_ratio),Round(75*$y_ratio),1) ;attack towards the left
  131. Sleep(40)
  132. MouseDown("right")
  133. Sleep(2800)
  134. MouseUp("right")
  135. MouseMove(Round(480*$x_ratio),Round(50*$y_ratio),1) ;attack towards the middle
  136. MouseDown("right")
  137. Sleep(1800)
  138. MouseUp("right")
  139. MouseDown("left")
  140. MouseMove(Round(Random(240,260)*$x_ratio),Round(75*$y_ratio),1) ;attack left
  141. Sleep(1200)
  142. MouseMove(Round(Random(560,600)*$x_ratio),Round(50*$y_ratio),1) ;attack right
  143. Sleep(1200)
  144. MouseUP("left")
  145. Sleep(10)
  146. MouseClick("right",Round(620*$x_ratio),Round(20*$y_ratio),2) ;break the table & chair
  147. Sleep(10)
  148. Send("{SHIFTUP}")
  149. Sleep(400)
  150. MouseClick("middle",Round(530*$x_ratio),Round(170*$y_ratio)) ;location of sarkoth after death
  151. Sleep(2100)
  152. MouseClick("middle",Round(580*$x_ratio),Round(460*$y_ratio)) ;move to left top corner for gold
  153. Sleep(1100)
  154. MouseClick("middle",Round(1000*$x_ratio),Round(550*$y_ratio)) ;move down a little
  155. Sleep(1100)
  156. MouseClick("middle",Round(1330*$x_ratio),Round(330*$y_ratio)) ;move to right top corner for gold
  157. Sleep(1100)
  158. Send("4")
  159. MouseClick("middle",Round(1010*$x_ratio),Round(940*$y_ratio)) ;move to middle before looting
  160. Call("CheckLoot")
  161. Send("t")
  162. Sleep($tptime)
  163. Call("CheckDead")
  164. If Not $Logout And Not $Dead And Not $Window Then
  165. Sleep(300)
  166. Send("{ESCAPE}") ;menu
  167. Sleep(200)
  168. MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  169. Sleep($loadtime)
  170. Call("CheckDead")
  171. If Not $Logout Then
  172. Sleep($timeBetweenGames)
  173. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  174. Sleep($loadtime)
  175. EndIf
  176. Else
  177. Sleep($timeBetweenGames)
  178. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  179. Sleep($loadtime)
  180. $Window = False ; reset the flag so it doesn't think a window is always up
  181. EndIf
  182. Else
  183. Sleep(10)
  184. MouseClick("middle",Round(1100*$x_ratio),Round(600*$y_ratio)) ;moves between caltrops for safety before teleporting back to town
  185. Sleep(200)
  186. Send("1")
  187. Sleep(620)
  188. Send("2")
  189. Sleep(40)
  190. Send("t")
  191. Sleep($tptime)
  192. Call("CheckDead")
  193. If Not $Logout And Not $Dead And Not $Window Then
  194. Sleep(300)
  195. Send("{ESCAPE}") ;menu
  196. Sleep(200)
  197. MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  198. Sleep($loadtime)
  199. Call("CheckDead")
  200. Sleep(60000)
  201. Sleep($timeBetweenGames)
  202. If Not $Logout Then
  203. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  204. Sleep($loadtime)
  205. EndIf
  206. Else
  207. Sleep($timeBetweenGames)
  208. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  209. Sleep($loadtime)
  210. $Window = False ; reset the flag so it doesn't think a window is always up
  211. EndIf
  212. EndIf
  213. EndIf
  214. WEnd
  215. Call("RestartRun")
  216. EndFunc
  217.  
  218. Func CheckDead()
  219. Call("CheckWindow")
  220. $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"
  221. If Not @error Then
  222. If Not $Window Then
  223. $Dead = True
  224. Sleep(100)
  225. Send("{Escape}")
  226. Sleep(10)
  227. MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  228. Sleep(11000)
  229. Sleep($loadtime)
  230. Sleep($timeBetweenGames)
  231. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  232. Sleep($loadtime)
  233. Else
  234. Sleep($timeBetweenGames)
  235. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  236. Sleep($loadtime)
  237. $Dead = False
  238. EndIf
  239. Else
  240. $Dead = False
  241. EndIf
  242. $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
  243. If Not @error Then
  244. Sleep(11000)
  245. Sleep($loadtime)
  246. If Not $Window Then
  247. $Dead = True
  248. $Logout = True
  249. Sleep($loadtime)
  250. Sleep($timeBetweenGames)
  251. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  252. Sleep($loadtime)
  253. Else
  254. Sleep($timeBetweenGames)
  255. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  256. Sleep($loadtime)
  257. $Logout = False
  258. EndIf
  259. Else
  260. $Logout = False
  261. EndIf
  262. EndFunc
  263.  
  264. Func CheckWindow()
  265. $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
  266. If Not @error Then
  267. Sleep(200)
  268. Send("{SPACE}") ;close any open windows
  269. $Window = True
  270. Else
  271. $Window = False
  272. EndIf
  273. EndFunc
  274.  
  275. Func CheckRepair()
  276. $RepairArea = PixelSearch(Round(1480*$x_ratio), 0, Round(1570*$x_ratio), Round(100*$y_ratio), $yellow)
  277. If Not @error Then
  278. Call("DoRepair")
  279. EndIf
  280. $RepairAreaRed = PixelSearch(Round(1480*$x_ratio), 0, Round(1570*$x_ratio), Round(100*$y_ratio), $red)
  281. If Not @error Then
  282. Call("DoRepair")
  283. EndIf
  284. EndFunc
  285.  
  286. Func DoRepair()
  287. Sleep(100)
  288. Send("t")
  289. Sleep($tptime)
  290. MouseClick("left", Round(0*$x_ratio),Round(500*$y_ratio)) ;begin movement towards merchant
  291. Sleep(2000)
  292. MouseClick("left", Round(0*$x_ratio),Round(500*$y_ratio)) ;begin movement towards merchant
  293. Sleep(2000)
  294. MouseClick("left", Round(845*$x_ratio),Round(400*$y_ratio)) ;NPC Merchant to the left of tavern
  295. Sleep(1200)
  296. MouseClick("left", Round(521*$x_ratio),Round(600*$y_ratio)) ;button to open up repair menu
  297. Sleep(400)
  298. MouseClick("left", Round(260*$x_ratio),Round(595*$y_ratio)) ;button to pay for repairs
  299. Sleep(200)
  300. Call("CheckDead")
  301. If Not $Dead and Not $Logout Then
  302. Send("{ESCAPE}") ;closes repair tab
  303. Sleep(100)
  304. Send("{ESCAPE}") ;menu
  305. Sleep(10)
  306. MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  307. Sleep($loadtime)
  308. Sleep($timeBetweenGames)
  309. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  310. Sleep($loadtime)
  311. EndIf
  312. EndFunc
  313.  
  314. Func CheckLoot()
  315. Sleep(Random(500,2000))
  316. $SetLoot = PixelSearch(Round(300*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0x02CE01, 2) ; set loot
  317. If Not @error Then
  318. MouseClick ('left', $SetLoot[0], $SetLoot[1])
  319. Sleep(Random(2000,3000))
  320. $i+= 1
  321. If $i <= 6 Then
  322. Call("CheckLoot")
  323. EndIf
  324. EndIf
  325. $LegendaryLoot= PixelSearch(Round(300*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0xBF642F, 2) ; legendary loot
  326. If Not @error Then
  327. MouseClick ('left', $LegendaryLoot[0], $LegendaryLoot[1])
  328. Sleep(Random(2000,3000))
  329. $i+= 1
  330. If $i <= 6 Then
  331. Call("CheckLoot")
  332. EndIf
  333. EndIf
  334. If $LootRares Then
  335. $RareLoot = PixelSearch(Round(300*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0xBBBB00, 2) ; rare loot (darker for compatibility)
  336. If Not @error Then
  337. MouseClick ('left', $RareLoot[0], $RareLoot[1])
  338. Sleep(Random(2000,3000))
  339. $i+= 1
  340. If $i <= 6 Then
  341. Call("CheckLoot")
  342. EndIf
  343. EndIf
  344. EndIf
  345. If $LootGems Then
  346. $AmethystDrop = PixelSearch(Round(300*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Amethyst,8)
  347. If Not @error Then
  348. MouseClick("left", $AmethystDrop[0], $AmethystDrop[1])
  349. Sleep(Random(2000,3000))
  350. $i+= 1
  351. If $i <= 10 Then
  352. Call("CheckLoot")
  353. EndIf
  354. EndIf
  355. $RubyDrop = PixelSearch(Round(300*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Ruby,6)
  356. If Not @error Then
  357. MouseClick("left", $RubyDrop[0], $RubyDrop[1])
  358. Sleep(Random(2000,3000))
  359. $i+= 1
  360. If $i <= 10 Then
  361. Call("CheckLoot")
  362. EndIf
  363. EndIf
  364. $EmeraldDrop = PixelSearch(Round(300*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Emerald,11)
  365. If Not @error Then
  366. MouseClick("left", $EmeraldDrop[0], $EmeraldDrop[1])
  367. Sleep(Random(2000,3000))
  368. $i+= 1
  369. If $i <= 10 Then
  370. Call("CheckLoot")
  371. EndIf
  372. EndIf
  373. $TopazDrop = PixelSearch(Round(300*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Topaz,2)
  374. If 1 = 2 Then ; change to 'If Not @error Then' if you want to search for topazes
  375. MouseClick("left", $TopazDrop[0], $TopazDrop[1])
  376. Sleep(Random(2000,3000))
  377. $i+= 1
  378. If $i <= 10 Then
  379. Call("CheckLoot")
  380. EndIf
  381. EndIf
  382. EndIf
  383. EndFunc
  384.  
  385. Func Pause()
  386. $Leave = False
  387. EndFunc
  388.  
  389. Func Stop() ;to allow the script to stop
  390. Exit
  391. EndFunc
  392.  
  393. Func Leave()
  394. $Leave = True
  395. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement