Advertisement
Guest User

wittekop's messy wizard edit of notAres' script

a guest
Jun 7th, 2012
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.23 KB | None | 0 0
  1. ;notAres' Sarkarth DH Gold Script 1.2.5 - 6/7/2012 - Improved death detection and escape usage to avoid any extra pushes. Improved cellar waypoint so ferrets do not auto-attack, fine tuned the DPS from there.
  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. ;Required movement speed: 25% (10% boots + 15% passive 'Hot Pursuit')
  6. ;Required display mode for cellar detection: "FULLSCREEN WINDOWED"
  7. ;Official supported resolution: 1920x1080
  8. ;;;;;
  9. ;Features:
  10. ;Loot scanning. Will only pick up rare/legendary/set pieces [IMPROVED]
  11. ;Randomized aiming coordinates (but still static path)
  12. ;Randomized pickup timers for variation in runs
  13. ;Automatic repair on yellow status icon
  14. ;Automatic resolution adjustment (16:9 only) [BUGGY - need someone to tweak coords]
  15. ;Death check
  16. ;Open window check (in rare case it gets stuck in menu)
  17. ;;;;;
  18. ;Original:
  19. ;[Goldfarming] AFK 150k-200k Gold Per Hour by mackus101 @ ownedcore
  20. ;;;;;
  21.  
  22. Global $Paused
  23.  
  24. HotKeySet("=","Leave") ;script started by pressing =
  25. HotKeySet("-", "Pause") ;script paused by pressing -
  26. HotKeySet("x", "Stop") ;script stopped by pressing x
  27.  
  28. $walktime = 6000; time in ms the script waits for you to enter and load the cellar. Slow this down for slower move speeds and loading times
  29. $loadtime = 6000 ; time in ms the script waits for the game to load before it starts pathfinding. Slow this down for slower hard drives
  30. $tptime = 8200 ; time in ms the script waits for teleport before exiting the game
  31. $yellow = "0x1E2B45" ; yellow color code it detects @ pixel 1520x40, tweak this if it's not detecting correctly
  32. $red = "0xDB0000" ; red color code
  33.  
  34. $go = True
  35. $Leave = False
  36. $NeedRepair = False
  37. $Dead = False
  38. $default_resolutionX = 1920
  39. $default_resolutionY = 1080
  40. $x_ratio = @Desktopwidth / $default_resolutionX
  41. $y_ratio = @Desktopheight / $default_resolutionY
  42.  
  43.  
  44. While $go
  45. if($Leave) Then
  46. Call("CheckDead")
  47. Call("CheckWindow")
  48. Call("CheckLogout")
  49. Call("CheckRepair")
  50. $i = 0
  51. MouseClick("left", Round(587 * $x_ratio),Round(333 * $y_ratio)) ;starts the main run
  52. Sleep(1800)
  53. Send("2")
  54. MouseClick("left", Round(96 * $x_ratio),Round(383 * $y_ratio))
  55. Sleep(800)
  56. Send("1")
  57. Sleep(1500)
  58. MouseClick("left", Round(417 * $x_ratio),Round(422 * $y_ratio)) ;middle of area outside of cellar
  59. Sleep(2000)
  60. Send("3")
  61. MouseMove(Round(115 * $x_ratio),Round(210 * $y_ratio),1) ;moves cursor over to the cellar so the proper blue pixel becomes highlighted
  62. Sleep(1000)
  63. Call("CheckDead")
  64. Call("CheckWindow")
  65. $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)
  66. If Not @error Then
  67. MouseClick("left",Round(115 *$x_ratio),Round(210 * $y_ratio)) ;Entrance to cellar
  68. Sleep($loadtime)
  69. MouseClick("left",Round(531 *$x_ratio),Round(769 * $y_ratio))
  70. Sleep(2000)
  71. MouseClick("left",Round(547 *$x_ratio),Round(490 * $y_ratio)) ;moves to doorway leading to rare inside cellar
  72. Sleep(1500)
  73. MouseMove(Round(579 * $x_ratio),Round(209 * $y_ratio),1) ;hovers over the rare Sarkoth
  74. Send(4)
  75. Sleep(1000)
  76. Send("{SHIFTDOWN}")
  77. MouseDown("right") ;attack middle
  78. Sleep(3800)
  79. MouseMove(Round(467 * $x_ratio),Round(269 * $y_ratio),1) ;attack left, add more sleep time if you can't kill minion on left
  80. Sleep(3000)
  81. MouseMove(Round(682 * $x_ratio),Round(147 * $y_ratio),1) ;attack right
  82. Sleep(800)
  83. MouseMove(Round(579 * $x_ratio),Round(209 * $y_ratio),1) ;move back to middle
  84. Sleep(1000)
  85. MouseUP("right")
  86. Sleep(300)
  87. Send("{SHIFTUP}")
  88. Call("CheckDead")
  89. Call("CheckWindow")
  90. Sleep(400)
  91. MouseClick("middle",Round(600 *$x_ratio),Round(223 * $y_ratio)) ;location of sarkoth after death
  92. Sleep(2500)
  93. MouseClick("middle",Round(866 *$x_ratio),Round(324 * $y_ratio)) ;moves to right top corner for gold
  94. Sleep(1500)
  95. MouseClick("middle",Round(902 *$x_ratio),Round(954 * $y_ratio)) ;moves to bottom middle for gold
  96. Sleep(1500)
  97. MouseClick("middle",Round(687 *$x_ratio),Round(413 * $y_ratio)) ;moves to left top corner for gold
  98. Sleep(1500)
  99. Call("CheckLoot")
  100. Send("t")
  101. Sleep($tptime)
  102. Call("CheckDead")
  103. Call("CheckWindow")
  104. If Not $Dead Then
  105. Send("{ESCAPE}") ;menu
  106. Sleep(200)
  107. MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  108. Sleep($loadtime)
  109. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  110. Sleep($loadtime)
  111. EndIf
  112. Else
  113. Sleep(100)
  114. MouseClick("middle",Round(1100*$x_ratio),Round(600*$y_ratio)) ;moves between caltrops for safety before teleporting back to town
  115. Sleep(200)
  116. Send("t")
  117. Sleep($tptime)
  118. Call("CheckDead")
  119. Call("CheckWindow")
  120. If Not $Dead Then
  121. Send("{ESCAPE}") ;menu
  122. Sleep(200)
  123. MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  124. Sleep($loadtime)
  125. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  126. Sleep($loadtime)
  127. EndIf
  128. EndIf
  129. EndIf
  130. WEnd
  131.  
  132. Func CheckDead()
  133. Call("CheckWindow")
  134. $Pixeltest = PixelGetColor(549, 569)
  135. $Pixeltest2 = PixelGetColor(515, 561)
  136. $Pixeltest3 = PixelGetColor(524, 558)
  137. If Hex($Pixeltest, 6) == "0x2E2D42" OR Hex($Pixeltest, 6) == "0x352C43" Then
  138. If Not $Window Then
  139. $Dead = True
  140. Sleep(100)
  141. Send("{Escape}")
  142. Sleep(10)
  143. MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  144. Sleep(12500)
  145. Sleep($loadtime)
  146. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  147. Sleep($loadtime)
  148. ElseIf $Window Then
  149. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  150. Sleep($loadtime)
  151. $Window = False
  152. EndIf
  153. ElseIf Hex($Pixeltest2, 6) == "0x080B12" OR Hex($Pixeltest3, 6) == "0x121015" Then
  154. Sleep(10000)
  155. If Not $Window Then
  156. $Dead = True
  157. Sleep($loadtime)
  158. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  159. Sleep($loadtime)
  160. ElseIf $Window Then
  161. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  162. Sleep($loadtime)
  163. $Window = False
  164. EndIf
  165. Else
  166. $Dead = False
  167. EndIf
  168. EndFunc
  169.  
  170. Func CheckWindow()
  171. $Pixeltest2 = PixelGetColor(Round(1580*$x_ratio), Round(100*$y_ratio))
  172. If Hex($Pixeltest2, 6) == "0x653B23" Then
  173. Sleep(20)
  174. MouseClick("left", Round(1580*$x_ratio), Round(100*$y_ratio)) ;close the open window
  175. Sleep(20)
  176. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  177. Sleep($loadtime)
  178. EndIf
  179. EndFunc
  180.  
  181. Func CheckLogout()
  182. $Pixeltest3 = PixelGetColor(Round(960*$x_ratio), Round(290*$y_ratio))
  183. If Hex($Pixeltest3, 6) == "0x400400" Then
  184. Sleep(9000)
  185. Sleep($loadtime)
  186. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  187. Sleep($loadtime)
  188. EndIf
  189. EndFunc
  190.  
  191. Func CheckRepair()
  192. $RepairArea = PixelSearch(1010, 22, 1015, 28, $yellow)
  193. If Not @error Then
  194. Call("DoRepair")
  195. EndIf
  196. $RepairAreaRed = PixelSearch(1010, 22, 1015, 28, $red)
  197. If Not @error Then
  198. Call("DoRepair")
  199. EndIf
  200. EndFunc
  201.  
  202. Func DoRepair()
  203. Send("t")
  204. Sleep($tptime)
  205. MouseClick("left", Round(1480*$x_ratio),Round(281*$y_ratio)) ;begin movement towards merchant
  206. Sleep(1500)
  207. MouseClick("left", Round(1316*$x_ratio),Round(206*$y_ratio)) ;moves to get merchant in screen
  208. Sleep(1500)
  209. MouseClick("left", Round(845*$x_ratio),Round(225*$y_ratio)) ;NPC Merchant to the right of cain's home
  210. Sleep(1200)
  211. MouseClick("left", Round(521*$x_ratio),Round(506*$y_ratio)) ;button to open up repair menu
  212. Sleep(400)
  213. MouseClick("left", Round(260*$x_ratio),Round(595*$y_ratio)) ;button to pay for repairs
  214. Sleep(100)
  215. Call("CheckDead")
  216. Call("CheckWindow")
  217. If Not $Dead Then
  218. Send("{ESCAPE}") ;closes repair tab
  219. Sleep(100)
  220. Send("{ESCAPE}") ;menu
  221. Sleep(10)
  222. MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  223. Sleep($loadtime)
  224. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  225. Sleep($loadtime)
  226. EndIf
  227. EndFunc
  228.  
  229. Func CheckLoot()
  230. Sleep(Random(1200,3200))
  231. $Pixel4 = PixelSearch(Round(270*$x_ratio), 0, Round(1490*$x_ratio), Round(900*$y_ratio), 0xBF642F, 1) ;searches main window for color of legendary lootz
  232. If Not @error Then
  233. MouseClick ('left', $Pixel4[0], $Pixel4[1])
  234. Sleep(Random(800,1200))
  235. $i+= 1
  236. If $i > 8 Then
  237. Call("CheckLoot")
  238. EndIf
  239. EndIf
  240. $Pixel5 = PixelSearch(Round(270*$x_ratio), 0, Round(1490*$x_ratio), Round(900*$y_ratio), 0xFFFF00) ; rare lootz (also f3f45b)
  241. If Not @error Then
  242. MouseClick ('left', $Pixel5[0], $Pixel5[1])
  243. Sleep(Random(800,1800))
  244. $i+= 1
  245. If $i > 8 Then
  246. Call("CheckLoot")
  247. EndIf
  248. EndIf
  249. $Pixel6 = PixelSearch(Round(270*$x_ratio), 0, Round(1490*$x_ratio), Round(900*$y_ratio), 0x00FF00) ; set lootz
  250. If Not @error Then
  251. MouseClick ('left', $Pixel6[0], $Pixel6[1])
  252. Sleep(Random(800,1200))
  253. $i+= 1
  254. If $i > 8 Then
  255. Call("CheckLoot")
  256. EndIf
  257. EndIf
  258. EndFunc
  259.  
  260. Func Pause()
  261. $Leave = False
  262. EndFunc
  263.  
  264. Func Stop() ;to allow the script to stop
  265. Exit
  266. EndFunc
  267.  
  268. Func Leave()
  269. $Leave = True
  270. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement