Guest User

Wizard Autoit

a guest
Jun 8th, 2012
540
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.46 KB | None | 0 0
  1. Global $Paused
  2.  
  3. HotKeySet("=","Leave") ;script started by pressing =
  4. HotKeySet("-", "Pause") ;script paused by pressing -
  5. HotKeySet("x", "Stop") ;script stopped by pressing x
  6.  
  7. $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
  8. $loadtime = 3200 ; time in ms the script waits for the game to load before it starts pathfinding. Slow this down for slower hard drives
  9. $tptime = 6900 ; time in ms the script waits for teleport before exiting the game
  10. $yellow = 0xFFF000 ; yellow color code
  11. $red = 0xD90000 ; red color code
  12.  
  13. $go = True
  14. $Leave = False
  15. $Dead = False
  16. $Window = False
  17. $default_resolutionX = 1920
  18. $default_resolutionY = 1080
  19. $x_ratio = @Desktopwidth / $default_resolutionX
  20. $y_ratio = @Desktopheight / $default_resolutionY
  21.  
  22.  
  23. While $go
  24. if($Leave) Then
  25. $i = 0
  26. Call("CheckDead")
  27. If $Window Then
  28. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  29. Sleep($loadtime)
  30. $Window = False
  31. EndIf
  32. Sleep(1800) ;had to add this since the icon doesn't show up RIGHT away in game
  33. Call("CheckRepair")
  34. MouseClick("middle", Round(500*$x_ratio), Round(250*$y_ratio)) ;starts the run [waypoint 1]
  35. Sleep(1400)
  36. Send("1")
  37. Send("2")
  38. MouseClick("middle", 1, Round(370*$y_ratio)) ;waits ~1 second then [waypoint 2]
  39. Sleep(2100)
  40. MouseClick("middle", Round(400*$x_ratio), Round(600*$y_ratio)) ;middle of courtyard [waypoint 3]
  41. Sleep(20)
  42. Send("3")
  43. Sleep(300)
  44. MouseMove(Round(300*$x_ratio),Round(100*$y_ratio),1) ;moves cursor over to the cellar so the proper blue pixel becomes highlighted
  45. Sleep(700)
  46. Call("CheckDead")
  47. $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)
  48. If Not @error Then
  49. Send("3")
  50. Sleep(140)
  51. MouseClick("left",Round(300*$x_ratio),Round(100*$y_ratio)) ;Entrance to cellar
  52. Sleep(220)
  53. Send("2")
  54. Sleep($walktime)
  55. MouseClick("middle",Round(133*$x_ratio),Round(875*$y_ratio)) ;moves to doorway leading to rare inside cellar
  56. Sleep(2100)
  57. MouseMove(Round(440*$x_ratio),Round(85*$y_ratio),1) ;hovers over the rare Sarkoth
  58. Sleep(10)
  59. Send(4)
  60. Send("{SHIFTDOWN}")
  61. MouseDown("right") ;attack middle
  62. Sleep(4750)
  63. MouseUp("right")
  64. MouseClick("left",Round(440*$x_ratio),Round(80*$y_ratio),2)
  65. MouseMove(Round(250*$x_ratio),Round(110*$y_ratio),1) ;attack left
  66. Sleep(40)
  67. MouseDown("left")
  68. Sleep(1600)
  69. MouseUp("left")
  70. Send("{SHIFTUP}")
  71. Call("CheckDead")
  72. Sleep(200)
  73. MouseClick("middle",Round(579*$x_ratio),Round(209*$y_ratio)) ;location of sarkoth after death
  74. Sleep(1100)
  75. MouseClick("middle",Round(866*$x_ratio),Round(324*$y_ratio)) ;moves to right top corner for gold
  76. Sleep(1100)
  77. MouseClick("middle",Round(902*$x_ratio),Round(850*$y_ratio)) ;moves to bottom middle for gold
  78. Sleep(1100)
  79. MouseClick("middle",Round(587*$x_ratio),Round(413*$y_ratio)) ;moves to left top corner for gold
  80. Sleep(500)
  81. Call("CheckLoot")
  82. Sleep(300)
  83. Send("t")
  84. Sleep($tptime)
  85. Call("CheckDead")
  86. Call("CheckWindow")
  87. If Not $Dead And Not $Window Then
  88. Sleep(100)
  89. Send("{ESCAPE}") ;menu
  90. Sleep(10)
  91. MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  92. Sleep($loadtime)
  93. Send("{SPACE}") ;close any open windows
  94. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  95. Sleep($loadtime)
  96. ElseIf $Window Then
  97. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  98. Sleep($loadtime)
  99. $Window = False
  100. EndIf
  101. Else
  102. Sleep(10)
  103. MouseClick("middle",Round(800*$x_ratio),Round(600*$y_ratio)) ;moves between caltrops for safety before teleporting back to town
  104. Sleep(300)
  105. Send("4")
  106. Sleep(900)
  107. Send("t")
  108. Sleep($tptime)
  109. Call("CheckDead")
  110. Call("CheckWindow")
  111. If Not $Dead And Not $Window Then
  112. Sleep(100)
  113. Send("{ESCAPE}") ;menu
  114. Sleep(10)
  115. MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  116. Sleep($loadtime)
  117. Send("{SPACE}") ;close any open windows
  118. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  119. Sleep($loadtime)
  120. ElseIf $Window Then
  121. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  122. Sleep($loadtime)
  123. $Window = False
  124. EndIf
  125. EndIf
  126. EndIf
  127. WEnd
  128.  
  129. Func CheckDead()
  130. Call("CheckWindow")
  131. $Pixeltest = PixelGetColor(Round(740*$x_ratio), Round(850*$y_ratio))
  132. If Hex($Pixeltest, 6) == "0C0404" OR Hex($Pixeltest, 6) == "310000" Then
  133. If Not $Window Then
  134. $Dead = True
  135. Sleep(100)
  136. Send("{Escape}")
  137. Sleep(10)
  138. MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  139. Sleep(12500)
  140. Sleep($loadtime)
  141. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  142. Sleep($loadtime)
  143. ElseIf $Window Then
  144. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  145. Sleep($loadtime)
  146. $Window = False
  147. EndIf
  148. ElseIf Hex($Pixeltest, 6) == "0C0000" OR Hex($Pixeltest, 6) == "030101" Then
  149. Sleep(10000)
  150. If Not $Window Then
  151. $Dead = True
  152. Sleep($loadtime)
  153. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  154. Sleep($loadtime)
  155. ElseIf $Window Then
  156. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  157. Sleep($loadtime)
  158. $Window = False
  159. EndIf
  160. Else
  161. $Dead = False
  162. EndIf
  163. EndFunc
  164.  
  165. Func CheckWindow()
  166. $Pixeltest2 = PixelGetColor(Round(1580*$x_ratio), Round(100*$y_ratio))
  167. If Hex($Pixeltest2, 6) == "653B23" Then
  168. Sleep(200)
  169. Send("{SPACE}") ;close any open windows
  170. $Window = True
  171. Else
  172. $Window = False
  173. EndIf
  174. Sleep(300)
  175. EndFunc
  176.  
  177. Func CheckRepair()
  178. $RepairArea = PixelSearch(Round(1480*$x_ratio), 0, Round(1900*$x_ratio), Round(50*$y_ratio), $yellow)
  179. If Not @error Then
  180. Call("DoRepair")
  181. EndIf
  182. $RepairAreaRed = PixelSearch(Round(1480*$x_ratio), 0, Round(1900*$x_ratio), Round(50*$y_ratio), $red)
  183. If Not @error Then
  184. Call("DoRepair")
  185. EndIf
  186. EndFunc
  187.  
  188. Func DoRepair()
  189. Sleep(100)
  190. Send("t")
  191. Sleep($tptime)
  192. MouseClick("left", Round(1480*$x_ratio),Round(281*$y_ratio)) ;begin movement towards merchant
  193. Sleep(1500)
  194. MouseClick("left", Round(1316*$x_ratio),Round(206*$y_ratio)) ;moves to get merchant in screen
  195. Sleep(1500)
  196. MouseClick("left", Round(845*$x_ratio),Round(225*$y_ratio)) ;NPC Merchant to the right of cain's home
  197. Sleep(1200)
  198. MouseClick("left", Round(521*$x_ratio),Round(506*$y_ratio)) ;button to open up repair menu
  199. Sleep(400)
  200. MouseClick("left", Round(260*$x_ratio),Round(595*$y_ratio)) ;button to pay for repairs
  201. Sleep(100)
  202. Call("CheckDead")
  203. Call("CheckWindow")
  204. If Not $Dead Then
  205. Send("{ESCAPE}") ;closes repair tab
  206. Sleep(100)
  207. Send("{ESCAPE}") ;menu
  208. Sleep(10)
  209. MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  210. Sleep($loadtime)
  211. MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  212. Sleep($loadtime)
  213. EndIf
  214. EndFunc
  215.  
  216. Func CheckLoot()
  217. Sleep(Random(1200,3200))
  218. $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
  219. If Not @error Then
  220. MouseClick ('left', $Pixel4[0], $Pixel4[1])
  221. Sleep(Random(800,1200))
  222. $i+= 1
  223. If $i < 8 Then
  224. Call("CheckLoot")
  225. EndIf
  226. EndIf
  227. $Pixel5 = PixelSearch(Round(270*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0xFFFF00, 1) ; rare lootz (also f3f45b)
  228. If Not @error Then
  229. MouseClick ('left', $Pixel5[0], $Pixel5[1])
  230. Sleep(Random(800,1800))
  231. $i+= 1
  232. If $i < 8 Then
  233. Call("CheckLoot")
  234. EndIf
  235. EndIf
  236. $Pixel6 = PixelSearch(Round(270*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0x00FF00, 1) ; set lootz
  237. If Not @error Then
  238. MouseClick ('left', $Pixel6[0], $Pixel6[1])
  239. Sleep(Random(800,1200))
  240. $i+= 1
  241. If $i < 8 Then
  242. Call("CheckLoot")
  243. EndIf
  244. EndIf
  245. EndFunc
  246.  
  247. Func Pause()
  248. $Leave = False
  249. EndFunc
  250.  
  251. Func Stop() ;to allow the script to stop
  252. Exit
  253. EndFunc
  254.  
  255. Func Leave()
  256. $Leave = True
  257. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment