Advertisement
Guest User

Untitled

a guest
Jun 12th, 2012
352
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.49 KB | None | 0 0
  1. ;notAres' Sarkarth DH Gold Script 1.2.7.1 - 6/7/2012 - All repair loop bugs have been fixed. Tested myself.
  2. ;Please notice I changed some variable names around and added a variable for teleport time. $waittime is now appropriately named $loadtime.
  3. ;WONT WORK UNLESS MOVE IS BOUND TO MIDDLE MOUSE (Mouse 3) -- NOT MOVE/INTERACT
  4. ;Required build: http://us.battle.net/d3/en/calculator/demon-hunter#aRYXVT!aTW!YcaZbY
  5. ;left mouse = hungering arrow / devouring arrow
  6. ;right mouse = elemental arrow / nether tentacles
  7. ;1 = caltrops / hooked spines
  8. ;2 = smoke screen / lingering fog
  9. ;3 = preperation / battle scars
  10. ;4 = companion / ferret
  11. ;passives tactical advantage / sharpshooter / hot pursuit
  12. ;Required movement speed: 25% (10% boots + 15% passive 'Hot Pursuit')
  13. ;Required display mode for cellar detection: "FULLSCREEN WINDOWED"
  14. ;Official supported resolution: 1920x1080
  15. ;;;;;
  16. ;Features:
  17. ;Loot scanning. Will only pick up rare/legendary/set pieces [IMPROVED]
  18. ;Randomized aiming coordinates (but still static path)
  19. ;Randomized pickup timers for variation in runs
  20. ;Automatic repair on yellow status icon
  21. ;Automatic resolution adjustment (16:9 only) [BUGGY - need someone to tweak coords]
  22. ;Death check
  23. ;Open window check (in rare case it gets stuck in menu)
  24. ;;;;;
  25. ;Original:
  26. ;[Goldfarming] AFK 150k-200k Gold Per Hour by mackus101 @ ownedcore
  27. ;;;;;
  28.  
  29. Global $Paused
  30.  
  31. HotKeySet("=","Leave") ;script started by pressing =
  32. HotKeySet("-", "Pause") ;script paused by pressing -
  33. HotKeySet("x", "Stop") ;script stopped by pressing x
  34.  
  35. $walktime = 1800 ; time in ms the script waits for you to enter and load the cellar. Slow this down for slower move speeds and loading times
  36. $loadtime = 1600 ; time in ms the script waits for the game to load before it starts pathfinding. Slow this down for slower hard drives
  37. $tptime = 6500 ; time in ms the script waits for teleport before exiting the game
  38. $yellow = 0xFFF000 ; yellow color code
  39. $red = 0xD90000 ; red color code
  40.  
  41. $go = True
  42. $Leave = False
  43. $Dead = 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.  
  50.  
  51. While $go
  52. if($Leave) Then
  53. $i = 0
  54. Call("CheckDead")
  55. If $Window Then
  56. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  57. Sleep($loadtime)
  58. $Window = False
  59. EndIf
  60. Sleep(1800) ;had to add this since the icon doesn't show up RIGHT away in game
  61. Call("CheckRepair")
  62. MouseClick("middle", Round(500*$x_ratio), Round(250*$y_ratio)) ;starts the run [waypoint 1]
  63. Sleep(1200)
  64. MouseClick("middle", 1, Round(370*$y_ratio)) ;waits ~1 second then [waypoint 2]
  65. Sleep(100)
  66. Send("2")
  67. Sleep(1700)
  68. MouseClick("middle", Round(400*$x_ratio), Round(600*$y_ratio)) ;middle of courtyard [waypoint 3]
  69. Sleep(40)
  70. Send("2")
  71. Sleep(20)
  72. Send("3")
  73. Sleep(600)
  74. Send("1")
  75. Sleep(300)
  76. MouseMove(Round(300*$x_ratio),Round(100*$y_ratio),1) ;moves cursor over to the cellar so the proper blue pixel becomes highlighted
  77. Sleep(700)
  78. Call("CheckDead")
  79. $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)
  80. If Not @error Then
  81. MouseClick("left",Round(300*$x_ratio),Round(100*$y_ratio)) ;Entrance to cellar
  82. Sleep(220)
  83. Send("2")
  84. Send("4")
  85. Sleep($walktime)
  86. MouseClick("middle",Round(130*$x_ratio),Round(1000*$y_ratio)) ;moves to doorway leading to rare inside cellar
  87. Sleep(2500)
  88. MouseMove(Round(440*$x_ratio),Round(80*$y_ratio),1) ;hovers over the rare Sarkoth
  89. Sleep(10)
  90. Send("{SHIFTDOWN}")
  91. MouseDown("right") ;attack middle
  92. Sleep(7000)
  93. MouseUp("right")
  94. MouseDown("left")
  95. Sleep(2300)
  96. MouseUp("left")
  97. MouseMove(Round(250*$x_ratio),Round(110*$y_ratio),1) ;attack left
  98. Sleep(40)
  99. MouseDown("left")
  100. Sleep(4000)
  101. MouseUp("left")
  102. MouseMove(Round(590*$x_ratio),Round(50*$y_ratio),1) ;attack right
  103. MouseDown("right")
  104. Sleep(1000)
  105. MouseUp("right")
  106. Sleep(40)
  107. MouseDown("left")
  108. Sleep(500)
  109. MouseUp("left")
  110. Send("{SHIFTUP}")
  111. Call("CheckDead")
  112. Sleep(400)
  113. MouseClick("middle",Round(440*$x_ratio),Round(80*$y_ratio)) ;location of sarkoth after death
  114. Sleep(2000)
  115. MouseClick("middle",Round(680*$x_ratio),Round(570*$y_ratio)) ;move to left top corner for gold
  116. Sleep(1200)
  117. MouseClick("middle",Round(1330*$x_ratio),Round(330*$y_ratio)) ;move to right top corner for gold
  118. Sleep(1600)
  119. MouseClick("middle",Round(1010*$x_ratio),Round(940*$y_ratio)) ;move to middle before looting
  120. Sleep(1600)
  121. Call("CheckLoot")
  122. Send("t")
  123. Sleep($tptime)
  124. Call("CheckDead")
  125. Call("CheckWindow")
  126. If Not $Dead And Not $Window Then
  127. Sleep(100)
  128. Send("{ESCAPE}") ;menu
  129. Sleep(10)
  130. MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  131. Sleep(2500)
  132. Send("{SPACE}") ;close any open windows
  133. Sleep(500)
  134. Call("MainMenu")
  135. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  136. Sleep($loadtime)
  137. ElseIf $Window Then
  138. Call("MainMenu")
  139. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  140. Sleep($loadtime)
  141. $Window = False
  142. EndIf
  143. Else
  144. Sleep(10)
  145. MouseClick("middle",Round(1100*$x_ratio),Round(600*$y_ratio)) ;moves between caltrops for safety before teleporting back to town
  146. Sleep(200)
  147. Send("1")
  148. Sleep(620)
  149. Send("2")
  150. Sleep(40)
  151. Send("t")
  152. Sleep($tptime)
  153. Call("CheckDead")
  154. Call("CheckWindow")
  155. If Not $Dead And Not $Window Then
  156. Sleep(100)
  157. Send("{ESCAPE}") ;menu
  158. Sleep(10)
  159. MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  160. Sleep(2500)
  161. Send("{SPACE}") ;close any open windows
  162. Sleep(500)
  163. Call("MainMenu")
  164. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  165. Sleep($loadtime)
  166. ElseIf $Window Then
  167. Call("MainMenu")
  168. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  169. Sleep($loadtime)
  170. $Window = False
  171. EndIf
  172. EndIf
  173. EndIf
  174. WEnd
  175.  
  176. Func CheckDead()
  177. Call("CheckWindow")
  178. $Pixeltest = PixelGetColor(Round(740*$x_ratio), Round(850*$y_ratio))
  179. If Hex($Pixeltest, 6) == "0C0404" OR Hex($Pixeltest, 6) == "310000" Then
  180. If Not $Window Then
  181. $Dead = True
  182. Sleep(100)
  183. Send("{Escape}")
  184. Sleep(10)
  185. MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  186. Sleep(2500)
  187. Call("MainMenu")
  188. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  189. Sleep($loadtime)
  190. ElseIf $Window Then
  191. Call("MainMenu")
  192. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  193. Sleep($loadtime)
  194. $Window = False
  195. EndIf
  196. ElseIf Hex($Pixeltest, 6) == "0C0000" OR Hex($Pixeltest, 6) == "030101" Then
  197. Sleep(10000)
  198. If Not $Window Then
  199. $Dead = True
  200. Sleep($loadtime)
  201. Call("MainMenu")
  202. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  203. Sleep($loadtime)
  204. ElseIf $Window Then
  205. Call("MainMenu")
  206. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  207. Sleep($loadtime)
  208. $Window = False
  209. EndIf
  210. Else
  211. $Dead = False
  212. EndIf
  213. EndFunc
  214.  
  215. Func MainMenu() ;verifies the screen is at the main menu before attempting to start the next game to avoid getting trapped in menus.
  216. Local $Menu = False
  217. While $Menu = False
  218. $Pixeltestmm = PixelGetColor(Round(251*$x_ratio), Round(284*$y_ratio)) ;tests for main menu
  219. If Hex($Pixeltestmm, 6) == "683C02" Then
  220. $Menu = True
  221. Else
  222. $Pixeltestgm = PixelGetColor(Round(937*$x_ratio), Round(246*$y_ratio)) ;checks if game menu is open
  223. If Hex($Pixeltestgm, 6) == "621610" Then
  224. Send("{Escape}") ;return to main menu
  225. $Menu = True
  226. Else
  227. $Pixeltestgmexit = PixelGetColor(Round(975*$x_ratio), Round(428*$y_ratio)) ;checks if exit game menu is open
  228. If Hex($Pixeltestgmexit, 6) == "FFA300" Then
  229. Send("{Escape}")
  230. Send("{Escape}")
  231. $Menu = True
  232. Else
  233. $Pixeltestbm = PixelGetColor(Round(958*$x_ratio), Round(150*$y_ratio)) ;checks if banner customization window is open
  234. If Hex($Pixeltestbm, 6) == "933618" Then
  235. Send("{Escape}")
  236. $Menu = True
  237. Else
  238. $Pixeltestpm = PixelGetColor(Round(1506*$x_ratio), Round(138*$y_ratio)) ;checks if player window is open
  239. If Hex($Pixeltestpm, 6) == "320c08" Then
  240. Send("{Escape}")
  241. $Menu = True
  242. EndIf
  243. EndIf
  244. EndIf
  245. EndIf
  246. EndIf
  247. WEnd
  248. EndFunc
  249.  
  250. Func CheckWindow()
  251. $Pixeltest2 = PixelGetColor(Round(1580*$x_ratio), Round(100*$y_ratio))
  252. If Hex($Pixeltest2, 6) == "653B23" Then
  253. Sleep(200)
  254. Send("{SPACE}") ;close any open windows
  255. $Window = True
  256. Else
  257. $Window = False
  258. EndIf
  259. Sleep(300)
  260. EndFunc
  261.  
  262. Func CheckRepair()
  263. $RepairArea = PixelSearch(Round(1480*$x_ratio), 0, Round(1900*$x_ratio), Round(50*$y_ratio), $yellow)
  264. If Not @error Then
  265. Call("DoRepair")
  266. EndIf
  267. $RepairAreaRed = PixelSearch(Round(1480*$x_ratio), 0, Round(1900*$x_ratio), Round(50*$y_ratio), $red)
  268. If Not @error Then
  269. Call("DoRepair")
  270. EndIf
  271. EndFunc
  272.  
  273. Func DoRepair()
  274. Sleep(100)
  275. Send("t")
  276. Sleep($tptime)
  277. MouseClick("left", Round(1480*$x_ratio),Round(281*$y_ratio)) ;begin movement towards merchant
  278. Sleep(1500)
  279. MouseClick("left", Round(1316*$x_ratio),Round(206*$y_ratio)) ;moves to get merchant in screen
  280. Sleep(1500)
  281. MouseClick("left", Round(845*$x_ratio),Round(225*$y_ratio)) ;NPC Merchant to the right of cain's home
  282. Sleep(1200)
  283. MouseClick("left", Round(521*$x_ratio),Round(506*$y_ratio)) ;button to open up repair menu
  284. Sleep(400)
  285. MouseClick("left", Round(260*$x_ratio),Round(595*$y_ratio)) ;button to pay for repairs
  286. Sleep(100)
  287. Call("CheckDead")
  288. Call("CheckWindow")
  289. If Not $Dead Then
  290. Send("{ESCAPE}") ;closes repair tab
  291. Sleep(100)
  292. Send("{ESCAPE}") ;menu
  293. Sleep(10)
  294. MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  295. Sleep(2500)
  296. Call("MainMenu")
  297. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  298. Sleep($loadtime)
  299. EndIf
  300. EndFunc
  301.  
  302. Func CheckLoot()
  303. Sleep(Random(1200,2000))
  304. $Pixel4 = PixelSearch(Round(270*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0xBF642F, 1) ;searches main window for color of legendary lootz
  305. If Not @error Then
  306. MouseClick ('left', $Pixel4[0], $Pixel4[1])
  307. Sleep(Random(800,1200))
  308. $i+= 1
  309. If $i < 8 Then
  310. Call("CheckLoot")
  311. EndIf
  312. EndIf
  313. $Pixel5 = PixelSearch(Round(270*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0xFFFF00, 1) ; rare lootz (also f3f45b)
  314. If Not @error Then
  315. MouseClick ('left', $Pixel5[0], $Pixel5[1])
  316. Sleep(Random(800,1200))
  317. $i+= 1
  318. If $i < 8 Then
  319. Call("CheckLoot")
  320. EndIf
  321. EndIf
  322. $Pixel6 = PixelSearch(Round(270*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0x00FF00, 1) ; set lootz
  323. If Not @error Then
  324. MouseClick ('left', $Pixel6[0], $Pixel6[1])
  325. Sleep(Random(800,1200))
  326. $i+= 1
  327. If $i < 8 Then
  328. Call("CheckLoot")
  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