Guest User

Autoit Sarkoth Script

a guest
Jun 7th, 2012
379
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 13.31 KB | None | 0 0
  1. ;ASS(Autoit Sarkoth Script)  ver 1.0
  2.     ;WONT WORK UNLESS MOVE IS BOUND TO MIDDLE MOUSE (Mouse 3) -- NOT MOVE/INTERACT
  3.     ;Tested With DH build: http://d3db.com/tool/calculator/demon-hunter/28088
  4.     ;Required Max Discipline: 35
  5.     ;Required display mode for cellar detection: "FULLSCREEN WINDOWED"
  6.     ;Features:
  7.     ;Selling Junks Supported
  8.     ;Loot scanning. You can choose which quality to loot.
  9.     ;Automatic repair on yellow status icon
  10.     ;Automatic resolution adjustment
  11.     ;Death check before end of every loop (teleports and leaves)
  12.    ;Original:
  13.     ;[Goldfarming] AFK 150k-200k Gold Per Hour by mackus101 @ ownedcore  Combined with notAres' Sarkarth DH Gold Script 1.2.1 - 6/7/2012
  14.    
  15.     Global $Paused
  16.      
  17.     HotKeySet("=","TogglePause")  ;script can be START and PAUSE by pressing = Also Show some statistics
  18.     HotKeySet("x", "Stop") ;script can be Stopped by pressing x
  19.      
  20.     Global $loadtime = 3500
  21.     Global $waittime = 3800
  22.     Global $LForLegendary = True, $TotalLegendary = 0 ;Loot Legendary Items
  23.     Global $LForSet = True, $TotalSet = 0 ;Loot Set Items
  24.     Global $LForRare = True, $TotalRare = 0 ;Loot Rare Items
  25.     Global $LForMagic = True, $TotalMagic = 0 ;Loot Magic Items
  26.     Global $LForJunk = True, $TotalJunk = 0 ;Loot Junk Items
  27.     Global $Runs = 0 ;for tracking Number of Runs(Do not modify it)
  28.     Global $SellItems = True ;If you want to sell Magic and Junk Items
  29.     Global $SelPeriod = 15 ; How many Runs before Selling Junks
  30.    
  31.     $Run = False
  32.     $default_resolutionX = 1920
  33.     $default_resolutionY = 1080
  34.     $x_ratio = @Desktopwidth / $default_resolutionX
  35.     $y_ratio = @Desktopheight / $default_resolutionY
  36.      
  37.      
  38.     While True
  39.        if($Run) Then
  40.          CheckDead()
  41.          ;CheckWindow()
  42.          $Runs += 1
  43.          Sleep(3000)
  44.          $ArmorBox = PixelSearch(Round(1482*$x_ratio), Round(20*$y_ratio), Round(1535*$x_ratio), Round(95*$y_ratio),0xFFF000, 1, 2) ;searches top right screen for yellow of broken armor
  45.                If Not @error Then  ;Repair is needed
  46.                      Teleport()
  47.                      Sleep(100)
  48.                      Repair()
  49.                      Sleep(100)
  50.                      ResetRun()
  51.                Else ;Repair is NOT needed
  52.                      GetToCellar()
  53.                      Sleep(400)
  54.                      $Cellar = PixelSearch(0,0,(960 * $x_ratio),(540 * $y_ratio),0x3B62E3,3) ;searches for the specific blue pixel that only occurs when mouse hovers over open cellar
  55.                                If Not @error Then
  56.                                     MouseClick("left",Round(115 *$x_ratio),Round(210 * $y_ratio)) ;Entrance to cellar
  57.                                     FightSarkoth()
  58.                                     Sleep(1500)
  59.                                     MouseClick("left",Round(579 *$x_ratio),Round(209 * $y_ratio)) ;location of sarkoth after death
  60.                                     $TotalMagic += 1 ;Counts Magic item at Sarkoth Location
  61.                                     Sleep(500)
  62.                                     CheckLoot()
  63.                                     MouseClick("left",Round(866 *$x_ratio),Round(324 * $y_ratio)) ;moves to right top corner for gold
  64.                                     Sleep(500)
  65.                                     MouseClick("left",Round(902 *$x_ratio),Round(954 * $y_ratio)) ;moves to bottom middle for gold           
  66.                                     Sleep(800)
  67.                                     MouseClick("left",Round(687 *$x_ratio),Round(413 * $y_ratio)) ;moves to left top corner for gold
  68.                                     Sleep(500)
  69.                                     If Not CheckDead() Then
  70.                                        Teleport()
  71.                                        if ($Runs/$SelPeriod == Round($Runs/$SelPeriod)) AND $SellItems Then
  72.                                           SellJunk()
  73.                                        EndIf  
  74.                                        Sleep(300)
  75.                                        ResetRun()
  76.                                     EndIf  
  77.                                Else
  78.                                     ;Sleep(800)
  79.                                     MouseMove(Round(150 * $x_ratio), Round(108 * $y_ratio), 1) ;moves cursor over to the Alternate cellar Location so the proper blue pixel becomes highlighted
  80.                                     Sleep(500)
  81.                                     $AltCellar = PixelSearch(Round(60 * $x_ratio), Round(36 * $y_ratio), Round(180*$x_ratio), Round(160*$y_ratio),0x3B62E3,3) ;searches for the specific blue pixel
  82.                                     If IsArray($AltCellar) Then
  83.                                        MouseClick("left",Round(150 *$x_ratio),Round(108 * $y_ratio)) ;Entrance to cellar
  84.                                        FightSarkoth()
  85.                                        Sleep(1500)
  86.                                        MouseClick("left",Round(579 *$x_ratio),Round(209 * $y_ratio)) ;location of sarkoth after death
  87.                                        $TotalMagic += 1 ;Counts Magic item at Sarkoth Location
  88.                                        Sleep(500)
  89.                                        CheckLoot()
  90.                                        MouseClick("left",Round(866 *$x_ratio),Round(324 * $y_ratio)) ;moves to right top corner for gold
  91.                                        Sleep(500)
  92.                                        MouseClick("left",Round(902 *$x_ratio),Round(954 * $y_ratio)) ;moves to bottom middle for gold            
  93.                                        Sleep(800)
  94.                                        MouseClick("left",Round(687 *$x_ratio),Round(413 * $y_ratio)) ;moves to left top corner for gold
  95.                                        Sleep(500)
  96.                                        If Not CheckDead() Then
  97.                                           Teleport()
  98.                                           if ($Runs/$SelPeriod == Round($Runs/$SelPeriod)) AND $SellItems Then
  99.                                              SellJunk()
  100.                                           EndIf  
  101.                                           Sleep(300)
  102.                                           ResetRun()
  103.                                        EndIf
  104.                                     Else
  105.                                        MouseClick("middle", Round(1115 *$x_ratio), Round(205 * $y_ratio), 1)    ;moves up screen away from cellar in attempt for safety before teleporting back to town
  106.                                        Sleep(100)
  107.                                        Send("1")
  108.                                        Sleep(500)
  109.                                        If Not CheckDead() Then
  110.                                           Teleport()
  111.                                           if ($Runs/$SelPeriod == Round($Runs/$SelPeriod)) AND $SellItems  Then
  112.                                              SellJunk()
  113.                                           EndIf
  114.                                           Sleep(300)
  115.                                           ResetRun()
  116.                                        EndIf
  117.                                     EndIf  
  118.                                EndIf
  119.                EndIf
  120.        
  121.        EndIf
  122.     WEnd
  123.      
  124.    Func CheckDead()
  125.       $Pixeltest = PixelGetColor(Round(740*$x_ratio), Round(850*$y_ratio))
  126.        If Hex($Pixeltest, 6) == "0C0404" OR Hex($Pixeltest, 6) == "310000" Then
  127.           Sleep(100)
  128.           Send("{Escape}")
  129.           Sleep(10)
  130.           MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  131.           Sleep(10000)
  132.           Sleep($waittime)
  133.           MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  134.           Sleep($waittime)
  135.           $Flag = True
  136.        Else
  137.           $Flag = False  
  138.        EndIf
  139.        Return $Flag
  140.    EndFunc
  141.      
  142.    Func CheckWindow()
  143.       $Pixeltest2 = PixelGetColor(Round(1580*$x_ratio), Round(100*$y_ratio))
  144.        If Hex($Pixeltest2, 6) == "653B23" Then
  145.           Sleep(20)
  146.           MouseClick("left", Round(1580*$x_ratio), Round(100*$y_ratio)) ;close the open window
  147.           Sleep(20)
  148.           MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  149.           Sleep($waittime)
  150.        EndIf
  151.    EndFunc
  152.      
  153.      
  154.    Func CheckLoot()
  155.          If $LForLegendary Then
  156.             $i = 0
  157.             While $i < 2
  158.                   Send("{LALT}")
  159.                   Sleep(200)
  160.                   $Legendary = PixelSearch(Round(756*$x_ratio), Round(360*$y_ratio), Round(1080*$x_ratio), Round(668*$y_ratio), 0xBF642F, 2, 3) ;searches main window for color of legendary lootz
  161.                   If Not @error Then
  162.                         ToolTip("Legendary Loot Has been Find",700, 450)
  163.                         Sleep(2000)
  164.                         ToolTip("")
  165.                         $TotalLegendary += 1
  166.                         if IsArray($Legendary) then
  167.                               MouseClick ('left', $Legendary[0], $Legendary[1])
  168.                               Sleep(Random(400,1200))
  169.                         EndIf  
  170.                   EndIf
  171.                   $i = $i+1
  172.             WEnd
  173.          EndIf 
  174.          If $LForSet Then
  175.          $i = 0
  176.             While $i < 1
  177.                   Send("{LALT}")
  178.                   Sleep(200)
  179.                   $Set = PixelSearch(Round(756*$x_ratio), Round(360*$y_ratio), Round(1080*$x_ratio), Round(668*$y_ratio), 0x00FF00, 1, 3) ; searches main window for color of Set lootz
  180.                   If Not @error Then
  181.                         ToolTip("Set Loot Has been Find",700, 450)
  182.                         Sleep(2000)
  183.                         ToolTip("")
  184.                         $TotalSet += 1
  185.                         ToolTip("")
  186.                         if IsArray($Set) then
  187.                               MouseClick ('left', $Set[0], $Set[1])
  188.                               Sleep(Random(400,1200))
  189.                         EndIf  
  190.                   EndIf
  191.                   $i = $i+1
  192.             WEnd
  193.          EndIf
  194.          If $LForRare Then
  195.          $i = 0
  196.             While $i < 3
  197.                   Send("{LALT}")
  198.                   Sleep(200)
  199.                   $Rare = PixelSearch(Round(756*$x_ratio), Round(360*$y_ratio), Round(1080*$x_ratio), Round(668*$y_ratio), 0xFFFF00, 2, 3) ; rare lootz (also f3f45b)
  200.                   If Not @error Then
  201.                         ToolTip("Rare Loot Has been Find",700, 450)
  202.                         Sleep(1000)
  203.                         ToolTip("")
  204.                         $TotalRare += 1
  205.                         ToolTip("")
  206.                         if IsArray($Rare) then
  207.                               MouseClick ('left', $Rare[0], $Rare[1])
  208.                               Sleep(Random(400,1200))
  209.                         EndIf  
  210.                   EndIf
  211.                   $i = $i+1
  212.             WEnd
  213.          EndIf 
  214.          If $LForMagic Then
  215.             $i = 0
  216.             While $i < 5
  217.                   Send("{LALT}")
  218.                   Sleep(200)
  219.                   $Magic = PixelSearch(630, 300, 900, 550, 0x6969FF, 5, 3) ; magic lootz
  220.                   If Not @error Then
  221.                         ;ToolTip("Magic Loot Has been Find",700, 450)
  222.                         Sleep(200)
  223.                         ;ToolTip("")
  224.                         $TotalMagic += 1
  225.                         if IsArray($Magic) then
  226.                               MouseClick ('left', $Magic[0], $Magic[1])
  227.                               Sleep(Random(400,1200))
  228.                         EndIf  
  229.                   EndIf
  230.                   $i = $i+1
  231.             WEnd
  232.          EndIf
  233.          If $LForJunk Then
  234.             $i = 0
  235.             While $i < 5
  236.                   Send("{LALT}")
  237.                   Sleep(200)
  238.                   $Junk = PixelSearch(Round(756*$x_ratio), Round(360*$y_ratio), Round(1080*$x_ratio), Round(668*$y_ratio), 0xFFFFFF, 3, 3) ; Junk lootz
  239.                   If Not @error Then
  240.                         ;ToolTip("Jagic Loot Has been Find",700, 450)
  241.                         Sleep(400)
  242.                         ;ToolTip("")
  243.                         $TotalJunk += 1
  244.                         if IsArray($Junk) then
  245.                               MouseClick ('left', $Junk[0], $Junk[1])
  246.                               Sleep(Random(400,1200))
  247.                         EndIf  
  248.                   EndIf
  249.                   $i = $i+1
  250.             WEnd
  251.          EndIf 
  252.    EndFunc
  253.    
  254.    Func  ResetRun()
  255.       CheckDead()
  256.       Send("{ESCAPE}") ;opens menu
  257.       Sleep(100)
  258.       MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
  259.       Sleep($waittime)
  260.       MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
  261.       Sleep($loadtime)
  262.    EndFunc
  263.                  
  264.    Func Teleport()
  265.       Send("t")
  266.       Sleep(8000)
  267.    EndFunc
  268.    
  269.    Func Repair()
  270.       MouseClick("left", Round(1480*$x_ratio),Round(281*$y_ratio)) ;begin movement towards merchant
  271.       Sleep(1500)
  272.       MouseClick("left", Round(1316*$x_ratio),Round(206*$y_ratio)) ;moves to get merchant in screen
  273.       Sleep(1500)
  274.       MouseClick("left", Round(845*$x_ratio),Round(225*$y_ratio)) ;NPC Merchant to the right of cain's home
  275.       Sleep(1500)
  276.       MouseClick("left", Round(521*$x_ratio),Round(506*$y_ratio)) ;button to open up repair menu
  277.       Sleep(1500)
  278.       MouseClick("left", Round(260*$x_ratio),Round(595*$y_ratio)) ;button to pay for repairs
  279.       Sleep(100)
  280.       Send("{ESCAPE}") ;closes repair tab
  281.    EndFunc
  282.    
  283.    Func SellJunk()
  284.       $left = 1854*$x_ratio
  285.       $right = 1882.8*$x_ratio
  286.       MouseClick("left", Round(1480*$x_ratio),Round(281*$y_ratio)) ;begin movement towards merchant
  287.       Sleep(1500)
  288.       MouseClick("left", Round(1316*$x_ratio),Round(206*$y_ratio)) ;moves to get merchant in screen
  289.       Sleep(1500)
  290.       MouseClick("left", Round(845*$x_ratio),Round(225*$y_ratio)) ;NPC Merchant to the right of cain's home
  291.       Sleep(1500)
  292.       For $j = 1 To 10
  293.          $top = 836.4*$y_ratio
  294.          $bottom = 861.6*$y_ratio
  295.          For $k = 1 To 6  
  296.             ;MouseMove($left, $top, 1)
  297.             $JunkItem = PixelSearch($left, $top, $right, $bottom, 0x130B08, 1, 2) ;search Inventory for Junk Items to sell
  298.             If Not @error Then
  299.                   if IsArray($JunkItem) then
  300.                      MouseClick ('right', $JunkItem[0], $JunkItem[1], 1)
  301.                   EndIf  
  302.             EndIf
  303.             Sleep(200)
  304.             $RareItem = PixelSearch($left, $top, $right, $bottom, 0x11213A, 5, 2) ;search Inventory for Magic Items to sell
  305.             If Not @error Then
  306.                   if IsArray($RareItem) then
  307.                         MouseClick ('right', $RareItem[0], $RareItem[1], 1)
  308.                   EndIf  
  309.             EndIf    
  310.          $top -= 40
  311.          $bottom -= 40  
  312.          Next
  313.          $left -= 40
  314.          $right -= 40
  315.       Next
  316.       Sleep(100)
  317.       Send("{SPACE}") ;closes Merchant Window    
  318.    EndFunc
  319.    
  320.    Func GetToCellar()
  321.       MouseClick("middle", 587 * $x_ratio,335* $y_ratio) ;starts the main run
  322.       Sleep(1500)
  323.       Send("2") ;Smoke Screen
  324.       MouseClick("middle", 96 * $x_ratio,383 * $y_ratio)
  325.       Sleep(800)
  326.       Send("1")
  327.       Sleep(1200)
  328.       MouseClick("middle", Round(417 * $x_ratio),Round(422 * $y_ratio)) ;middle of area outside of cellar
  329.       Sleep(100)
  330.       Send("1")
  331.       Sleep(1500)
  332.       Send("3") ;Caltrops
  333.       Sleep(100)
  334.       Send("2") ;Smoke Screen
  335.       MouseMove(Round(115 * $x_ratio),Round(210 * $y_ratio),1) ;moves cursor over to the cellar so the proper blue pixel becomes highlighted   
  336.    EndFunc
  337.    
  338.    Func FightSarkoth()
  339.       Sleep(4500)
  340.       Send(2)
  341.       Sleep(100)
  342.       MouseClick("left",Round(531 *$x_ratio),Round(769 * $y_ratio))
  343.       Sleep(600)
  344.       MouseClick("left",Round(547 *$x_ratio),Round(490 * $y_ratio)) ;moves to doorway leading to rare inside cellar
  345.       Sleep(1500)
  346.       MouseMove(Round(579 * $x_ratio),Round(209 * $y_ratio),1) ;hovers over the rare Sarkoth
  347.       Send(4)
  348.       Sleep(1000)
  349.       Send("{SHIFTDOWN}")
  350.       MouseDown("right") ;attack middle
  351.       Sleep(3800)
  352.       MouseMove(Round(467 * $x_ratio),Round(269 * $y_ratio),1) ;attack left, add more sleep time if you can't kill minion on left
  353.       Sleep(3000)
  354.       MouseMove(Round(682 * $x_ratio),Round(147 * $y_ratio),1) ;attack right
  355.       Sleep(800)
  356.       MouseMove(Round(579 * $x_ratio),Round(209 * $y_ratio),1) ;move back to middle
  357.       Sleep(1000)
  358.       MouseUP("right")
  359.       Sleep(300)
  360.       Send("{SHIFTUP}")
  361.    EndFunc
  362.                      
  363.    Func TogglePause()
  364.     $Run = Not $Run
  365.     While Not $Run
  366.         Sleep(100)
  367.         ToolTip("So far "&$Runs&" Runs: "&$TotalLegendary&" Legendaries, "&$TotalSet&" Sets, "&$TotalRare&" Rares, "&$TotalMagic&" Magic, "&$TotalJunk&" Junks Looted",700, 450)
  368.     WEnd
  369.     ToolTip("")
  370.    EndFunc   ;==>TogglePause
  371.      
  372.     Func Stop() ;to allow the script to stop
  373.         Exit 0
  374.     EndFunc
Advertisement
Add Comment
Please, Sign In to add comment