Guest User

wittekop's edit of wizardscript

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