Advertisement
Guest User

Sarkoth Wizard

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