Advertisement
Guest User

travincall123

a guest
Jun 12th, 2012
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.90 KB | None | 0 0
  1. Global $Paused
  2. HotKeySet("=","Leave") ;script started by pressing =
  3. HotKeySet("-", "Pause") ;script paused by pressing -
  4. HotKeySet("x", "Stop") ;script stopped by pressing x
  5.  
  6. $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
  7. $loadtime = 3200 ; time in ms the script waits for the game to load before it starts pathfinding. Slow this down for slower hard drives
  8. $tptime = 6900 ; time in ms the script waits for teleport before exiting the game
  9. $yellow = 0xFFF000 ; yellow color code (repair icon)
  10. $red = 0xD90000 ; red color code (repair icon)
  11.  
  12. $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)
  13. $LootGems = False ; Change this to true if you want to pick up gems (messy, can fill up bag with whites/blues)
  14. $Amethyst = 0xAC7FFF
  15. $Ruby = 0xB01D2D
  16. $Emerald = 0x58EE33
  17. $Topaz = 0xFFFF59
  18.  
  19. $go = True
  20. $Leave = False
  21. $Dead = False
  22. $Logout = False
  23. $Window = False
  24. $default_resolutionX = 1920
  25. $default_resolutionY = 1080
  26. $x_ratio = @Desktopwidth / $default_resolutionX
  27. $y_ratio = @Desktopheight / $default_resolutionY
  28. $i = 0
  29.  
  30. Call("RestartRun")
  31.  
  32. Func RestartRun()
  33. While $go
  34. if($Leave) Then
  35. $i = 0
  36. Sleep(1000) ;had to add this since the icon doesn't show up RIGHT away in game
  37. Call("CheckDead")
  38. Call("CheckRepair")
  39. If $Window Then
  40. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  41. Sleep($loadtime)
  42. $Window = False
  43. ExitLoop
  44. ElseIf $Dead or $Logout Then
  45. ExitLoop
  46. EndIf
  47. MouseClick("left", Round(0 * $x_ratio),Round(250 * $y_ratio)) ;starts the main run
  48. Send("4")
  49. Sleep(140)
  50. Send("4")
  51. Sleep(140)
  52. Send("4")
  53. Sleep(140)
  54. Send("4")
  55. Sleep(80)
  56. Send("4")
  57. Sleep(80)
  58. Send("4")
  59. Sleep(80)
  60. Send("4")
  61. Sleep(80)
  62. Send("4")
  63. Sleep(80)
  64. Send("1")
  65. Send("3")
  66. Sleep(800)
  67. MouseMove(Round(290*$x_ratio),Round(270*$y_ratio),1) ;moves cursor over to the cellar so the proper blue pixel becomes highlighted
  68. Sleep(700)
  69. Call("CheckDead")
  70. If $Window Then
  71. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  72. Sleep($loadtime)
  73. $Window = False
  74. ExitLoop
  75. ElseIf $Dead or $Logout Then
  76. ExitLoop
  77. EndIf
  78. $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)
  79. If Not @error Then
  80. MouseClick("left",Round(290*$x_ratio),Round(270*$y_ratio)) ;Entrance to cellar
  81. Sleep(400)
  82.  
  83. Sleep($walktime)
  84. MouseClick("middle",Round(110*$x_ratio),Round(1000*$y_ratio)) ;moves to doorway leading to rare inside cellar
  85. Sleep(2500)
  86. MouseMove(Round(440*$x_ratio),Round(80*$y_ratio),1) ;hovers over the rare Sarkoth
  87. Sleep(10)
  88. Send("{SHIFTDOWN}")
  89. MouseClick("left",Round(440*$x_ratio),Round(80*$y_ratio),2)
  90. MouseDown("right") ;attack middle
  91. Sleep(7800)
  92. MouseClick("right",Round(620*$x_ratio),Round(20*$y_ratio),2) ;break the table & chair
  93. Sleep(10)
  94. Send("{SHIFTUP}")
  95. Sleep(400)
  96. MouseClick("middle",Round(530*$x_ratio),Round(170*$y_ratio)) ;location of sarkoth after death
  97. Sleep(2100)
  98.  
  99. Call("CheckLoot")
  100. Send("t")
  101. Sleep($tptime)
  102. Call("CheckDead")
  103. If Not $Logout And Not $Dead And Not $Window Then
  104. Sleep(300)
  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. Call("CheckDead")
  110. If Not $Logout Then
  111. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  112. Sleep($loadtime)
  113. EndIf
  114. Else
  115. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  116. Sleep($loadtime)
  117. $Window = False ; reset the flag so it doesn't think a window is always up
  118. EndIf
  119. Else
  120. Send("2")
  121. Sleep(700)
  122. Send("t")
  123. Sleep($tptime)
  124. Call("CheckDead")
  125. If Not $Logout And Not $Dead And Not $Window Then
  126. Sleep(300)
  127. Send("{ESCAPE}") ;menu
  128. Sleep(200)
  129. MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  130. Sleep($loadtime)
  131. Call("CheckDead")
  132. If Not $Logout Then
  133. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  134. Sleep($loadtime)
  135. EndIf
  136. Else
  137. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  138. Sleep($loadtime)
  139. $Window = False ; reset the flag so it doesn't think a window is always up
  140. EndIf
  141. EndIf
  142. EndIf
  143. WEnd
  144. Call("RestartRun")
  145. EndFunc
  146.  
  147. Func CheckDead()
  148. Call("CheckWindow")
  149. $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"
  150. If Not @error Then
  151. If Not $Window Then
  152. $Dead = True
  153. Sleep(100)
  154. Send("{Escape}")
  155. Sleep(10)
  156. MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  157. Sleep(11000)
  158. Sleep($loadtime)
  159. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  160. Sleep($loadtime)
  161. Else
  162. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  163. Sleep($loadtime)
  164. $Dead = False
  165. EndIf
  166. Else
  167. $Dead = False
  168. EndIf
  169. $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
  170. If Not @error Then
  171. Sleep(11000)
  172. Sleep($loadtime)
  173. If Not $Window Then
  174. $Dead = True
  175. $Logout = True
  176. Sleep($loadtime)
  177. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  178. Sleep($loadtime)
  179. Else
  180. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  181. Sleep($loadtime)
  182. $Logout = False
  183. EndIf
  184. Else
  185. $Logout = False
  186. EndIf
  187. EndFunc
  188.  
  189. Func CheckWindow()
  190. $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
  191. If Not @error Then
  192. Sleep(200)
  193. Send("{SPACE}") ;close any open windows
  194. $Window = True
  195. Else
  196. $Window = False
  197. EndIf
  198. EndFunc
  199.  
  200. Func CheckRepair()
  201. $RepairArea = PixelSearch(Round(1480*$x_ratio), 0, Round(1570*$x_ratio), Round(100*$y_ratio), $yellow)
  202. If Not @error Then
  203. Call("DoRepair")
  204. EndIf
  205. $RepairAreaRed = PixelSearch(Round(1480*$x_ratio), 0, Round(1570*$x_ratio), Round(100*$y_ratio), $red)
  206. If Not @error Then
  207. Call("DoRepair")
  208. EndIf
  209. EndFunc
  210.  
  211. Func DoRepair()
  212. Sleep(100)
  213. Send("t")
  214. Sleep($tptime)
  215. MouseClick("left", Round(1480*$x_ratio),Round(281*$y_ratio)) ;begin movement towards merchant
  216. Sleep(1500)
  217. MouseClick("left", Round(1316*$x_ratio),Round(206*$y_ratio)) ;moves to get merchant in screen
  218. Sleep(1500)
  219. MouseClick("left", Round(845*$x_ratio),Round(225*$y_ratio)) ;NPC Merchant to the right of cain's home
  220. Sleep(1200)
  221. MouseClick("left", Round(521*$x_ratio),Round(506*$y_ratio)) ;button to open up repair menu
  222. Sleep(400)
  223. MouseClick("left", Round(260*$x_ratio),Round(595*$y_ratio)) ;button to pay for repairs
  224. Sleep(200)
  225. Call("CheckDead")
  226. If Not $Dead and Not $Logout Then
  227. Send("{ESCAPE}") ;closes repair tab
  228. Sleep(100)
  229. Send("{ESCAPE}") ;menu
  230. Sleep(10)
  231. MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  232. Sleep($loadtime)
  233. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  234. Sleep($loadtime)
  235. EndIf
  236. EndFunc
  237.  
  238. Func CheckLoot()
  239. Sleep(Random(500,2000))
  240. $SetLoot = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0x02CE01, 2) ; set loot
  241. If Not @error Then
  242. MouseClick ('left', $SetLoot[0], $SetLoot[1])
  243. Sleep(Random(800,1200))
  244. $i+= 1
  245. If $i <= 6 Then
  246. Call("CheckLoot")
  247. EndIf
  248. EndIf
  249. $LegendaryLoot= PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0xBF642F, 2) ; legendary loot
  250. If Not @error Then
  251. MouseClick ('left', $LegendaryLoot[0], $LegendaryLoot[1])
  252. Sleep(Random(800,1200))
  253. $i+= 1
  254. If $i <= 6 Then
  255. Call("CheckLoot")
  256. EndIf
  257. EndIf
  258. If $LootRares Then
  259. $RareLoot = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0xBBBB00, 2) ; rare loot (darker for compatibility)
  260. If Not @error Then
  261. MouseClick ('left', $RareLoot[0], $RareLoot[1])
  262. Sleep(Random(700,900))
  263. $i+= 1
  264. If $i <= 6 Then
  265. Call("CheckLoot")
  266. EndIf
  267. EndIf
  268. EndIf
  269. If $LootGems Then
  270. $AmethystDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Amethyst,8)
  271. If Not @error Then
  272. MouseClick("left", $AmethystDrop[0], $AmethystDrop[1])
  273. Sleep(Random(900,1400))
  274. $i+= 1
  275. If $i <= 10 Then
  276. Call("CheckLoot")
  277. EndIf
  278. EndIf
  279. $RubyDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Ruby,6)
  280. If Not @error Then
  281. MouseClick("left", $RubyDrop[0], $RubyDrop[1])
  282. Sleep(Random(900,1400))
  283. $i+= 1
  284. If $i <= 10 Then
  285. Call("CheckLoot")
  286. EndIf
  287. EndIf
  288. $EmeraldDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Emerald,11)
  289. If Not @error Then
  290. MouseClick("left", $EmeraldDrop[0], $EmeraldDrop[1])
  291. Sleep(Random(900,1400))
  292. $i+= 1
  293. If $i <= 10 Then
  294. Call("CheckLoot")
  295. EndIf
  296. EndIf
  297. $TopazDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Topaz,2)
  298. If Not 1 = 1 Then ; change to 'If Not @error Then' if you want to search for topazes
  299. MouseClick("left", $TopazDrop[0], $TopazDrop[1])
  300. Sleep(Random(900,1400))
  301. $i+= 1
  302. If $i <= 10 Then
  303. Call("CheckLoot")
  304. EndIf
  305. EndIf
  306. EndIf
  307. EndFunc
  308.  
  309. Func Pause()
  310. $Leave = False
  311. EndFunc
  312.  
  313. Func Stop() ;to allow the script to stop
  314. Exit
  315. EndFunc
  316.  
  317. Func Leave()
  318. $Leave = True
  319. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement