Moubai

sarkoth modified custom

Jul 2nd, 2012
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 33.54 KB | None | 0 0
  1. ;notAres' DH Gold Script 1.9.3 - 6/18/2012 - New INI option: Identify. Added VendItems() and StashItems() to simplify code and added 2 colors of legendaries to stash (highlighted/not highlighted). Trimmed down all "Area" CheckFor() calls. Fixed CheckFor("ExitGame"). Moves mouse out of the way while looting. Added deaths/cellars to PAUSED tooltip.
  2. ;YOU MUST START THE BOT AT THE RESUME GAME SCREEN!
  3. ;Thread: http://ownedcore.com/forums/diablo-3/diablo-3-bots-programs/354464-goldfarming-notares-sarkoth-dh-gold-script-autoit-script-1920x1080.html
  4. ;;;;;
  5. ;WONT WORK UNLESS MOVE IS BOUND TO MIDDLE MOUSE (Mouse 3) -- NOT MOVE/INTERACT
  6. ;Suggested build: http://us.battle.net/d3/en/calculator/demon-hunter#aRYXVT!aYW!YaaabY
  7. ;Required display mode for cellar detection: "FULLSCREEN WINDOWED"
  8. ;Official supported resolution: 1920x1080
  9. ;;;;;
  10. ;Original by mackus101 @ ownedcore
  11. ;ImageSearch contributions by rvbfreak, goofinator, and asuRob
  12. ;Refactoring and additional functions by Shimizoki
  13.  
  14. ;=========== DO NOT TOUCH ===========;
  15. #RequireAdmin
  16. #include <GUIConstantsEx.au3>
  17. #include <StaticConstants.au3>
  18. #include <WindowsConstants.au3>
  19. Opt('MouseCoordMode', 2)
  20. Opt('PixelCoordMode', 2)
  21. Global $size = WinGetClientSize("[CLASS:D3 Main Window Class]"), $ver = "1.9.3", $ini = "DH.ini", $hFont = 0, $title, $Paused, $Go = False, $i = 0, $gX = 0, $gY = 0, $LegendaryCount = 0, $SetCount = 0, $RareCount = 0, $MagicCount = 0, $GemCount = 0, $TomeCount = 0, $deathCount = 0, $cellarCount = 0, $t = TimerInit(), $rt = 0, $run = 0, $yellow = 0xFFF000, $red = 0xD90000, $lblRun, $lblLocation, $lblStatus, $lblLast, $lblRuntime, $lblGear, $lblItems
  22. For $i = 0 To Random(0, 7, 1)
  23.     $title &= Chr(Random(97, 122, 1))
  24. Next
  25. For $i = 0 To Random(5, 10, 1)
  26.     $title &= Chr(Random(65, 90, 1))
  27. Next
  28. $title &= " "
  29. Global $gems[8] = ["Ru1.png", "Ru2.png", "Em1.png", "Em2.png", "To1.png", "To2.png", "Am1.png", "Am2.png"]
  30. If @OSArch = "X64" Then DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 1)
  31. If @OSArch = "X64" And Not @AutoItX64 Then MsgBox(16, "ERROR", "Why aren't you running the 64-bit AutoIt??? Expect bugs!")
  32. If $size = 0 Then
  33.     MsgBox(16, "Error", "Diablo III is not running, cannot grab resolution!" & @CRLF & "Exiting...")
  34.     Exit
  35. EndIf
  36. ;====================================;
  37.  
  38. ;============= SETTINGS: DONT CHANGE HERE, CHANGE DH.INI =============;
  39. HotKeySet("=", "Begin") ;script toggled on/off by pressing =
  40. HotKeySet("{PAUSE}", "TogglePause") ;script toggle pause by pressing Pause/Break key
  41. HotKeySet("x", "Stop") ;script stopped by pressing x
  42.  
  43. ;Change to match your abilities (1-4 by default)z
  44. $skillCaltrops = "1"
  45. $skillSmokeScreen = "2"
  46. $skillPreparation = "3"
  47. $skillCompanion = "4"
  48.  
  49. $movementSpeed = 25 ;This is the % increase movement speed you have. 25 = 25%, 0 = 0% (25% is the movement cap but SS + Displacement avg = 32%)
  50.  
  51. ;Custom Loot
  52. $pngLoc = "@ScriptDir" ;Location of the .PNGs (NO SUBFOLDERS - ALL PNGS GO HERE)
  53. $totalItems = 1 ;Number of items in the pick array
  54. Global $pick[$totalItems] ;DONT CHANGE THIS
  55.  
  56. ;Array of items to loot (GEMS AND TOMES ALREADY INCLUDED)
  57. $pick[0] = "mythic.png|40" ;png|Tolerance
  58. ;$pick[1] = "item2.png|0"
  59. ;$pick[2] = "item3.png|0"
  60.  
  61. ;Looting
  62. $LootSets = "True" ;True if you want to pick up Sets
  63. $LootLegendaries = "True";True if you want to pick up Legendaries
  64. $LootRares = "True" ;True if you want to pick up Rares
  65. $LootMagic = "True" ;True if you want to pick up Magic
  66. $LootGems = "True" ;True if you want to pick up Gems
  67. $LootTomes = "True" ;True if you want to pick up Tome of Secrets
  68. $LootCustom = "False" ;True if you want to pick up Custom Items (The items in the $pick array above)
  69.  
  70. ;Manage Loot
  71. $Identify = "True" ;True to enable identifying items before stashing/vendoring
  72. $mLoot = 5 ;Nuber of successful runs until Stash and Vendor
  73. $mLootOff = 2 ;Stash and Vendor after mLoot +- X number of runs (Variability)
  74.  
  75. ;Stashing
  76. $StashLoot = "True" ;True if you want to store Items in the stash
  77. ;---
  78. $StashLegendary = "True";True if you want to store Legendary items in the stash
  79. $StashRare = "True" ;True if you want to store Rare items in the stash
  80. $StashMagic = "False" ;True if you want to store Magic items in the stash
  81. $StashTomes = "True" ;True if you want to store Tomes items in the stash
  82. $StashCustom = "True" ;True if you want to store rings
  83. $StashGems = "True" ;True if you want to store Gems items in the stash
  84.  
  85. ;Vendoring ==NEW SETTINGS==
  86. $VendorLoot = "True" ;True if you want to vendor anything
  87. ;---
  88. $VendorRare = "True" ;True if you want to vendor Rares
  89. $VendorMagic = "True" ;True if you want to vendor Magic
  90. $vendorAll = "False" ;True if you want to right click all items when talking to vendor
  91. $vendorRows = 5 ;# of rows to vendor, starting from the top (default = 5: bottom row is safe)
  92. $vendorCols = 10 ;# of columns to vendor, starting from left
  93.  
  94. ;Variability ==NEW SETTINGS==
  95. $Timer = "True" ;True and the bot will add random sleep intervals
  96. ;---
  97. $attackTime = 3900 ;Time (in ms) the script will shoot sarkoth with the right button
  98. $attackMulti = "True" ;True if you want to shoot both left and right in addition to the middle (False for Lightning Ball)
  99. $walktime = 2800 ;Time (in ms) the script waits for you to enter and load the cellar. Slow this down for slower move speeds and loading times
  100. $loadtime = 3400 ;Time (in ms) the script waits for the game to load before it starts pathfinding. Slow this down for slower hard drives
  101. $tptime = 6900 ;Time (in ms) the script waits for teleport before exiting the game
  102. ;====================================;
  103.  
  104. $x_ratio = $size[0] / 1920
  105. $y_ratio = $size[1] / 1080
  106. If FileExists($ini) Then
  107.     Call("ReadINI")
  108.     Call("CreateINI")
  109. Else
  110.     Call("CreateINI")
  111. EndIf
  112.  
  113. If $pngLoc == "@ScriptDir" Then $pngLoc = @ScriptDir & "\pics\"
  114. If $totalItems < 1 Then $LootCustom = "False"
  115. $mLootIn = $mLoot
  116. $movementSpeed = 1 + ($movementSpeed / 100)
  117. $VersionsInfo = "http://dl.dropbox.com/u/9955791/version.ini"
  118. $oldVersion = IniRead("updater.ini", "Version", "Version", $ver)
  119. $newVersion = "0.0"
  120.  
  121. If Not FileExists($pngLoc & "MainMenu.png") Then
  122.     MsgBox(16, "Fatal Error", "FATAL ERROR: Cannot find: " & $pngLoc & "MainMenu.png" & @CRLF & "Make sure your directory is set properly in the script")
  123.     Exit
  124. EndIf
  125.  
  126. Call("SetupGUI")
  127. Call("DoUpdate")
  128.  
  129. While 1
  130.     Call("RestartRun")
  131. WEnd
  132.  
  133. Func RestartRun()
  134.     If ($Go) Then
  135.         $i = 0
  136.         WinSetTitle($title, "", $title & $ver & " - Running")
  137.         MouseMove(Round(Random(0, 400) * $x_ratio), Round(Random(700, 1080) * $y_ratio), 3) ;Moves mouse out of the way
  138.         ;Checks if the player is Dead/Logout/Window, then if in Main Menu, etc.
  139.         If CheckDead() Then
  140.             Return
  141.         ElseIf CheckFor("ExitGame", "", Round(860 * $x_ratio), Round(400 * $y_ratio), Round(1040 * $x_ratio), Round(450 * $y_ratio), 0.5, 140) Then
  142.             GUICtrlSetData($lblStatus, "Status: Exit window up")
  143.             MouseClick("left", Round(1064 * $x_ratio), Round(632 * $y_ratio))
  144.             Sleep(100)
  145.             Send("{SPACE}")
  146.             Return
  147.         ElseIf CheckFor("MainMenu", "", Round(40 * $x_ratio), Round(300 * $y_ratio), Round(440 * $x_ratio), Round(550 * $y_ratio)) Then
  148.             GUICtrlSetData($lblRun, "Run Nbr: " & $run & " - Runs vendor: " & $mLootIn)
  149.             GUICtrlSetData($lblLocation, "Location: Main Menu")
  150.             GUICtrlSetData($lblStatus, "Status: Starting Game")
  151.             RandClick("left", Round(230 * $x_ratio), Round(416 * $y_ratio), 120, 20, 1, 6) ;Random Click on the resume button
  152.             Sleep($loadtime)
  153.             $rt = TimerInit()
  154.             $run += 1
  155.         ElseIf CheckFor("OldRuins", "Area") Or CheckFor("NewTristram", "Area") Or CheckFor("DankCellar", "Area") Then
  156.             Call("TownPortal")
  157.             Call("LeaveGame")
  158.             Return
  159.         ElseIf CheckFor("LimitError", "", Round(700 * $x_ratio), Round(340 * $y_ratio), Round(1200 * $x_ratio), Round(600 * $y_ratio), 1, 140) Then
  160.             MouseClick("left", Round(960 * $y_ratio), Round(635 * $x_ratio))
  161.             $rand = Random(40000, 80000)
  162.             GUICtrlSetData($lblStatus, "Status: Input Limit - Waiting " & Round($rand / 1000) & " seconds.")
  163.             Sleep($rand)
  164.             Send("{SPACE}")
  165.             Return
  166.         ElseIf CheckFor("Disconnect", "", Round(700 * $x_ratio), Round(340 * $y_ratio), Round(1200 * $x_ratio), Round(600 * $y_ratio), 1, 140) Then
  167.             GUICtrlSetData($lblStatus, "Status: Network Disconnect window up")
  168.             MouseClick("left", Round(960 * $x_ratio), Round(632 * $y_ratio))
  169.             Sleep(100)
  170.             Send("{SPACE}")
  171.             Return
  172.         Else
  173.             GUICtrlSetData($lblStatus, "ERROR: Cannot find Resume button")
  174.             Return
  175.         EndIf
  176.         ;Make sure we are in the right area before beginning run
  177.         If CheckFor("OldRuins", "Area") Then
  178.             Sleep(200)
  179.             GUICtrlSetData($lblLocation, "Location: Old Ruins")
  180.             Call("CheckRepair")
  181.             ;Start Run
  182.             RandClick("middle", Round(500 * $x_ratio), Round(250 * $y_ratio), 2, 2) ;starts the run [waypoint 1]
  183.             Moving(900)
  184.             Send($skillSmokeScreen)
  185.             Moving(600)
  186.             RandClick("middle", Round(3 * $y_ratio), Round(370 * $y_ratio), 2, 2) ;waits ~1 second then [waypoint 2]
  187.             Moving(1850)
  188.             RandClick("middle", Round(400 * $x_ratio), Round(600 * $y_ratio), 2, 2) ;middle of courtyard [waypoint 3]
  189.             Moving(100)
  190.             Send($skillSmokeScreen)
  191.             Moving(100)
  192.             Send($skillPreparation)
  193.             Moving(750)
  194.             Send($skillCaltrops)
  195.             Moving(100)
  196.             RandMove(Round(300 * $x_ratio), Round(70 * $y_ratio), 1, 1) ;moves cursor over to the cellar so the proper blue pixel becomes highlighted
  197.             Sleep(350)
  198.             If CheckDead() Then
  199.                 Return
  200.             EndIf
  201.  
  202.             ;Checks if Dank Cellar is Open
  203.             $Pixel2 = PixelSearch(0, 0, Round(600 * $x_ratio), Round(600 * $y_ratio), 0x334FB7, 3)
  204.             If Not @error Then
  205.                 GUICtrlSetData($lblStatus, "Status: Cellar - Found")
  206.                 $cellarCount += 1
  207.                 MouseClick("left", Round(300 * $x_ratio), Round(70 * $y_ratio), 1) ;Entrance to cellar
  208.                 Sleep(800 * $movementSpeed)
  209.                 Send($skillSmokeScreen)
  210.                 Moving($walktime)
  211.             Else ;ABORT RUN
  212.                 GUICtrlSetData($lblStatus, "Status: Cellar - Not Found" & @CRLF)
  213.                 Sleep(10)
  214.                 RandClick("middle", Round(1100 * $x_ratio), Round(600 * $y_ratio)) ;moves between caltrops for safety before teleporting back to town
  215.                 Moving(250)
  216.                 Send($skillCaltrops)
  217.                 Sleep(620)
  218.                 Send($skillSmokeScreen)
  219.                 Sleep(40)
  220.                 Call("TownPortal")
  221.                 If Not CheckDead() Then
  222.                     Call("LeaveGame")
  223.                 EndIf
  224.                 Return
  225.             EndIf
  226.         Else
  227.             Call("TownPortal")
  228.             If Not CheckDead() Then
  229.                 Call("LeaveGame")
  230.             EndIf
  231.             Return
  232.         EndIf
  233.  
  234.         ;Checks that the player is in the Dank Cellar
  235.         If CheckFor("DankCellar", "Area") Then
  236.             GUICtrlSetData($lblLocation, "Location: Dank Cellar")
  237.             RandClick("middle", Round(110 * $x_ratio), Round(1000 * $y_ratio), 1, 1) ;moves to doorway leading to rare inside cellar
  238.             Sleep(Random(2200, 2800))
  239.             RandMove(Round(460 * $x_ratio), Round(80 * $y_ratio), 1, 1) ;hovers over the rare Sarkoth
  240.             Sleep(10)
  241.             Send("{SHIFTDOWN}")
  242.             GUICtrlSetData($lblStatus, "Status: Attacking Sarkoth")
  243.             MouseDown("right") ;ATTACK
  244.             Sleep(1100)
  245.             Send($skillCompanion)
  246.             Sleep($attackTime)
  247.             MouseUp("right")
  248.             RandClick("left", Round(460 * $x_ratio), Round(80 * $y_ratio), 1, 1)
  249.             RandMove(Round(240 * $x_ratio), Round(75 * $y_ratio), 1, 1) ;attack left
  250.             Sleep(40)
  251.             MouseDown("right")
  252.             If $attackMulti == True Then Sleep($attackTime / 2)
  253.             MouseUp("right")
  254.             MouseMove(Round(590 * $x_ratio), Round(50 * $y_ratio), 1) ;attack right
  255.             MouseDown("right")
  256.             If $attackMulti == True Then Sleep($attackTime / 2)
  257.             MouseUp("right")
  258.             MouseDown("left")
  259.             MouseMove(Round(Random(240, 260) * $x_ratio), Round(75 * $y_ratio), 1) ;attack left
  260.             If $attackMulti == True Then Sleep($attackTime / 2.5)
  261.             MouseMove(Round(Random(560, 600) * $x_ratio), Round(50 * $y_ratio), 1) ;attack right
  262.             If $attackMulti == True Then Sleep($attackTime / 2.5)
  263.             MouseUp("left")
  264.             Sleep(400)
  265.             MouseClick("right", Round(630 * $x_ratio), Round(18 * $y_ratio), 1, 8) ;break the table & chair
  266.             Sleep(200)
  267.             Send("{SHIFTUP}")
  268.             Moving(200)
  269.             RandClick("middle", Round(530 * $x_ratio), Round(190 * $y_ratio)) ;location of sarkoth after death
  270.             Moving(2700)
  271.             GUICtrlSetData($lblStatus, "Status: Looting")
  272.             Send($skillCompanion)
  273.             Call("Loot")
  274.             RandSleep(0, 6, 30)
  275.             Send($skillCompanion)
  276.             Call("TownPortal")
  277.         Else
  278.             Send($skillCaltrops)
  279.             Sleep(400)
  280.             Send($skillSmokeScreen)
  281.             Sleep(40)
  282.             Call("TownPortal")
  283.             If Not CheckDead() Then
  284.                 Call("LeaveGame")
  285.             EndIf
  286.             Return
  287.         EndIf
  288.         ;After successful run
  289.         If Not CheckDead() Then
  290.             Sleep(600)
  291.             If $mLootIn = 1 And CheckFor("NewTristram", "Area") Then ;If its time to manage loot and we are in town
  292.                 If $Identify == True Then Call("Identify")
  293.                 If $StashLoot == True Then
  294.                     Call("StashLoot")
  295.                 EndIf
  296.                 If $VendorLoot == True Then
  297.                     Call("VendorLoot")
  298.                 EndIf
  299.                 $mLootIn = Round(Random($mLoot - $mLootOff, $mLoot + $mLootOff)) ;Reset Counter
  300.             ElseIf Not CheckFor("NewTristram", "Area") Then
  301.                 GUICtrlSetData($lblStatus, "Status: Skipping vendor, not in New Tristram")
  302.                 Sleep(3000)
  303.             ElseIf $mLootIn <= 0 Then
  304.                 $mLootIn = 1
  305.             Else
  306.                 $mLootIn -= 1
  307.             EndIf
  308.             If Not CheckDead() Then
  309.                 Call("LeaveGame")
  310.             EndIf
  311.             Return
  312.         Else
  313.             Return
  314.         EndIf
  315.     EndIf
  316. EndFunc   ;==>RestartRun
  317.  
  318. ;Helper Functions
  319.  
  320. Func SetupGUI()
  321.     $frmBot = GUICreate($title & $ver & " - Updating", 280, 121, Round(1540 * $x_ratio), Round(920 * $y_ratio), -1, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW), 0)
  322.     GUISetBkColor(0xC0C0C0)
  323.     $lblRun = GUICtrlCreateLabel("Run Nbr 0 - Runs vendor: 0", 4, 0, 280, 24)
  324.     GUICtrlSetFont(-1, 10, 600, 0, "Segoe UI")
  325.     GUICtrlSetColor(-1, 0xFF0000)
  326.     $lblLocation = GUICtrlCreateLabel("Location: Main Menu", 12, 20, 240, 17)
  327.     $lblStatus = GUICtrlCreateLabel("Status: ", 12, 35, 240, 17)
  328.     $lblLast = GUICtrlCreateLabel("Last Runtime: 0 seconds", 12, 50, 240, 17)
  329.     $lblRuntime = GUICtrlCreateLabel("Total Runtime: 0 hours, 0 minutes", 12, 65, 240, 17)
  330.     $lblGear = GUICtrlCreateLabel("Legendary: 0 - Set: 0 - Rare: 0", 12, 80, 240, 17)
  331.     $lblItems = GUICtrlCreateLabel("Magic: 0 - Gems: 0 - Tomes: 0", 12, 95, 240, 17)
  332.     GUISetState(@SW_SHOW)
  333. EndFunc   ;==>SetupGUI
  334.  
  335. Func CheckDead()
  336.     $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
  337.     If Not @error Then
  338.         GUICtrlSetData($lblStatus, "Status: Logging out")
  339.         Sleep(11000)
  340.         Sleep($loadtime)
  341.         Return 1
  342.     EndIf
  343.  
  344.     $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
  345.     If Not @error Then
  346.         GUICtrlSetData($lblStatus, "Status: Open Window")
  347.         Sleep(200)
  348.         Send("{SPACE}") ;close any open windows
  349.         Return 1
  350.     EndIf
  351.  
  352.     $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"
  353.     If Not @error Then
  354.         GUICtrlSetData($lblStatus, "Status: Dead")
  355.         $deathCount += 1
  356.         Call("LeaveGame")
  357.         Sleep(11000)
  358.         Sleep($loadtime)
  359.         Return 1
  360.     Else
  361.         Return 0
  362.     EndIf
  363. EndFunc   ;==>CheckDead
  364.  
  365. Func CheckRepair()
  366.     $RepairArea = PixelSearch(Round(1480 * $x_ratio), 0, Round(1570 * $x_ratio), Round(100 * $y_ratio), $yellow)
  367.     If Not @error Then
  368.         Call("DoRepair")
  369.     EndIf
  370.     $RepairAreaRed = PixelSearch(Round(1480 * $x_ratio), 0, Round(1570 * $x_ratio), Round(100 * $y_ratio), $red)
  371.     If Not @error Then
  372.         Call("DoRepair")
  373.     EndIf
  374. EndFunc   ;==>CheckRepair
  375.  
  376. Func DoRepair()
  377.     Sleep(Random(75, 150))
  378.     Call("TownPortal")
  379.     If CheckDead() Then
  380.         Return
  381.     EndIf
  382.     If CheckFor("NewTristram", "Area") Then
  383.         RandClick("left", Round(1480 * $x_ratio), Round(281 * $y_ratio), 1, 1) ;begin movement towards merchant
  384.         Moving(1875)
  385.         RandClick("left", Round(1316 * $x_ratio), Round(206 * $y_ratio), 1, 1) ;moves to get merchant in screen
  386.         Moving(1875)
  387.         RandClick("left", Round(845 * $x_ratio), Round(225 * $y_ratio), 1, 1) ;NPC Merchant to the right of cain's home
  388.         Sleep(1200)
  389.         RandClick("left", Round(521 * $x_ratio), Round(506 * $y_ratio), 1, 1) ;button to open up repair menu
  390.         Sleep(400)
  391.         RandClick("left", Round(260 * $x_ratio), Round(595 * $y_ratio), 1, 1) ;button to pay for repairs
  392.         Sleep(200)
  393.         Send("{Escape}")
  394.         If Not CheckDead() Then
  395.             Call("LeaveGame")
  396.         EndIf
  397.     EndIf
  398. EndFunc   ;==>DoRepair
  399.  
  400. Func CalcTime()
  401.     $srt = TimerDiff($rt)
  402.     GUICtrlSetData($lblLast, "Last Runtime: " & Round($srt / 1000, 2) & " seconds.")
  403.     $trt = TimerDiff($t)
  404.     $total = Round((($trt / 1000) / 60) / 60, 4)
  405.  
  406.     ;Total runtime calculation.
  407.     $hours = Floor((($trt / 1000) / 60) / 60)
  408.     $minutes = (($trt / 1000) / 60)
  409.     ;trim minutes if runtime is more then 1 hour.
  410.     If $minutes > 60 Then
  411.         While $minutes > 60
  412.             $minutes -= 60
  413.         WEnd
  414.     EndIf
  415.     GUICtrlSetData($lblRuntime, "Total Runtime: " & $hours & " hours, " & Ceiling($minutes) & " minutes")
  416. EndFunc   ;==>CalcTime
  417.  
  418. Func CheckFor($img, $type = "", $startX = 0, $startY = 0, $endX = @DesktopWidth, $endY = @DesktopHeight, $seconds = 6, $tolerance = 140)
  419.     If $type = "Area" Then
  420.         $startX = 1500 * $x_ratio
  421.         $startY = 0 * $y_ratio
  422.         $endX = 1920 * $x_ratio
  423.         $endY = 90 * $y_ratio
  424.         $seconds = 2.5
  425.     EndIf
  426.     $c = 0
  427.     $string = $pngLoc & $img & ".png"
  428.     Do
  429.         $c += 1
  430.         Sleep(100)
  431.         If $c > ($seconds * 10) Then ;Make sure we never get stuck here for infinity.
  432.             If $type = "Area" Then
  433.                 GUICtrlSetData($lblStatus, "Status: Area not found - " & $img)
  434.             EndIf
  435.             Return False
  436.         EndIf
  437.     Until _ImageSearchArea($string, 1, $startX, $startY, $endX, $endY, $gX, $gY, $tolerance)
  438.     Return True
  439. EndFunc   ;==>CheckFor
  440.  
  441. Func Loot()
  442.     Sleep(Random(500, 1200))
  443.     MouseMove(Round(Random(0, 400) * $x_ratio), Round(Random(700, 1080) * $y_ratio), 3) ;Moves mouse out of the way
  444.     If $LootSets == True Then
  445.         $SetCount += LootGear(0x02CE01)
  446.     EndIf
  447.     If $LootLegendaries == True Then
  448.         $LegendaryCount += LootGear(0xBF642F, 0)
  449.     EndIf
  450.     If $LootRares == True Then
  451.         $RareCount += LootGear(0xBBBB00)
  452.     EndIf
  453.     If $LootGems == True Then
  454.         Call("LootGems")
  455.     EndIf
  456.     If $LootTomes == True Then
  457.         Call("LootTomes")
  458.     EndIf
  459.     If $LootCustom == True Then
  460.         Call("LootCustom")
  461.     EndIf
  462.     If $LootMagic == True Then
  463.         $MagicCount += LootGear(0x6969FF)
  464.     EndIf
  465.     Call("ShowLoot")
  466. EndFunc   ;==>Loot
  467.  
  468. Func LootGear($color, $tolerance = 2)
  469.     $count = 0
  470.     $Loot = PixelSearch(Round(400 * $x_ratio), 0, Round(1690 * $x_ratio), Round(900 * $y_ratio), $color, $tolerance)
  471.     If Not @error Then
  472.         While Not @error
  473.             $count += 1
  474.             MouseClick('left', $Loot[0], $Loot[1], 1, 3)
  475.             Sleep(50)
  476.             MouseMove(Round(Random(0, 400) * $x_ratio), Round(Random(700, 1080) * $y_ratio), 3) ;Moves mouse out of the way
  477.             Sleep(1000)
  478.             ;Run at max 10 times per quality
  479.             If $count >= 10 Then
  480.                 ExitLoop
  481.             EndIf
  482.             $Loot = PixelSearch(Round(400 * $x_ratio), 0, Round(1690 * $x_ratio), Round(900 * $y_ratio), $color, $tolerance)
  483.         WEnd
  484.     EndIf
  485.     Return $count
  486. EndFunc   ;==>LootGear
  487.  
  488. Func LootCustom()
  489.     $count = 0
  490.     $gX = 0
  491.     $gY = 0
  492.     For $i = 0 To ($totalItems - 1)
  493.         $array = StringSplit($pick[$i], "|")
  494.         $file = $array[1]
  495.         $accuracy = $array[2]
  496.         $urlString = $pngLoc & $file
  497.         While _ImageSearchArea($pngLoc & "Custom.png", 1, 0, 0, @DesktopWidth, @DesktopHeight, $gX, $gY, $accuracy)
  498.             $count += 1
  499.             MouseClick("left", $gX, $gY, 1, 3)
  500.             Sleep(50)
  501.             MouseMove(Round(Random(0, 400) * $x_ratio), Round(Random(700, 1080) * $y_ratio), 3) ;Moves mouse out of the way
  502.             Sleep(1000)
  503.             If $count >= 10 Then
  504.                 ExitLoop
  505.             EndIf
  506.         WEnd
  507.     Next
  508. EndFunc   ;==>LootCustom
  509.  
  510. Func LootGems()
  511.     $count = 0
  512.     $gX = 0
  513.     $gY = 0
  514.     While _ImageSearchArea($pngLoc & "square.png", 1, 0, 0, @DesktopWidth, @DesktopHeight, $gX, $gY, 90)
  515.         $count += 1
  516.         MouseClick("left", $gX, $gY - 3, 1, 3)
  517.         Sleep(50)
  518.         MouseMove(Round(Random(0, 400) * $x_ratio), Round(Random(700, 1080) * $y_ratio), 3) ;Moves mouse out of the way
  519.         $GemCount += 1
  520.         Sleep(1000)
  521.         If $count >= 10 Then
  522.             ExitLoop
  523.         EndIf
  524.     WEnd
  525. EndFunc   ;==>LootGems
  526.  
  527. Func LootTomes()
  528.     $count = 0
  529.     $gX = 0
  530.     $gY = 0
  531.     While _ImageSearchArea($pngLoc & "tome.png", 1, 0, 0, @DesktopWidth, @DesktopHeight, $gX, $gY, 90)
  532.         $count += 1
  533.         MouseClick("left", $gX, $gY - 3, 1, 3)
  534.         Sleep(50)
  535.         MouseMove(Round(Random(0, 400) * $x_ratio), Round(Random(700, 1080) * $y_ratio), 3) ;Moves mouse out of the way
  536.         $TomeCount += 1
  537.         Sleep(1000)
  538.         If $count >= 10 Then
  539.             ExitLoop
  540.         EndIf
  541.     WEnd
  542. EndFunc   ;==>LootTomes
  543.  
  544. Func Identify()
  545.     Send("c")
  546.     Sleep(1300)
  547.     While _ImageSearchArea($pngLoc & "unidentified.png", 1, 1400 * $x_ratio, 580 * $y_ratio, 1914 * $x_ratio, 888 * $y_ratio, $gX, $gY, 120)
  548.         GUICtrlSetData($lblStatus, "Status: Identifying")
  549.         MouseClick("right", $gX, $gY, 1, 4)
  550.         MouseMove(Round(Random(0, 400) * $x_ratio), Round(Random(700, 1080) * $y_ratio), 3) ;Moves mouse out of the way
  551.         Sleep(Random(3000, 3500))
  552.     WEnd
  553.     Send("c")
  554.     Sleep(200)
  555. EndFunc   ;==>Identify
  556.  
  557. Func StashLoot()
  558.     GUICtrlSetData($lblStatus, "Status: Putting Items in Stash")
  559.     MouseClick("left", 1064 * $x_ratio, 256 * $y_ratio)
  560.     Moving(1600)
  561.  
  562.     ;Tomes
  563.     While $StashTomes == True
  564.         Sleep(Random(100, 300))
  565.         If _ImageSearchArea($pngLoc & "TomeIcon.png", 1, 1400 * $x_ratio, 580 * $y_ratio, 1914 * $x_ratio, 888 * $y_ratio, $gX, $gY, 140) Then
  566.             GUICtrlSetData($lblStatus, "Status: Stashing Tomes")
  567.             MouseClick("left", 500 * $x_ratio, 360 * $y_ratio, 1, 4)
  568.             MouseClick("right", $gX, $gY, 1, 4)
  569.             Sleep(80)
  570.             MouseClick("left", 500 * $x_ratio, 200 * $y_ratio, 1, 4)
  571.         Else
  572.             ExitLoop
  573.         EndIf
  574.     WEnd
  575.  
  576.     If $StashLegendary == True Then
  577.         StashItems(0xFF7F00, 0)
  578.         StashItems(0x8F5C25, 1)
  579.     EndIf
  580.  
  581.     If $StashRare == True Then
  582.         StashItems(0x4A3C0B, 1)
  583.     EndIf
  584.     If $StashCustom == True Then
  585.         StashItems(0x182037, 1)
  586.     EndIf
  587.     If $StashMagic == True Then
  588.         StashItems(0x182037, 1)
  589.     EndIf
  590.    
  591.  
  592.  
  593.     ;Gems (DOESN'T STASH BOTTOM ROW!)
  594.     If $StashGems == True Then
  595.         GUICtrlSetData($lblStatus, "Status: Stashing Gems")
  596.         MouseClick("left", 500 * $x_ratio, 200 * $y_ratio, 1, 4)
  597.         Sleep(Random(20, 100))
  598.         For $i = 0 To 7
  599.             If _ImageSearchArea($pngLoc & $gems[$i], 1, 1400 * $x_ratio, 580 * $y_ratio, 1914 * $x_ratio, 820 * $y_ratio, $gX, $gY, 140) Then
  600.                 MouseClick("right", $gX, $gY, 1, 3)
  601.             EndIf
  602.         Next
  603.     EndIf
  604.     Sleep(Random(1000, 1500))
  605.     Send("{SPACE}")
  606. EndFunc   ;==>StashLoot
  607.  
  608. Func VendorLoot()
  609.     GUICtrlSetData($lblStatus, "Status: Vendoring Items")
  610.     If Not $StashLoot == True Then ;Move from TP towards vendor
  611.         Sleep(Random(300, 500))
  612.         MouseClick("middle", 1565 * $x_ratio, 50 * $y_ratio)
  613.     Else ;Move from Stash towards vendor
  614.         Sleep(Random(300, 500))
  615.         MouseClick("middle", 1560 * $x_ratio, 120 * $y_ratio)
  616.     EndIf
  617.     Moving(3000)
  618.     MouseClick("left", 1030 * $x_ratio, 210 * $y_ratio) ;Talk to vendor
  619.     Moving(3000)
  620.  
  621.     ;All
  622.     If $vendorAll == True Then
  623.         For $c = 1 To $vendorCols
  624.             For $r = 1 To $vendorRows
  625.                 RandClick("right", (((($c - 1) * 50) + 32 + 1400) * $x_ratio), (((($r - 1) * 51) + 32 + 580) * $y_ratio), 2, 2, 1, 2.5)
  626.             Next
  627.         Next
  628.     EndIf
  629.  
  630.     ;Rares
  631.     If $VendorRare == True Then
  632.         VendItems(0x4A3C0B, 1)
  633.     EndIf
  634.  
  635.     ;Magic
  636.     If $VendorMagic == True Then
  637.         VendItems(0x182037, 1)
  638.     EndIf
  639.  
  640.     Sleep(200)
  641.     RandClick("left", Round(521 * $x_ratio), Round(506 * $y_ratio), 1, 1) ;button to open up repair menu
  642.     Sleep(300)
  643.     RandClick("left", Round(260 * $x_ratio), Round(595 * $y_ratio), 1, 1) ;button to pay for repairs
  644.     Sleep(200)
  645.     GUICtrlSetData($lblStatus, "Status: Done With Vendor")
  646.     Send("{ESCAPE}")
  647. EndFunc   ;==>VendorLoot
  648.  
  649. Func StashItems($color, $tolerance)
  650.     $c = 0
  651.     While $c <= 20
  652.         Sleep(Random(20, 100))
  653.         $StashPixel = PixelSearch(1400 * $x_ratio, 580 * $y_ratio, 1914 * $x_ratio, 888 * $y_ratio, $color, $tolerance)
  654.         If Not @error Then
  655.             MouseClick("right", $StashPixel[0] + 4, $StashPixel[1], 1, 4)
  656.             $c += 1
  657.         Else
  658.             ExitLoop
  659.         EndIf
  660.     WEnd
  661. EndFunc   ;==>StashItems
  662.  
  663. Func VendItems($color, $tolerance)
  664.     $c = 0
  665.     While $c <= 20
  666.         Sleep(Random(20, 100))
  667.         $VendPixel = PixelSearch(1400 * $x_ratio, 580 * $y_ratio, 1914 * $x_ratio, 888 * $y_ratio, $color, $tolerance)
  668.         If Not @error Then
  669.             MouseClick("right", $VendPixel[0], $VendPixel[1], 1, 4)
  670.             $c += 1
  671.         Else
  672.             ExitLoop
  673.         EndIf
  674.     WEnd
  675. EndFunc   ;==>VendItems
  676.  
  677. Func DoUpdate()
  678.     $ini = InetGet($VersionsInfo, @ScriptDir & "\version.ini") ;download version.ini
  679.     If $ini = 0 Then ;was the download of version.ini successful?
  680.         MsgBox(16, "Fatal Error", "The server seems to be offline. No update will be done.")
  681.     Else
  682.         $newVersion = IniRead(@ScriptDir & "\version.ini", "Version", "Version", "") ;reads the new version out of version.ini
  683.         If $newVersion = $oldVersion Then ;compare old and new
  684.             ;MsgBox (0,"No update","There is no update available!")
  685.             FileDelete(@ScriptDir & "\version.ini")
  686.         Else
  687.             $msg = MsgBox(68, "Update", "A new version is available: " & $newVersion & "! Current version: " & $oldVersion & @CRLF & "Do you want to download the new version?")
  688.             If $msg = 7 Then ;No was pressed
  689.                 FileDelete(@ScriptDir & "\version.ini")
  690.             ElseIf $msg = 6 Then ;OK was pressed
  691.                 $downloadLink = IniRead(@ScriptDir & "\version.ini", "Version", "download", "NotFound")
  692.                 $dlhandle = InetGet($downloadLink, @ScriptDir & "\Update_" & $newVersion & ".zip", 1, 1)
  693.                 ProgressOn("Update", "Downloading Updates", "", -1, -1, 16) ;creates a progressbar
  694.  
  695.                 $size = InetGetSize($downloadLink, 1) ;get the size of the update
  696.                 While Not InetGetInfo($dlhandle, 2)
  697.                     $Percent = Round((InetGetInfo($dlhandle, 0) / $size) * 100)
  698.                     ProgressSet($Percent, $Percent & "%") ;update progressbar
  699.                     Sleep(1)
  700.                 WEnd
  701.                 ProgressSet(100, "Done", "Complete") ;show complete progressbar
  702.                 Sleep(500)
  703.                 ProgressOff() ;close progress window
  704.                 IniWrite("updater.ini", "version", "version", $newVersion)
  705.                 InetClose($dlhandle)
  706.                 $iniMsg = IniRead(@ScriptDir & "\version.ini", "Version", "message", "Exiting...")
  707.                 MsgBox(64, "Success", "Download Complete!" & @CRLF & "Please restart the bot by extracting the Au3 from Update_" & $newVersion & ".zip" & @CRLF & $iniMsg)
  708.                 FileDelete(@ScriptDir & "\version.ini")
  709.                 Exit
  710.             EndIf
  711.         EndIf
  712.     EndIf
  713.     WinSetTitle($title, "", $title & $ver & " - Waiting")
  714. EndFunc   ;==>DoUpdate
  715. Func ReadINI()
  716.     $pngLoc = IniRead($ini, "Custom Loot", "PNG Location", $pngLoc)
  717.     $totalItems = IniRead($ini, "Custom Loot", "Total Items", $totalItems)
  718.     $skillCaltrops = IniRead($ini, "Skills", "Caltrops", $skillCaltrops)
  719.     $skillSmokeScreen = IniRead($ini, "Skills", "SmokeScreen", $skillSmokeScreen)
  720.     $skillPreparation = IniRead($ini, "Skills", "Preparation", $skillPreparation)
  721.     $skillCompanion = IniRead($ini, "Skills", "Companion", $skillCompanion)
  722.     $movementSpeed = IniRead($ini, "Additional", "Movement Speed", $movementSpeed)
  723.     $walktime = IniRead($ini, "Additional", "Walk Time", $walktime)
  724.     $loadtime = IniRead($ini, "Additional", "Load Time", $loadtime)
  725.     $tptime = IniRead($ini, "Additional", "Teleport Time", $tptime)
  726.     $LootSets = IniRead($ini, "Looting", "Sets", $LootSets)
  727.     $LootLegendaries = IniRead($ini, "Looting", "Legendaries", $LootLegendaries)
  728.     $LootRares = IniRead($ini, "Looting", "Rares", $LootRares)
  729.     $LootMagic = IniRead($ini, "Looting", "Magic", $LootMagic)
  730.     $LootGems = IniRead($ini, "Looting", "Gems", $LootGems)
  731.     $LootTomes = IniRead($ini, "Looting", "Tomes", $LootTomes)
  732.     $LootCustom = IniRead($ini, "Looting", "Custom", $LootCustom)
  733.     $mLoot = IniRead($ini, "ManageLoot", "Every", $mLoot)
  734.     $Identify = IniRead($ini, "ManageLoot", "Identify", $Identify)
  735.     $StashLoot = IniRead($ini, "Stashing", "Loot", $StashLoot)
  736.     $StashLegendary = IniRead($ini, "Stashing", "Legendaries", $StashLegendary)
  737.     $StashRare = IniRead($ini, "Stashing", "Rares", $StashRare)
  738.     $StashMagic = IniRead($ini, "Stashing", "Magic", $StashMagic)
  739.     $StashTomes = IniRead($ini, "Stashing", "Tomes", $StashTomes)
  740.     $StashCustom = IniRead($ini, "Stashing", "Custom", $StashCustom)
  741.     $StashGems = IniRead($ini, "Stashing", "Gems", $StashGems)
  742.     $VendorLoot = IniRead($ini, "Vendoring", "Loot", $VendorLoot)
  743.     $VendorRare = IniRead($ini, "Vendoring", "Rares", $VendorRare)
  744.     $VendorMagic = IniRead($ini, "Vendoring", "Magic", $VendorMagic)
  745.     $vendorAll = IniRead($ini, "Vendoring", "All", $vendorAll)
  746.     $vendorRows = IniRead($ini, "Vendoring", "All-Rows", $vendorRows)
  747.     $vendorCols = IniRead($ini, "Vendoring", "All-Cols", $vendorCols)
  748.     $Timer = IniRead($ini, "Variability", "Timer", $Timer)
  749.     $mLootOff = IniRead($ini, "Variability", "Manage Off By", $mLootOff)
  750.     $attackTime = IniRead($ini, "Variability", "Attack Time", $attackTime)
  751.     $attackMulti = IniRead($ini, "Variability", "Attack Multiple", $attackMulti)
  752. EndFunc   ;==>ReadINI
  753. Func CreateINI()
  754.     IniWrite($ini, "Custom Loot", "PNG Location", $pngLoc)
  755.     IniWrite($ini, "Custom Loot", "Total Items", $totalItems)
  756.     IniWrite($ini, "Skills", "Caltrops", $skillCaltrops)
  757.     IniWrite($ini, "Skills", "SmokeScreen", $skillSmokeScreen)
  758.     IniWrite($ini, "Skills", "Preparation", $skillPreparation)
  759.     IniWrite($ini, "Skills", "Companion", $skillCompanion)
  760.     IniWrite($ini, "Additional", "Movement Speed", $movementSpeed)
  761.     IniWrite($ini, "Additional", "Walk Time", $walktime)
  762.     IniWrite($ini, "Additional", "Load Time", $loadtime)
  763.     IniWrite($ini, "Additional", "Teleport Time", $tptime)
  764.     IniWrite($ini, "Looting", "Sets", $LootSets)
  765.     IniWrite($ini, "Looting", "Legendaries", $LootLegendaries)
  766.     IniWrite($ini, "Looting", "Rares", $LootRares)
  767.     IniWrite($ini, "Looting", "Magic", $LootMagic)
  768.     IniWrite($ini, "Looting", "Gems", $LootGems)
  769.     IniWrite($ini, "Looting", "Tomes", $LootTomes)
  770.     IniWrite($ini, "Looting", "Custom", $LootCustom)
  771.     IniWrite($ini, "ManageLoot", "Every", $mLoot)
  772.     IniWrite($ini, "ManageLoot", "Identify", $Identify)
  773.     IniWrite($ini, "Stashing", "Loot", $StashLoot)
  774.     IniWrite($ini, "Stashing", "Legendaries", $StashLegendary)
  775.     IniWrite($ini, "Stashing", "Rares", $StashRare)
  776.     IniWrite($ini, "Stashing", "Magic", $StashMagic)
  777.     IniWrite($ini, "Stashing", "Tomes", $StashTomes)
  778.     IniWrite($ini, "Stashing", "Custom", $StashCustom)
  779.     IniWrite($ini, "Stashing", "Gems", $StashGems)
  780.     IniWrite($ini, "Vendoring", "Loot", $VendorLoot)
  781.     IniWrite($ini, "Vendoring", "Rares", $VendorRare)
  782.     IniWrite($ini, "Vendoring", "Magic", $VendorMagic)
  783.     IniWrite($ini, "Vendoring", "All", $vendorAll)
  784.     IniWrite($ini, "Vendoring", "All-Rows", $vendorRows)
  785.     IniWrite($ini, "Vendoring", "All-Cols", $vendorCols)
  786.     IniWrite($ini, "Variability", "Timer", $Timer)
  787.     IniWrite($ini, "Variability", "Manage Off By", $mLootOff)
  788.     IniWrite($ini, "Variability", "Attack Time", $attackTime)
  789.     IniWrite($ini, "Variability", "Attack Multiple", $attackMulti)
  790. EndFunc   ;==>CreateINI
  791.  
  792. Func _ImageSearchArea($findImage, $resultPosition, $x1, $y1, $right, $bottom, ByRef $x, ByRef $y, $tolerance)
  793.     If $tolerance > 0 Then $findImage = "*" & $tolerance & " " & $findImage
  794.     $findImage = "*TRANSBLACK " & $findImage
  795.     If @AutoItX64 Then
  796.         $result = DllCall("ImageSearchDLL_x64.dll", "str", "ImageSearch", "int", $x1, "int", $y1, "int", $right, "int", $bottom, "str", $findImage)
  797.     Else
  798.         $result = DllCall("ImageSearchDLL.dll", "str", "ImageSearch", "int", $x1, "int", $y1, "int", $right, "int", $bottom, "str", $findImage)
  799.     EndIf
  800.     If $result = "0" Then
  801.         Return 0
  802.     EndIf
  803.  
  804.     ; Otherwise get the x,y location of the match and the size of the image to
  805.     ; compute the centre of search
  806.     $array = StringSplit($result[0], "|")
  807.     If (UBound($array) >= 4) Then
  808.         $x = Int(Number($array[2]))
  809.         $y = Int(Number($array[3]))
  810.         If $resultPosition = 1 Then
  811.             $x = $x + Int(Number($array[4]) / 2)
  812.             $y = $y + Int(Number($array[5]) / 2)
  813.         EndIf
  814.         Return 1
  815.     EndIf
  816. EndFunc   ;==>_ImageSearchArea
  817.  
  818. Func LeaveGame()
  819.     Call("RandSleep")
  820.     GUICtrlSetData($lblStatus, "Status: Leaving Game")
  821.     Send("{Escape}")
  822.     Sleep(200)
  823.     RandClick("left", Round(956 * $x_ratio), Round(579 * $y_ratio), 120, 20) ;Random Click on the leave button
  824.     Call("CalcTime")
  825.     Sleep($loadtime)
  826. EndFunc   ;==>LeaveGame
  827.  
  828. Func TownPortal()
  829.     GUICtrlSetData($lblStatus, "Status: Returning to Town")
  830.     Send("t")
  831.     Sleep(Random($tptime, $tptime + 500))
  832. EndFunc   ;==>TownPortal
  833.  
  834. Func Moving($time)
  835.     Sleep($time / $movementSpeed)
  836. EndFunc   ;==>Moving
  837.  
  838. Func RandClick($clickType, $xPos, $yPos, $xOff = 10, $yOff = 10, $clicks = 1, $speed = 4)
  839.     If $xOff < 1 Then $xOff = 1
  840.     If $yOff < 1 Then $yOff = 1
  841.     $randX = Round(Random($xPos - ($xOff * $x_ratio), $xPos + ($xOff * $x_ratio)))
  842.     $randY = Round(Random($yPos - ($yOff * $y_ratio), $yPos + ($yOff * $y_ratio)))
  843.     MouseClick($clickType, $randX, $randY, $clicks, $speed)
  844. EndFunc   ;==>RandClick
  845.  
  846. Func RandMove($xPos, $yPos, $xOff = 10, $yOff = 10, $speed = 1)
  847.     $randX = Round(Random($xPos - ($xOff * $x_ratio), $xPos + ($xOff * $x_ratio)))
  848.     $randY = Round(Random($yPos - ($yOff * $y_ratio), $yPos + ($yOff * $y_ratio)))
  849.     MouseMove($randX, $randY, $speed)
  850. EndFunc   ;==>RandMove
  851.  
  852. Func RandSleep($min = 5, $max = 45, $chance = 3)
  853.     $randNum = Round(Random(1, 100))
  854.     If $Timer == True And $randNum <= $chance Then
  855.         $sleepTime = Random($min * 1000, $max * 1000)
  856.         GUICtrlSetData($lblStatus, "Status: Random Sleep - " & Round($sleepTime / 1000) & " secs")
  857.  
  858.         For $c = 0 To 10
  859.             Sleep($sleepTime / 10)
  860.         Next
  861.     EndIf
  862. EndFunc   ;==>RandSleep
  863.  
  864. ;Hotkey Functions
  865.  
  866. Func Begin()
  867.     $Go = Not $Go
  868.     If Not $Go Then WinSetTitle($title, "", $title & $ver & " - Halted")
  869. EndFunc   ;==>Begin
  870.  
  871. Func TogglePause()
  872.     $Paused = Not $Paused
  873.     While $Paused
  874.         Sleep(100)
  875.         WinSetTitle($title, "", $title & $ver & " - Paused")
  876.         ToolTip('[PAUSED] - Deaths: ' & $deathCount & ' | Cellars: ' & $cellarCount, 0, 0)
  877.     WEnd
  878.     WinSetTitle($title, "", $title & $ver & " - Running")
  879.     ToolTip("")
  880. EndFunc   ;==>TogglePause
  881.  
  882. Func ShowLoot()
  883.     GUICtrlSetData($lblGear, "Legendary: " & $LegendaryCount & " - Set: " & $SetCount & " - Rare: " & $RareCount)
  884.     GUICtrlSetData($lblItems, "Magic: " & $MagicCount & " - Gems: " & $GemCount & " - Tomes: " & $TomeCount)
  885. EndFunc   ;==>ShowLoot
  886.  
  887. Func Stop() ;to allow the script to stop
  888.     Exit
  889. EndFunc   ;==>Stop
Advertisement
Add Comment
Please, Sign In to add comment