Advertisement
Guest User

Untitled

a guest
Jun 12th, 2012
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.38 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. Send("t")
  122. Sleep($tptime)
  123. Call("CheckDead")
  124. Call("CheckWindow")
  125. If Not $Dead And Not $Window Then
  126. Sleep(100)
  127. Send("{ESCAPE}") ;menu
  128. Sleep(10)
  129. MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  130. Sleep(2500)
  131. Send("{SPACE}") ;close any open windows
  132. Sleep(500)
  133. Call("MainMenu")
  134. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  135. Sleep($loadtime)
  136. ElseIf $Window Then
  137. Call("MainMenu")
  138. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  139. Sleep($loadtime)
  140. $Window = False
  141. EndIf
  142. Else
  143. Sleep(10)
  144. MouseClick("middle",Round(1100*$x_ratio),Round(600*$y_ratio)) ;moves between caltrops for safety before teleporting back to town
  145. Sleep(200)
  146. Send("1")
  147. Sleep(620)
  148. Send("2")
  149. Sleep(40)
  150. Send("t")
  151. Sleep($tptime)
  152. Call("CheckDead")
  153. Call("CheckWindow")
  154. If Not $Dead And Not $Window Then
  155. Sleep(100)
  156. Send("{ESCAPE}") ;menu
  157. Sleep(10)
  158. MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  159. Sleep(2500)
  160. Send("{SPACE}") ;close any open windows
  161. Sleep(500)
  162. Call("MainMenu")
  163. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  164. Sleep($loadtime)
  165. ElseIf $Window Then
  166. Call("MainMenu")
  167. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  168. Sleep($loadtime)
  169. $Window = False
  170. EndIf
  171. EndIf
  172. EndIf
  173. WEnd
  174.  
  175. Func CheckDead()
  176. Call("CheckWindow")
  177. $Pixeltest = PixelGetColor(Round(740*$x_ratio), Round(850*$y_ratio))
  178. If Hex($Pixeltest, 6) == "0C0404" OR Hex($Pixeltest, 6) == "310000" Then
  179. If Not $Window Then
  180. $Dead = True
  181. Sleep(100)
  182. Send("{Escape}")
  183. Sleep(10)
  184. MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  185. Sleep(2500)
  186. Call("MainMenu")
  187. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  188. Sleep($loadtime)
  189. ElseIf $Window Then
  190. Call("MainMenu")
  191. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  192. Sleep($loadtime)
  193. $Window = False
  194. EndIf
  195. ElseIf Hex($Pixeltest, 6) == "0C0000" OR Hex($Pixeltest, 6) == "030101" Then
  196. Sleep(10000)
  197. If Not $Window Then
  198. $Dead = True
  199. Sleep($loadtime)
  200. Call("MainMenu")
  201. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  202. Sleep($loadtime)
  203. ElseIf $Window Then
  204. Call("MainMenu")
  205. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  206. Sleep($loadtime)
  207. $Window = False
  208. EndIf
  209. Else
  210. $Dead = False
  211. EndIf
  212. EndFunc
  213.  
  214. Func MainMenu() ;verifies the screen is at the main menu before attempting to start the next game to avoid getting trapped in menus.
  215. Local $Menu = False
  216. While $Menu = False
  217. $Pixeltestmm = PixelGetColor(Round(251*$x_ratio), Round(284*$y_ratio)) ;tests for main menu
  218. If Hex($Pixeltestmm, 6) == "683C02" Then
  219. $Menu = True
  220. Else
  221. $Pixeltestgm = PixelGetColor(Round(937*$x_ratio), Round(246*$y_ratio)) ;checks if game menu is open
  222. If Hex($Pixeltestgm, 6) == "621610" Then
  223. Send("{Escape}") ;return to main menu
  224. $Menu = True
  225. Else
  226. $Pixeltestgmexit = PixelGetColor(Round(975*$x_ratio), Round(428*$y_ratio)) ;checks if exit game menu is open
  227. If Hex($Pixeltestgmexit, 6) == "FFA300" Then
  228. Send("{Escape}")
  229. Send("{Escape}")
  230. $Menu = True
  231. Else
  232. $Pixeltestbm = PixelGetColor(Round(958*$x_ratio), Round(150*$y_ratio)) ;checks if banner customization window is open
  233. If Hex($Pixeltestbm, 6) == "933618" Then
  234. Send("{Escape}")
  235. $Menu = True
  236. Else
  237. $Pixeltestpm = PixelGetColor(Round(1506*$x_ratio), Round(138*$y_ratio)) ;checks if player window is open
  238. If Hex($Pixeltestpm, 6) == "320c08" Then
  239. Send("{Escape}")
  240. $Menu = True
  241. EndIf
  242. EndIf
  243. EndIf
  244. EndIf
  245. EndIf
  246. WEnd
  247. EndFunc
  248.  
  249. Func CheckWindow()
  250. $Pixeltest2 = PixelGetColor(Round(1580*$x_ratio), Round(100*$y_ratio))
  251. If Hex($Pixeltest2, 6) == "653B23" Then
  252. Sleep(200)
  253. Send("{SPACE}") ;close any open windows
  254. $Window = True
  255. Else
  256. $Window = False
  257. EndIf
  258. Sleep(300)
  259. EndFunc
  260.  
  261. Func CheckRepair()
  262. $RepairArea = PixelSearch(Round(1480*$x_ratio), 0, Round(1900*$x_ratio), Round(50*$y_ratio), $yellow)
  263. If Not @error Then
  264. Call("DoRepair")
  265. EndIf
  266. $RepairAreaRed = PixelSearch(Round(1480*$x_ratio), 0, Round(1900*$x_ratio), Round(50*$y_ratio), $red)
  267. If Not @error Then
  268. Call("DoRepair")
  269. EndIf
  270. EndFunc
  271.  
  272. Func DoRepair()
  273. Sleep(100)
  274. Send("t")
  275. Sleep($tptime)
  276. MouseClick("left", Round(1480*$x_ratio),Round(281*$y_ratio)) ;begin movement towards merchant
  277. Sleep(1500)
  278. MouseClick("left", Round(1316*$x_ratio),Round(206*$y_ratio)) ;moves to get merchant in screen
  279. Sleep(1500)
  280. MouseClick("left", Round(845*$x_ratio),Round(225*$y_ratio)) ;NPC Merchant to the right of cain's home
  281. Sleep(1200)
  282. MouseClick("left", Round(521*$x_ratio),Round(506*$y_ratio)) ;button to open up repair menu
  283. Sleep(400)
  284. MouseClick("left", Round(260*$x_ratio),Round(595*$y_ratio)) ;button to pay for repairs
  285. Sleep(100)
  286. Call("CheckDead")
  287. Call("CheckWindow")
  288. If Not $Dead Then
  289. Send("{ESCAPE}") ;closes repair tab
  290. Sleep(100)
  291. Send("{ESCAPE}") ;menu
  292. Sleep(10)
  293. MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  294. Sleep(2500)
  295. Call("MainMenu")
  296. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  297. Sleep($loadtime)
  298. EndIf
  299. EndFunc
  300.  
  301. Func Pause()
  302. $Leave = False
  303. EndFunc
  304.  
  305. Func Stop() ;to allow the script to stop
  306. Exit
  307. EndFunc
  308.  
  309. Func Leave()
  310. $Leave = True
  311. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement