Guest User

Enhanced Sarkoth Farm Script

a guest
Jun 7th, 2012
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 8.43 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 = 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
  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 =   "FFEB00" ; yellow color code it detects @ pixel 1520x40, tweak this if it's not detecting correctly
  11.  
  12. $go = True
  13. $Leave = False
  14. $NeedRepair = False
  15. $Dead = False
  16. $default_resolutionX = 1920
  17. $default_resolutionY = 1080
  18. $x_ratio = @Desktopwidth / $default_resolutionX
  19. $y_ratio = @Desktopheight / $default_resolutionY
  20.  
  21.  
  22. While $go
  23.    if($Leave) Then
  24.    Call("CheckDead")
  25.    Call("CheckProfile")
  26.    Call("CheckMenu")
  27.    Call("CheckLogout")
  28.    Call("CheckRepair")
  29.       If $NeedRepair Then
  30.          Send("t")
  31.          Sleep($tptime)
  32.          MouseClick("left", Round(1480*$x_ratio),Round(281*$y_ratio)) ;begin movement towards merchant
  33.          Sleep(1500)
  34.          MouseClick("left", Round(1316*$x_ratio),Round(206*$y_ratio)) ;moves to get merchant in screen
  35.          Sleep(1500)
  36.          MouseClick("left", Round(845*$x_ratio),Round(225*$y_ratio)) ;NPC Merchant to the right of cain's home
  37.          Sleep(1200)
  38.          MouseClick("left", Round(521*$x_ratio),Round(506*$y_ratio)) ;button to open up repair menu
  39.          Sleep(400)
  40.          MouseClick("left", Round(260*$x_ratio),Round(595*$y_ratio)) ;button to pay for repairs
  41.          Sleep(100)
  42.          Call("CheckDead")
  43.          Call("CheckProfile")
  44.          Call("CheckMenu")
  45.             If Not $Dead Then
  46.                Send("{ESCAPE}") ;closes repair tab
  47.                Sleep(100)
  48.                Send("{ESCAPE}") ;menu
  49.                Sleep(10)
  50.                MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  51.                Sleep($loadtime)
  52.                MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  53.                Sleep($loadtime)
  54.             EndIf
  55.       Else
  56.          $i = 0
  57.          Call("CheckRepair")
  58.          MouseClick("middle", Round(500*$x_ratio), Round(250*$y_ratio)) ;starts the run [waypoint 1]
  59.          Sleep(1200)
  60.          MouseClick("middle", 1, Round(370*$y_ratio)) ;waits 1 second then [waypoint 2]
  61.          Sleep(100)
  62.          Send("2")
  63.          Sleep(1700)
  64.          MouseClick("middle", Round(400*$x_ratio), Round(600*$y_ratio)) ;middle of courtyard [waypoint 3]
  65.          Sleep(40)
  66.          Send("2")
  67.          Sleep(20)
  68.          Send("3")
  69.          Sleep(600)
  70.          Send("1")
  71.          Sleep(300)
  72.          MouseMove(Round(300*$x_ratio),Round(100*$y_ratio),1) ;moves cursor over to the cellar so the proper blue pixel becomes highlighted
  73.          Sleep(700)
  74.          Call("CheckDead")
  75.          Call("CheckProfile")
  76.          Call("CheckMenu")
  77.          $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)
  78.             If Not @error Then
  79.                Send("4")
  80.                Sleep(140)
  81.                MouseClick("left",Round(300*$x_ratio),Round(100*$y_ratio)) ;Entrance to cellar
  82.                Sleep(220)
  83.                Send("2")
  84.                Sleep($walktime)
  85.                MouseClick("middle",Round(80*$x_ratio),Round(940*$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.                MouseDown("right") ;attack middle
  91.                Sleep(4200)
  92.                MouseUp("right")
  93.                MouseClick("left",Round(440*$x_ratio),Round(80*$y_ratio),2)
  94.                MouseMove(Round(250*$x_ratio),Round(110*$y_ratio),1) ;attack left
  95.                Sleep(40)
  96.                MouseDown("right")
  97.                Sleep(1600)
  98.                MouseUp("right")
  99.                MouseMove(Round(590*$x_ratio),Round(50*$y_ratio),1) ;attack right
  100.                MouseDown("right")
  101.                Sleep(1200)
  102.                MouseUp("right")
  103.                MouseDown("left")
  104.                MouseMove(Round(Random(250,280)*$x_ratio),Round(110*$y_ratio),1) ;attack left
  105.                Sleep(1200)
  106.                MouseMove(Round(Random(560,600)*$x_ratio),Round(50*$y_ratio),1) ;attack right
  107.                Sleep(1200)
  108.                MouseUP("left")
  109.                Sleep(10)
  110.                MouseClick("right",Round(620*$x_ratio),Round(20*$y_ratio),2) ;break the table & chair
  111.                Sleep(10)
  112.                Send("{SHIFTUP}")
  113.                Call("CheckDead")
  114.                Call("CheckProfile")
  115.                Call("CheckMenu")
  116.                Sleep(400)
  117.                MouseClick("middle",Round(440*$x_ratio),Round(80*$y_ratio)) ;location of sarkoth after death
  118.                Sleep(2000)
  119.                MouseClick("middle",Round(680*$x_ratio),Round(570*$y_ratio)) ;move to left top corner for gold
  120.                Sleep(1200)
  121.                MouseClick("middle",Round(1330*$x_ratio),Round(330*$y_ratio)) ;move to right top corner for gold
  122.                Sleep(1600)
  123.                Call("CheckLoot")
  124.                Send("t")
  125.                Sleep($tptime)
  126.                Call("CheckDead")
  127.                Call("CheckProfile")
  128.                Call("CheckMenu")
  129.                   If Not $Dead Then
  130.                      Send("{ESCAPE}") ;menu
  131.                      Sleep(10)
  132.                      MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  133.                      Sleep($loadtime)
  134.                      MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  135.                      Sleep($loadtime)
  136.                   EndIf
  137.             Else
  138.                Sleep(10)
  139.                MouseClick("middle",Round(1100*$x_ratio),Round(600*$y_ratio)) ;moves between caltrops for safety before teleporting back to town
  140.                Sleep(200)
  141.                Send("1")
  142.                Sleep(620)
  143.                Send("2")
  144.                Sleep(40)
  145.                Send("t")
  146.                Sleep($tptime)
  147.                Call("CheckDead")
  148.                Call("CheckProfile")
  149.                Call("CheckMenu")
  150.                   If Not $Dead Then
  151.                      Send("{ESCAPE}") ;menu
  152.                      Sleep(10)
  153.                      MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  154.                      Sleep($loadtime)
  155.                      MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  156.                      Sleep($loadtime)
  157.                   EndIf
  158.             EndIf
  159.       EndIf
  160.    EndIf
  161. WEnd
  162.  
  163. Func CheckDead()
  164. $Pixeltest = PixelGetColor(Round(740*$x_ratio), Round(850*$y_ratio))
  165.    If Hex($Pixeltest, 6) == "0C0404" OR Hex($Pixeltest, 6) == "310000" Then
  166.       $Dead = True
  167.       Sleep(100)
  168.       Send("{Escape}")
  169.       Sleep(10)
  170.       MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  171.       Sleep(10500)
  172.       Sleep($loadtime)
  173.       MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  174.       Sleep($loadtime)
  175.    Else
  176.       $Dead = False
  177.    EndIf
  178. EndFunc
  179.  
  180. Func CheckProfile()
  181. $Pixeltest2 = PixelGetColor(Round(1580*$x_ratio), Round(100*$y_ratio))
  182.    If Hex($Pixeltest2, 6) == "653B23" Then
  183.       Sleep(20)
  184.       Send("{Escape}") ;close the open window
  185.       Sleep(20)
  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 CheckMenu()
  192. $Pixeltest2 = PixelGetColor(Round(1158*$x_ratio), Round(218*$y_ratio))
  193.    If Hex($Pixeltest2, 6) == "FFD394" Then
  194.       Sleep(20)
  195.       Send("{Escape}") ;close the open window
  196.       Sleep(20)
  197.       MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  198.       Sleep($loadtime)
  199.    EndIf
  200. EndFunc
  201.  
  202. Func CheckLogout()
  203. $Pixeltest3 = PixelGetColor(Round(960*$x_ratio), Round(290*$y_ratio))
  204.    If Hex($Pixeltest3, 6) == "400400" Then
  205.       Sleep(9000)
  206.       Sleep($loadtime)
  207.       MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  208.       Sleep($loadtime)
  209.    EndIf
  210. EndFunc
  211.  
  212. Func CheckRepair()
  213. $Repair = PixelGetColor(Round(1515*$x_ratio), Round(40*$y_ratio)) ;Searches the exact location of armor indicator
  214.    If Hex($Repair, 6) == $yellow Then ;Checks if the pixel is yellow and starts the repair loop
  215.       $NeedRepair = True
  216.    Else
  217.       $NeedRepair = False
  218.    EndIf
  219. EndFunc
  220.  
  221. Func CheckLoot()
  222. Sleep(Random(1200,3200))
  223. $Pixel4 = PixelSearch(Round(270*$x_ratio), 0, Round(1490*$x_ratio), Round(900*$y_ratio), 0xBF642F, 1) ;Searches for Legendary Gear
  224.    If Not @error Then
  225.       MouseClick ('left', $Pixel4[0], $Pixel4[1])
  226.       Sleep(Random(800,1200))
  227.       $i+= 1
  228.          If $i < 4 Then
  229.          Call("CheckLoot")
  230.          EndIf
  231.    EndIf
  232. $Pixel5 = PixelSearch(Round(270*$x_ratio), 0, Round(1490*$x_ratio), Round(900*$y_ratio), 0x00FF00) ;Searches For Set Gear
  233.    If Not @error Then
  234.       MouseClick ('left', $Pixel5[0], $Pixel5[1])
  235.       Sleep(Random(800,1200))
  236.       $i+= 1
  237.          If $i < 4 Then
  238.          Call("CheckLoot")
  239.          EndIf
  240.    EndIf
  241. EndFunc
  242.  
  243. Func Pause()
  244.    $Leave = False
  245. EndFunc
  246.  
  247. Func Stop() ;to allow the script to stop
  248.     Exit
  249. EndFunc
  250.  
  251. Func Leave()
  252.    $Leave = True
  253. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment