Advertisement
darkjoy

Archon / Teleport Wizard Sarkoth Script

Jun 11th, 2012
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.30 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 = 9000 ; 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(531 *$x_ratio),Round(769 * $y_ratio))
  107. Sleep(1400)
  108. MouseClick("middle",Round(547 *$x_ratio),Round(490 * $y_ratio)) ;moves to doorway leading to rare inside cellar
  109. Sleep(1500)
  110. MouseMove(Round(579 * $x_ratio),Round(209 * $y_ratio),1) ;hovers over the rare Sarkoth
  111. Send(4)
  112. Sleep(500)
  113. Send("{SHIFTDOWN}")
  114. MouseDown("right") ;attack middle
  115. Sleep(3800)
  116. MouseMove(Round(467 * $x_ratio),Round(269 * $y_ratio),1) ;attack left, add more sleep time if you can't kill minion on left
  117. Sleep(1000)
  118. MouseMove(Round(682 * $x_ratio),Round(147 * $y_ratio),1) ;attack right
  119. Sleep(2000)
  120. MouseUP("right")
  121. Sleep(300)
  122. Send("{SHIFTUP}")
  123. Sleep(400)
  124. MouseClick("middle",Round(530*$x_ratio),Round(170*$y_ratio)) ;location of sarkoth after death
  125. Sleep(2100)
  126. MouseClick("middle",Round(580*$x_ratio),Round(460*$y_ratio)) ;move to left top corner for gold
  127. Sleep(1100)
  128. MouseClick("middle",Round(1330*$x_ratio),Round(330*$y_ratio)) ;move to right top corner for gold
  129. Sleep(1100)
  130. MouseClick("middle",Round(1010*$x_ratio),Round(940*$y_ratio)) ;move to middle before looting
  131. Call("CheckLoot")
  132. MouseClick("right",694,929) ;cancel archon
  133. Sleep(500)
  134. Send("t")
  135. Sleep(9000)
  136. Call("CheckDead")
  137. If Not $Logout And Not $Dead And Not $Window Then
  138. Sleep(300)
  139. Send("{ESCAPE}") ;menu
  140. Sleep(200)
  141. MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  142. Sleep($loadtime)
  143. Call("CheckDead")
  144. If Not $Logout Then
  145. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  146. Sleep($loadtime)
  147. EndIf
  148. Else
  149. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  150. Sleep($loadtime)
  151. $Window = False ; reset the flag so it doesn't think a window is always up
  152. EndIf
  153. Else
  154. Sleep(500)
  155. Send("t")
  156. Sleep(9000)
  157. Call("CheckDead")
  158. If Not $Logout And Not $Dead And Not $Window Then
  159. Sleep(300)
  160. Send("{ESCAPE}") ;menu
  161. Sleep(200)
  162. MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  163. Sleep($loadtime)
  164. Call("CheckDead")
  165. If Not $Logout Then
  166. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  167. Sleep($loadtime)
  168. EndIf
  169. Else
  170. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  171. Sleep($loadtime)
  172. $Window = False ; reset the flag so it doesn't think a window is always up
  173. EndIf
  174. EndIf
  175. EndIf
  176. WEnd
  177. Call("RestartRun")
  178. EndFunc
  179.  
  180. Func CheckDead()
  181. Call("CheckWindow")
  182. $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"
  183. If Not @error Then
  184. If Not $Window Then
  185. $Dead = True
  186. Sleep(100)
  187. Send("{Escape}")
  188. Sleep(10)
  189. MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  190. Sleep(11000)
  191. Sleep($loadtime)
  192. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  193. Sleep($loadtime)
  194. Else
  195. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  196. Sleep($loadtime)
  197. $Dead = False
  198. EndIf
  199. Else
  200. $Dead = False
  201. EndIf
  202. $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
  203. If Not @error Then
  204. Sleep(11000)
  205. Sleep($loadtime)
  206. If Not $Window Then
  207. $Dead = True
  208. $Logout = True
  209. Sleep($loadtime)
  210. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  211. Sleep($loadtime)
  212. Else
  213. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  214. Sleep($loadtime)
  215. $Logout = False
  216. EndIf
  217. Else
  218. $Logout = False
  219. EndIf
  220. EndFunc
  221.  
  222. Func CheckWindow()
  223. $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
  224. If Not @error Then
  225. Sleep(200)
  226. Send("{SPACE}") ;close any open windows
  227. $Window = True
  228. Else
  229. $Window = False
  230. EndIf
  231. EndFunc
  232.  
  233. Func CheckRepair()
  234. $RepairArea = PixelSearch(Round(1480*$x_ratio), 0, Round(1570*$x_ratio), Round(100*$y_ratio), $yellow)
  235. If Not @error Then
  236. Call("DoRepair")
  237. EndIf
  238. $RepairAreaRed = PixelSearch(Round(1480*$x_ratio), 0, Round(1570*$x_ratio), Round(100*$y_ratio), $red)
  239. If Not @error Then
  240. Call("DoRepair")
  241. EndIf
  242. EndFunc
  243.  
  244. Func DoRepair()
  245. Sleep(100)
  246. Send("t")
  247. Sleep($tptime)
  248. MouseClick("left", Round(1480*$x_ratio),Round(281*$y_ratio)) ;begin movement towards merchant
  249. Sleep(1500)
  250. MouseClick("left", Round(1316*$x_ratio),Round(206*$y_ratio)) ;moves to get merchant in screen
  251. Sleep(1500)
  252. MouseClick("left", Round(845*$x_ratio),Round(225*$y_ratio)) ;NPC Merchant to the right of cain's home
  253. Sleep(1200)
  254. MouseClick("left", Round(521*$x_ratio),Round(506*$y_ratio)) ;button to open up repair menu
  255. Sleep(400)
  256. MouseClick("left", Round(260*$x_ratio),Round(595*$y_ratio)) ;button to pay for repairs
  257. Sleep(200)
  258. Call("CheckDead")
  259. If Not $Dead and Not $Logout Then
  260. Send("{ESCAPE}") ;closes repair tab
  261. Sleep(100)
  262. Send("{ESCAPE}") ;menu
  263. Sleep(10)
  264. MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  265. Sleep($loadtime)
  266. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  267. Sleep($loadtime)
  268. EndIf
  269. EndFunc
  270.  
  271. Func CheckLoot()
  272. Sleep(Random(500,2000))
  273. $SetLoot = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0x02CE01, 2) ; set loot
  274. If Not @error Then
  275. MouseClick ('left', $SetLoot[0], $SetLoot[1])
  276. Sleep(Random(800,1200))
  277. $i+= 1
  278. If $i <= 6 Then
  279. Call("CheckLoot")
  280. EndIf
  281. EndIf
  282. $LegendaryLoot= PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0xBF642F, 2) ; legendary loot
  283. If Not @error Then
  284. MouseClick ('left', $LegendaryLoot[0], $LegendaryLoot[1])
  285. Sleep(Random(800,1200))
  286. $i+= 1
  287. If $i <= 6 Then
  288. Call("CheckLoot")
  289. EndIf
  290. EndIf
  291. If $LootRares Then
  292. $RareLoot = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0xBBBB00, 2) ; rare loot (darker for compatibility)
  293. If Not @error Then
  294. MouseClick ('left', $RareLoot[0], $RareLoot[1])
  295. Sleep(Random(700,900))
  296. $i+= 1
  297. If $i <= 6 Then
  298. Call("CheckLoot")
  299. EndIf
  300. EndIf
  301. EndIf
  302. If $LootGems Then
  303. $AmethystDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Amethyst,8)
  304. If Not @error Then
  305. MouseClick("left", $AmethystDrop[0], $AmethystDrop[1])
  306. Sleep(Random(900,1400))
  307. $i+= 1
  308. If $i <= 10 Then
  309. Call("CheckLoot")
  310. EndIf
  311. EndIf
  312. $RubyDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Ruby,6)
  313. If Not @error Then
  314. MouseClick("left", $RubyDrop[0], $RubyDrop[1])
  315. Sleep(Random(900,1400))
  316. $i+= 1
  317. If $i <= 10 Then
  318. Call("CheckLoot")
  319. EndIf
  320. EndIf
  321. $EmeraldDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Emerald,11)
  322. If Not @error Then
  323. MouseClick("left", $EmeraldDrop[0], $EmeraldDrop[1])
  324. Sleep(Random(900,1400))
  325. $i+= 1
  326. If $i <= 10 Then
  327. Call("CheckLoot")
  328. EndIf
  329. EndIf
  330. $TopazDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Topaz,2)
  331. If Not 1 = 1 Then ; change to 'If Not @error Then' if you want to search for topazes
  332. MouseClick("left", $TopazDrop[0], $TopazDrop[1])
  333. Sleep(Random(900,1400))
  334. $i+= 1
  335. If $i <= 10 Then
  336. Call("CheckLoot")
  337. EndIf
  338. EndIf
  339. EndIf
  340. EndFunc
  341.  
  342. Func Pause()
  343. $Leave = False
  344. EndFunc
  345.  
  346. Func Stop() ;to allow the script to stop
  347. Exit
  348. EndFunc
  349.  
  350. Func Leave()
  351. $Leave = True
  352. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement