Advertisement
Guest User

Wormhole Sarkoth

a guest
Jun 10th, 2012
4,741
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.24 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.  
  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.  
  51. Call("RestartRun")
  52.  
  53. Func RestartRun()
  54. While $go
  55. if($Leave) Then
  56. $i = 0
  57. Sleep(1000) ;had to add this since the icon doesn't show up RIGHT away in game
  58. Call("CheckDead")
  59. Call("CheckRepair")
  60. If $Window Then
  61. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  62. Sleep($loadtime)
  63. $Window = False
  64. ExitLoop
  65. ElseIf $Dead or $Logout Then
  66. ExitLoop
  67. EndIf
  68. MouseClick("left", Round(0 * $x_ratio),Round(250 * $y_ratio)) ;starts the main run
  69. Send("4")
  70. Sleep(140)
  71. Send("4")
  72. Sleep(140)
  73. Send("4")
  74. Sleep(140)
  75. Send("4")
  76. Sleep(80)
  77. Send("4")
  78. Sleep(80)
  79. Send("4")
  80. Sleep(80)
  81. Send("4")
  82. Sleep(80)
  83. Send("4")
  84. Sleep(80)
  85. Send("2")
  86. Send("1")
  87. Send("3")
  88. Sleep(300)
  89. MouseMove(Round(290*$x_ratio),Round(270*$y_ratio),1) ;moves cursor over to the cellar so the proper blue pixel becomes highlighted
  90. Sleep(700)
  91. Call("CheckDead")
  92. If $Window Then
  93. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  94. Sleep($loadtime)
  95. $Window = False
  96. ExitLoop
  97. ElseIf $Dead or $Logout Then
  98. ExitLoop
  99. EndIf
  100. $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)
  101. If Not @error Then
  102. MouseClick("left",Round(290*$x_ratio),Round(270*$y_ratio)) ;Entrance to cellar
  103. Sleep(400)
  104. Send("2")
  105. Sleep($walktime)
  106. MouseClick("middle",Round(110*$x_ratio),Round(1000*$y_ratio)) ;moves to doorway leading to rare inside cellar
  107. Sleep(2500)
  108. MouseMove(Round(440*$x_ratio),Round(80*$y_ratio),1) ;hovers over the rare Sarkoth
  109. Sleep(10)
  110. Send("{SHIFTDOWN}")
  111. MouseClick("left",Round(440*$x_ratio),Round(80*$y_ratio),2)
  112. MouseDown("right") ;attack middle
  113. Sleep(4000)
  114. MouseClick("right",Round(620*$x_ratio),Round(20*$y_ratio),2) ;break the table & chair
  115. Sleep(10)
  116. Send("{SHIFTUP}")
  117. Sleep(400)
  118. MouseClick("middle",Round(530*$x_ratio),Round(170*$y_ratio)) ;location of sarkoth after death
  119. Sleep(2100)
  120. MouseClick("middle",Round(580*$x_ratio),Round(460*$y_ratio)) ;move to left top corner for gold
  121. Sleep(1100)
  122. MouseClick("middle",Round(1330*$x_ratio),Round(330*$y_ratio)) ;move to right top corner for gold
  123. Sleep(1100)
  124. MouseClick("middle",Round(1010*$x_ratio),Round(940*$y_ratio)) ;move to middle before looting
  125. Call("CheckLoot")
  126. Send("t")
  127. Sleep($tptime)
  128. Call("CheckDead")
  129. If Not $Logout And Not $Dead And Not $Window Then
  130. Sleep(300)
  131. Send("{ESCAPE}") ;menu
  132. Sleep(200)
  133. MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  134. Sleep($loadtime)
  135. Call("CheckDead")
  136. If Not $Logout Then
  137. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  138. Sleep($loadtime)
  139. EndIf
  140. Else
  141. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  142. Sleep($loadtime)
  143. $Window = False ; reset the flag so it doesn't think a window is always up
  144. EndIf
  145. Else
  146. Sleep(50)
  147. Send("t")
  148. Sleep($tptime)
  149. Call("CheckDead")
  150. If Not $Logout And Not $Dead And Not $Window Then
  151. Sleep(300)
  152. Send("{ESCAPE}") ;menu
  153. Sleep(200)
  154. MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  155. Sleep($loadtime)
  156. Call("CheckDead")
  157. If Not $Logout Then
  158. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  159. Sleep($loadtime)
  160. EndIf
  161. Else
  162. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  163. Sleep($loadtime)
  164. $Window = False ; reset the flag so it doesn't think a window is always up
  165. EndIf
  166. EndIf
  167. EndIf
  168. WEnd
  169. Call("RestartRun")
  170. EndFunc
  171.  
  172. Func CheckDead()
  173. Call("CheckWindow")
  174. $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"
  175. If Not @error Then
  176. If Not $Window Then
  177. $Dead = True
  178. Sleep(100)
  179. Send("{Escape}")
  180. Sleep(10)
  181. MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  182. Sleep(11000)
  183. Sleep($loadtime)
  184. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  185. Sleep($loadtime)
  186. Else
  187. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  188. Sleep($loadtime)
  189. $Dead = False
  190. EndIf
  191. Else
  192. $Dead = False
  193. EndIf
  194. $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
  195. If Not @error Then
  196. Sleep(11000)
  197. Sleep($loadtime)
  198. If Not $Window Then
  199. $Dead = True
  200. $Logout = True
  201. Sleep($loadtime)
  202. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  203. Sleep($loadtime)
  204. Else
  205. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  206. Sleep($loadtime)
  207. $Logout = False
  208. EndIf
  209. Else
  210. $Logout = False
  211. EndIf
  212. EndFunc
  213.  
  214. Func CheckWindow()
  215. $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
  216. If Not @error Then
  217. Sleep(200)
  218. Send("{SPACE}") ;close any open windows
  219. $Window = True
  220. Else
  221. $Window = False
  222. EndIf
  223. EndFunc
  224.  
  225. Func CheckRepair()
  226. $RepairArea = PixelSearch(Round(1480*$x_ratio), 0, Round(1570*$x_ratio), Round(100*$y_ratio), $yellow)
  227. If Not @error Then
  228. Call("DoRepair")
  229. EndIf
  230. $RepairAreaRed = PixelSearch(Round(1480*$x_ratio), 0, Round(1570*$x_ratio), Round(100*$y_ratio), $red)
  231. If Not @error Then
  232. Call("DoRepair")
  233. EndIf
  234. EndFunc
  235.  
  236. Func DoRepair()
  237. Sleep(100)
  238. Send("t")
  239. Sleep($tptime)
  240. MouseClick("left", Round(1480*$x_ratio),Round(281*$y_ratio)) ;begin movement towards merchant
  241. Sleep(1500)
  242. MouseClick("left", Round(1316*$x_ratio),Round(206*$y_ratio)) ;moves to get merchant in screen
  243. Sleep(1500)
  244. MouseClick("left", Round(845*$x_ratio),Round(225*$y_ratio)) ;NPC Merchant to the right of cain's home
  245. Sleep(1200)
  246. MouseClick("left", Round(521*$x_ratio),Round(506*$y_ratio)) ;button to open up repair menu
  247. Sleep(400)
  248. MouseClick("left", Round(260*$x_ratio),Round(595*$y_ratio)) ;button to pay for repairs
  249. Sleep(200)
  250. Call("CheckDead")
  251. If Not $Dead and Not $Logout Then
  252. Send("{ESCAPE}") ;closes repair tab
  253. Sleep(100)
  254. Send("{ESCAPE}") ;menu
  255. Sleep(10)
  256. MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  257. Sleep($loadtime)
  258. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  259. Sleep($loadtime)
  260. EndIf
  261. EndFunc
  262.  
  263. Func CheckLoot()
  264. Sleep(Random(500,2000))
  265. $SetLoot = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0x02CE01, 2) ; set loot
  266. If Not @error Then
  267. MouseClick ('left', $SetLoot[0], $SetLoot[1])
  268. Sleep(Random(800,1200))
  269. $i+= 1
  270. If $i <= 6 Then
  271. Call("CheckLoot")
  272. EndIf
  273. EndIf
  274. $LegendaryLoot= PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0xBF642F, 2) ; legendary loot
  275. If Not @error Then
  276. MouseClick ('left', $LegendaryLoot[0], $LegendaryLoot[1])
  277. Sleep(Random(800,1200))
  278. $i+= 1
  279. If $i <= 6 Then
  280. Call("CheckLoot")
  281. EndIf
  282. EndIf
  283. If $LootRares Then
  284. $RareLoot = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0xBBBB00, 2) ; rare loot (darker for compatibility)
  285. If Not @error Then
  286. MouseClick ('left', $RareLoot[0], $RareLoot[1])
  287. Sleep(Random(700,900))
  288. $i+= 1
  289. If $i <= 6 Then
  290. Call("CheckLoot")
  291. EndIf
  292. EndIf
  293. EndIf
  294. If $LootGems Then
  295. $AmethystDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Amethyst,8)
  296. If Not @error Then
  297. MouseClick("left", $AmethystDrop[0], $AmethystDrop[1])
  298. Sleep(Random(900,1400))
  299. $i+= 1
  300. If $i <= 10 Then
  301. Call("CheckLoot")
  302. EndIf
  303. EndIf
  304. $RubyDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Ruby,6)
  305. If Not @error Then
  306. MouseClick("left", $RubyDrop[0], $RubyDrop[1])
  307. Sleep(Random(900,1400))
  308. $i+= 1
  309. If $i <= 10 Then
  310. Call("CheckLoot")
  311. EndIf
  312. EndIf
  313. $EmeraldDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Emerald,11)
  314. If Not @error Then
  315. MouseClick("left", $EmeraldDrop[0], $EmeraldDrop[1])
  316. Sleep(Random(900,1400))
  317. $i+= 1
  318. If $i <= 10 Then
  319. Call("CheckLoot")
  320. EndIf
  321. EndIf
  322. $TopazDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Topaz,2)
  323. If Not 1 = 1 Then ; change to 'If Not @error Then' if you want to search for topazes
  324. MouseClick("left", $TopazDrop[0], $TopazDrop[1])
  325. Sleep(Random(900,1400))
  326. $i+= 1
  327. If $i <= 10 Then
  328. Call("CheckLoot")
  329. EndIf
  330. EndIf
  331. EndIf
  332. EndFunc
  333.  
  334. Func Pause()
  335. $Leave = False
  336. EndFunc
  337.  
  338. Func Stop() ;to allow the script to stop
  339. Exit
  340. EndFunc
  341.  
  342. Func Leave()
  343. $Leave = True
  344. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement