[Goldfarming] Dank Celler [AutoIT Script] [DH based on chancitys] [800x600] menu

User Tag List

Page 13 of 19 FirstFirst ... 91011121314151617 ... LastLast
Results 181 to 195 of 273
  1. #181
    stealthingyew's Avatar Knight-Lieutenant
    Reputation
    12
    Join Date
    Jun 2012
    Posts
    257
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by lichung View Post
    the latest version misses open cellar in a few occasions where the mouse appears at 3 different fringes of the cellar gate when my DH is getting close. my DH then head south and exit through TP.
    Open the folder shots then cellars find the image where he missed the cellar. Open it in paint Hover over the side of the cellar door. Now at the bottom of the paint window you will see

    now find these 2 lines in the script

    Code:
    Global $cellarCoordx[3] = [
    Global $cellarCoordy[3]=
    add the first number to the end of the first line and change the 3 to a 4 and the 2nd number to the 2nd line and change the 3 to a 4
    so it would be

    Code:
    Global $cellarCoordx[4] = [#,#,#,313]
    Global $cellarCoordy[4]=  [#,#,#,227]
    according to the example picture i used

    [Goldfarming] Dank Celler [AutoIT Script] [DH based on chancitys] [800x600]
  2. #182
    lichung's Avatar Private
    Reputation
    1
    Join Date
    Jun 2012
    Posts
    4
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by stealthingyew View Post
    Open the folder shots then cellars find the image where he missed the cellar. Open it in paint Hover over the side of the cellar door. Now at the bottom of the paint window you will see

    now find these 2 lines in the script

    Code:
    Global $cellarCoordx[3] = [
    Global $cellarCoordy[3]=
    add the first number to the end of the first line and change the 3 to a 4 and the 2nd number to the 2nd line and change the 3 to a 4
    so it would be

    Code:
    Global $cellarCoordx[4] = [#,#,#,313]
    Global $cellarCoordy[4]=  [#,#,#,227]
    according to the example picture i used
    should the new set of coordinates pointing at the side or right at the cellar door?

  3. #183
    stealthingyew's Avatar Knight-Lieutenant
    Reputation
    12
    Join Date
    Jun 2012
    Posts
    257
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the side where the bot would need to hover to make it light up and be able to click to enter.


    note: 1 of the pixels i included in the script is causing him to miss the cellar a little bit so I am going to edit these and post an update after work.
    Last edited by stealthingyew; 07-19-2012 at 05:03 AM.

  4. #184
    lichung's Avatar Private
    Reputation
    1
    Join Date
    Jun 2012
    Posts
    4
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by stealthingyew View Post
    the side where the bot would need to hover to make it light up and be able to click to enter.


    note: 1 of the pixels i included in the script is causing him to miss the cellar a little bit so I am going to edit these and post an update after work.


    looking forward to the next update and cheers.
    for the time being, say in this shot, should I take the coordinates at the red dot?

  5. #185
    stealthingyew's Avatar Knight-Lieutenant
    Reputation
    12
    Join Date
    Jun 2012
    Posts
    257
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I do it at the closest side of the cellar so the bit can see all the blue without te cursor in the way

  6. #186
    bluedragon86's Avatar Private
    Reputation
    1
    Join Date
    Jul 2012
    Posts
    5
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it now only vendors the first row for me - and also it dies a lot now on the way to the cellar - the previous version worked great apart from missing the vendor.

  7. #187
    jerick60's Avatar Corporal
    Reputation
    1
    Join Date
    Jul 2012
    Posts
    23
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    after moving to the merchant and click it to start selling items. the script will pause... anyone please help i dont know what to do

  8. #188
    stealthingyew's Avatar Knight-Lieutenant
    Reputation
    12
    Join Date
    Jun 2012
    Posts
    257
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by bluedragon86 View Post
    it now only vendors the first row for me - and also it dies a lot now on the way to the cellar - the previous version worked great apart from missing the vendor.
    Do you still have the old script if so link it and I'll rebuild it and update the vendor click and post it for those who liked it better


    Are you running it on VMware? You Swapped to the new build? What is your movement speed?
    Last edited by stealthingyew; 07-19-2012 at 06:46 AM.

  9. #189
    Peage's Avatar Member
    Reputation
    1
    Join Date
    Jul 2012
    Posts
    27
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Bot need to open stash already ? even if the cellar are close and the bot do not drop anythink then ? because it's a waste of time to identify again the stash before each game...

    Thanks to reply me.

    And i would like to know if it was possible to make faster the run to goes at the dank cellar , because this one bot , already stop to run to cast smoke , it's a waste of time too , and increase chance to death if monster are near.

  10. #190
    stealthingyew's Avatar Knight-Lieutenant
    Reputation
    12
    Join Date
    Jun 2012
    Posts
    257
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Peage View Post
    Bot need to open stash already ? even if the cellar are close and the bot do not drop anythink then ? because it's a waste of time to identify again the stash before each game...

    Thanks to reply me.
    He only opens bag on first game to get your starting gold which is less than 10ms. Then it opens bag during ports so no time is added from that. Didn't really understand what you were asking though. He should only visit stash if bag is full.
    Last edited by stealthingyew; 07-19-2012 at 07:06 AM.

  11. #191
    Nesslow's Avatar Member
    Reputation
    1
    Join Date
    Jun 2012
    Posts
    12
    Thanks G/R
    0/0
    Trade Feedback
    1 (100%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The old script:

    Code:
    ;=========== DO NOT TOUCH ===========;
    #RequireAdmin
    #include <GUIConstantsEx.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    #include <ScreenCapture.au3>
    #include <GoldRead.au3>
    Opt('MouseCoordMode', 2)
    Opt('PixelCoordMode', 2)
    
    
    ;GUI Predeclare to prevent firing the Case statements
    Global $lbllink,$mFile,$mOptions,$lblRun,$lblLocation,$lblStatus,$lblLast,$lblRuntime,$lblGold,$lblCellars,$lblStats,$mAutoUpdate,$SettingsGUI,$Settings,$tsSettings,$grpgameAutoStart,$lblgameDiabloIIILoc,$txtgameDiabloIIILoc,$lblgamePassword,$txtgamePassword,$cbgameAutoStart,$btngameDiabloIIILoc,$tsLooting,$grpLoot,$etlootCustom,$cblootSet,$cblootLegendary,$cblootRare,$cblootMagic,$cblootCustom,$tsStash,$grpStashing,$cbstashSet,$cbStashLegendary,$cbstashRare,$cbstashMagic,$cbStashTomes,$cbStashGems, $tsVendoring,$grpVendoring,$cbvendorRare,$cbvendorMagic,$cbvendorLegendary,$cbvendorSet,$cmbvendorRows,$lblVendorRow,$cbvendorAll, $lblVendorCol,$cmbVendorColumns,$tsSkills,$grpSkills,$txtSkill1,$txtSkill2,$txtSkill3,$txtSkill4,$lblskill1,$lblSkill2,$lblSkill3, $lblSkill4,$cbCellarDetectScreenShots, $btnSave,$grpAdd,$txtAddMove, $txtAddDPS, $lblAddDPS,$cbAddGoldOnly, $lbltimingGameLoad, $lbltimingCellarClick, $lbltimingWormHole, $lbltimingMiddleDoor, $lbltimingAbort, $lbltimingTP, $lbltimingLoot, $lbltimingLootRun, $txttimingGameLoad, $txttimingWormHole, $txttimingTP, $txttimingCellarClick, $txttimingMiddleDoor, $txttimingLootRun, $txttimingLoot, $txttimingAbort,$txtRareStashilvl, $txtRareSalvageilvl, $txtRareVendorilvl, $txtMagicStashilvl, $txtMagicSalvageilvl, $txtMagicVendorilvl,$lblitems,$lblgear,$lblStartingG,$CurrentItems
    
    Global $size = WinGetClientSize("[CLASS:D3 Main Window Class]"), $Kill = ProcessList("AutoIt3_x64.exe"),$mLootIn = 0, $x_ratio, $y_ratio, $AddDPS = 0,$attackTime = 0, $hFont = 0, $title, $Paused, $Go = 0, $i = 0, $gX = 0, $gY = 0, $GemCount = 0, $LegendaryCount = 0, $SetCount = 0, $RareCount = 0, $deathCount = 0, $MagicCount = 0, $repairCount = 0, $closedcellarCount = 0, $cellarCount = 0, $countMissedCellar = 0, $MissedCellarCountPercent = 0, $t = TimerInit(), $rt = 0, $run = 0, $yellow = 0xFFF000, $red = 0xD90000, $StartingGold = 0,$AccumulatedGold = 0,$GPH = 0, $OpenCellarAvg = 0, $OpenCellarSec = 0,$ClosedCellarAvg, $ClosedCellarSec = 0,$CellCoord = 0, $c = 0, $RunsPerHour = 0,$closedCellarCountPercent = 0, $repairCountPercent = 0, $deathsCountPercent = 0, $cellarCountPercent = 0, $settingsINI = "Settings.ini", $StashSelectedTab = 0,$Items = 0
    Global $gems[4] = ["Em1.png", "Ru1.png", "To1.png", "Am1.png"]
    Global $AnalyzedLoot[10][6]
    Global $StashTabs[3][2] = [[281,127], [281,199], [285,271]]
    
    
    For $i = 1 To $Kill[0][0]
    	$CurrentPID = @AutoItPID
    	If $CurrentPID < $Kill[$i][1] or $CurrentPID > $Kill[$i][1] Then
    	ProcessClose($Kill[$i][1])
    	EndIf
     Next
    
    DirCreate("shots")
    DirCreate("shots\Start")
    DirCreate("shots\Cellar")
    
    $pngLoc = @ScriptDir & "\pics\" & @DesktopWidth & "x" & @DesktopHeight& "\"
    
    If Not FileExists($pngLoc & "MainMenu.png") Then
    	MsgBox(16, "Fatal Error", "FATAL ERROR: Cannot find: " & $pngLoc & "MainMenu.png" & @CRLF & "Make sure your desktop resolution is 800x600")
    	Exit
    EndIf
    
    If @OSArch = "X64" Then DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 1)
    If @OSArch = "X64" And Not @AutoItX64 Then MsgBox(16, "ERROR", "Why aren't you running the 64-bit AutoIt??? Expect bugs!")
    
    ;GUI Title Bar
    For $i = 0 To Random(0, 7, 1)
    	$title &= Chr(Random(97, 122, 1))
    Next
    For $i = 0 To Random(5, 10, 1)
    	$title &= Chr(Random(65, 90, 1))
    Next
    $title &= " "
    
    
    ;==================================================
    
    $totalItems = 1	;Number of items in the pick array
    ;$currentArrayItem = 0x
    Global $pick[$totalItems] 	;DONT CHANGE THIS
    
    ;Cellar Detection
    Global $cellarCoordx[7] = [166,137,240,245,121,174,243]
    Global $cellarCoordy[7]=  [146,145,156,144,135,129,150]
    $cellarCheckSleep = 180
    $Screenshot = 1
    
    ;AutoStart
    $gameDiabloIIILoc = "C:\" ;Location of Diablo 3 executable
    $gameAutoStart = 0 ; Set this to 1 to start game from desktop or reco from closed game
    $gameStartTime = 9000  ;Change depending on computer/internet speed
    $gamePassword = "Your Password" ;Symbols go in brackets "Password1{!}"
    $gameExecutable = "Diablo III.exe"
    
    ;Change to match your abilities (1-4 by default)z
    $Skill1 = "1"
    $Skill2 = "2"
    $Skill3 = "3"
    $Skill4 = "4"
    ;==================================================
    
    ;Looting
    $LootSet = 1 ;1 if you want to pick up Set
    $LootLegendary = 1;1 if you want to pick up Legendaries
    $LootRare = 1 ;1 if you want to pick up Rares
    $LootMagic = 1 ;1 if you want to pick up Magic
    $LootCustom = 0 ;1 if you want to pick up Custom Items
    $LootGoldOnly = 0 ; 1 if you want to not loot anything but gold
    ;==================================================
    
    ;Stashing
    $StashLegendary = 1 ;1 if you want to store Legendary items in the stash
    $StashSet = 1 ;1 if you want to store Set items in the stash
    $StashRare = 1 ;1 if you want to store Rare items in the stash
    $StashMagic = 0 ;1 if you want to store Magic items in the stash
    $StashTomes = 1 ;1 if you want to store Tomes items in the stash
    $StashGems = 1 ;1 if you want to store Gems items in the stash
    $StashLoot = $StashMagic  + $StashRare + $StashLegendary + $Stashset + $StashGems + $StashTomes
    ;==================================================
    
    ;Vendoring
    $VendorSet = 0
    $VendorLegendary = 0
    $VendorRare = 0 ;1 if you want to vendor Rares
    $VendorMagic = 1 ;1 if you want to vendor Magic
    $vendorRows = 6 ;# of rows to vendor, starting from the top (default = 5: bottom row is safe)
    $vendorColumns = 10 ;# of columns to vendor, starting from left
    $VendorAll = 1 ;Vendors everything but identified items
    $VendorLoot = $VendorMagic + $VendorRare + $VendorLegendary + $VendorSet +  $VendorAll
    ;==================================================
    
    ;Additional
    $AddDPS = 0 ;Time (in s) the script will shoot sarkoth with the right button
    
    ;==================================================
    
    ;Timing
    
    $timingCellarClick = 750 ;time (in ms) it takes to run into the cellar
    
    $timingAbort = 300 ;time (in ms) to wait to cast abort skills, decrease if you have high attack speed
    $timingGameLoad = 5000 ;Time (in ms) the script waits for the game to load before it starts pathfinding. Slow this down for slower hard drives
    $timingTP = 6000;Time (in ms) the script waits for teleport before exiting the game
    $timingLoot = 800;Time (in ms) the script waits before each loot attempt
    $timingLootRun = 600;Time (in ms) the script runs towards sarkoth dead body
    ;==================================================
    
    
    ;Anal Loot!!
    $AnalLoot = 1
    $RareSalvageiLvl = 61 ;and below to Salvage #
    $MagicSalvageiLvl = 62 ;and below to Salvage #
    $RareStashiLvl = 62 ;and above to Stash #
    $MagicStashiLvl = 63 ;and above to Stash #
    $RareVendoriLvl = 60 ;and below to Vendor #
    $MagicVendoriLvl = 60 ;and below to Vendor #
    $AnalSpeed = 50
    ;==================================================
    ;New Loot Coords
    $slot1x = 530  ; first slot x coordinate
    $slot1y = 338 ;first slot y coordinate
    
    
    $offset = 27 ; offset for each slot
    
        ;$slotLineX = 520 ;First slot line x coordinate
    	;$slotLineY = 324 ;First slot line y coordinate
    	;$slotLineOffSet = 26.75 ;offset for each line
    	
    $slotLineTopX = 519 ;First slot line x coordinate
    $slotLineTopY = 320 ;First slot line y coordinate
    $slotLineBotX = 541 ;First slot line x coordinate
    $slotLineBotY = 352 ;First slot line y coordinate
    $slotLineOffSet = 26.75 ;offset for each line
    
    $CellMiddleTopX = 530
    $CellMiddleTopY = 339
    $CellMiddleBotX = 531
    $CellMiddleBotY =341
    $CellMiddleO = 26.75
    ;==================================================
    
    ;====DONT CHANGE=====;
    $AnalSalvage = 0 ;determines whether not theres items to salvage
    $AnalRareIdentify = 0  ;determines whether not theres a rare to identify, don't change
    $AnalVendor = 0
    $slotError = 0;Used if line doesn't exisit
    ;==================================================
    
    
    HotKeySet("<", "Begin") ;script toggled on/off by pressing =
    HotKeySet("{PAUSE}", "TogglePause") ;script toggle pause by pressing Pause/Break key
    HotKeySet("x", "Stop") ;script stopped by pressing x
    
    Call("ReadINI")
    
     If $AddDPS = 0 then 
            MsgBox(16, "First Run", "Edit your settings.")
    	 EndIf
    	 
    
    If $gameAutoStart = 1 Then 
       Call("GameAutostart")
    Else
       $size = WinGetClientSize("[CLASS:D3 Main Window Class]")
       If $size = 0 Then
            MsgBox(16, "Error", "Diablo III is not running, cannot grab resolution!" & @CRLF & "Exiting...")
            Exit
       EndIf
       $x_ratio = $size[0] / 800 
       $y_ratio =  $size[1] / 600 
    EndIf
       
    MainGUI()
    Func MainGUI()
    
    $frmBot = GUICreate($title &  " -waiting to start", 255, 157, Round(10 * $x_ratio), Round(375 * $y_ratio), -1, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW), 0)
    GUISetBkColor(0xC0C0C0)
    $mFile = GUICtrlCreateMenu("File")
    $mStart = GUICtrlCreateMenuItem("Start", $mFile)
    $mOptions = GUICtrlCreateMenu("Options")
    $mSettings = GUICtrlCreateMenuItem("Settings", $mOptions)
    
    $lblRun = GUICtrlCreateLabel("Run Number: 0 - Runs Per Hour: 0", 2, 0, 260, 24)
    GUICtrlSetFont(-1, 10, 600, 0, "Segoe UI")
    GUICtrlSetColor(-1, 0xFF0000)
    
    $lblStatus = GUICtrlCreateLabel("Status: ", 2, 20, 260, 17)
    $lblRuntime = GUICtrlCreateLabel("Total Runtime: 0 hours, 0 minutes", 2, 35, 260, 17)
    $lblLast = GUICtrlCreateLabel("Open Cellar Avg: 0s - Closed Cellar Avg: 0s", 2, 50, 260, 17)
    $lblCellars = GUICtrlCreateLabel("Cellars Open: 0 (0%) - Cellars Closed: 0 (0%)", 2, 65, 260, 17)
    $lblGold = GUICtrlCreateLabel("0 Per Hour - Accumulated Gold: 0", 2, 80, 260, 17)
    $lblStartingG=GUICtrlCreateLabel("Staring Gold: 0", 2, 95, 260, 17)
    $lblGear= GUICtrlCreateLabel("Legendary: 0 Set: 0 Rare: 0 Magics: 0",2, 110,260,17)
    
    GUISetState()
    
    While 1
    
    $aMsg = GUIGetMsg(1) ; Use advanced parameter to get array
    	Switch $aMsg[1] ; check which GUI sent the message
    		Case $frmBot
    			Switch $aMsg[0]
    				Case $mStart
    					Call("Begin")
    				Case $mSettings
    					GUICtrlSetState($mSettings, $GUI_DISABLE)
    					SettingsGUI()
    
    				 EndSwitch
    		Case $SettingsGUI
    		   Switch $aMsg[0] ; Now check for the messages for $hGUI2
    			Case $cbStashSet
    			If IsChecked($cbStashSet) Then GUICtrlSetState($cbvendorSet,$GUI_UNCHECKED)
    		Case $cbStashLegendary
    			If IsChecked($cbStashLegendary) Then GUICtrlSetState($cbvendorLegendary,$GUI_UNCHECKED)
    		Case $cbStashRare
    			If IsChecked($cbStashRare) Then GUICtrlSetState($cbvendorRare,$GUI_UNCHECKED)
    		Case $cbStashMagic
    			If IsChecked($cbStashMagic) Then GUICtrlSetState($cbvendorMagic,$GUI_UNCHECKED)
    		Case $cbvendorSet
    			If IsChecked($cbvendorSet) Then GUICtrlSetState($cbStashSet,$GUI_UNCHECKED)
    		Case $cbvendorLegendary
    			If IsChecked($cbvendorLegendary) Then GUICtrlSetState($cbStashLegendary,$GUI_UNCHECKED)
    		Case $cbVendorRare
    			If IsChecked($cbvendorRare) Then GUICtrlSetState($cbStashRare,$GUI_UNCHECKED)
    		Case $cbVendorMagic
    			If IsChecked($cbvendorMagic) Then GUICtrlSetState($cbStashMagic,$GUI_UNCHECKED)
    		Case $cbgameAutoStart
    			If IsChecked($cbgameAutoStart) And FileExists(GUICtrlRead($txtgameDiabloIIILoc) & "Diablo III.exe") = 0 Then
    				GUICtrlSetState($cbgameAutoStart,$GUI_UNCHECKED)
    				EndIF
    		Case $txtSkill1
    			SkillAlphaNum($txtSkill1,$Skill1,0)
    		Case $txtSkill2
    			SkillAlphaNum($txtSkill2,$Skill2,0)
    		Case $txtSkill3
    			SkillAlphaNum($txtSkill3,$Skill3,0)
    		Case $txtSkill4
    			SkillAlphaNum($txtSkill4,$Skill4,0)
    			 
    			
    		Case $btngameDiabloIIILoc
    			$GUIfileSelect = FileSelectFolder ("Diablo III Executable Location","")
    			If Not @Error And FileExists($GUIfileSelect & "\Diablo III.exe") = 0 Then
    				$GUIwrongLocation = MsgBox ( "6", "Wrong Location", "Select the folder with the Diablo III.exe!")
    				If $GUIwrongLocation = 2 Or 11 Then
    					GUISetCheck(0,$cbgameAutoStart)
    					GUIUpdate($txtgameDiabloIIILoc,$GUIfileSelect)
    				EndIf
    			ElseIf FileExists($GUIfileSelect & "\Diablo III.exe") = 1 Then
    			GUIUpdate($txtgameDiabloIIILoc,$GUIfileSelect & "\")
    			GUISetCheck(1,$cbgameAutoStart)
    			Endif
    
    			Case $btnSave
    			Call("SaveINI")
    			GUIDelete($SettingsGUI)
    			GUICtrlSetState($mSettings, $GUI_ENABLE)
    	EndSwitch
    	EndSwitch
    	Call("RestartRun")
    WEnd
    
    EndFunc   ;==>MainGUI
    
    Func SettingsGUI()
    
    $SettingsGUI = GUICreate($title , 443, 195, Round(10 * $x_ratio), Round(375 * $y_ratio), -1,$WS_EX_TOPMOST, 0)
    GUISetIcon(@ScriptDir & "\Setting-icon.ico")
    $Settings = GUICtrlCreateTab(0, 8, 441, 185)
    GUICtrlSetResizing($Settings, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
    $tsSettings = GUICtrlCreateTabItem("Auto Start")
    $grpgameAutoStart = GUICtrlCreateGroup("", 4, 33, 273, 121)
    $lblgameDiabloIIILoc = GUICtrlCreateLabel("Diablo III Location:", 12, 83, 93, 17)
    $txtgameDiabloIIILoc = GUICtrlCreateInput($gameDiabloIIILoc, 116, 81, 105, 21)
    $lblgamePassword = GUICtrlCreateLabel("Password:", 12, 116, 53, 17)
    $txtgamePassword = GUICtrlCreateInput($gamePassword, 116, 113, 105, 21)
    $cbgameAutoStart = GUICtrlCreateCheckbox("Auto Start", 12, 49, 73, 17)
    $btngameDiabloIIILoc = GUICtrlCreateButton("Browse", 224, 79, 49, 23, 0)
    GUICtrlSetState($txtgameDiabloIIILoc, $GUI_DISABLE)
    
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $tsLooting = GUICtrlCreateTabItem("Looting")
    $grpLoot = GUICtrlCreateGroup("", 4, 33, 273, 121)
    $etlootCustom = GUICtrlCreateEdit("",148, 73, 121, 65)
    $cblootSet = GUICtrlCreateCheckbox("Set Items", 12, 49, 81, 17)
    $cblootLegendary = GUICtrlCreateCheckbox("Legendary Items", 12, 73, 113, 17)
    $cblootRare = GUICtrlCreateCheckbox("Rare Items", 12, 97, 81, 17)
    $cblootMagic = GUICtrlCreateCheckbox("Magic Items", 12, 121, 81, 17)
    $cblootCustom = GUICtrlCreateCheckbox("Custom Loot", 149, 49, 81, 17)
    
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $tsstash = GUICtrlCreateTabItem("Stashing")
    $grpStashing = GUICtrlCreateGroup("", 4, 33, 273, 121)
    ;~ $cbstashSet = GUICtrlCreateCheckbox("Set Items", 12, 49, 97, 17)
    ;~ $cbstashLegendary = GUICtrlCreateCheckbox("Legendary Items", 12, 73, 97, 17)
    ;~ $cbstashRare = GUICtrlCreateCheckbox("Rare Items", 12, 97, 97, 17)
    ;~ $cbstashMagic = GUICtrlCreateCheckbox("Magic Items", 12, 121, 96, 17)
    $cbStashGems = GUICtrlCreateCheckbox("Gems", 12, 49, 97, 17)
    $cbStashTomes = GUICtrlCreateCheckbox("Tomes", 12, 73, 97, 17)
    
    
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $tsAnalLoot = GUICtrlCreateTabItem("Anal Loot")
    $grpAnalLoot = GUICtrlCreateGroup("", 4, 33, 273, 121)
    $lblRareStashiLvl = GUICtrlCreateLabel("Rare Stash:", 12, 52, 60, 17)
    $lblRareSalvageiLvl = GUICtrlCreateLabel("Rare Salvage:", 12, 76, 72, 17)
    $lblRareVendoriLvl = GUICtrlCreateLabel("Rare Vendor:", 12, 100, 67, 17)
    $lblMagicStashiLvl = GUICtrlCreateLabel("Magic Stash:", 136, 52, 66, 17)
    $lblMagicSalvageiLvl = GUICtrlCreateLabel("Magic Salvage:", 136, 76, 78, 17)
    $lblMagicVendoriLvl = GUICtrlCreateLabel("Magic Vendor:", 136, 100, 73, 17)
    $txtRareStashiLvl = GUICtrlCreateInput($RareStashiLvl, 88, 49, 33, 21)
    $txtRareVendoriLvl = GUICtrlCreateInput($RareVendoriLvl, 88, 97, 33, 21)
    $txtRareSalvageiLvl = GUICtrlCreateInput($RareSalvageiLvl, 88, 73, 33, 21)
    $txtMagicStashiLvl = GUICtrlCreateInput($MagicStashiLvl, 216, 49, 33, 21)
    $txtMagicSalvageiLvl = GUICtrlCreateInput($MagicSalvageiLvl, 216, 73, 33, 21)
    $txtMagicVendoriLvl = GUICtrlCreateInput($MagicVendoriLvl, 216, 97, 33, 21)
    
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $tsSkills = GUICtrlCreateTabItem("Skills")
    $grpSkills = GUICtrlCreateGroup("", 4, 33, 273, 121)
    $txtSkill1 = GUICtrlCreateInput($Skill1, 184, 49, 41, 21)
    $txtSkill2 = GUICtrlCreateInput($Skill2, 184, 73, 41, 21)
    $txtSkill3 = GUICtrlCreateInput($Skill3, 184, 97, 41, 21)
    $txtSkill4 = GUICtrlCreateInput($Skill4, 184, 121, 41, 21)
    $lblskill1 = GUICtrlCreateLabel("Vault(Rattling Roll):", 12, 52, 139, 17)
    $lblSkill2 = GUICtrlCreateLabel("Preperation(Battlescars):", 12, 76, 124, 17)
    $lblSkill3 = GUICtrlCreateLabel("Companion(Ferret):", 12, 100, 103, 17)
    $lblSkill4 = GUICtrlCreateLabel("Spike Trap(Scatter):", 12, 124, 160, 17)
    
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $tsTiming = GUICtrlCreateTabItem("Timing")
    $grpTiming = GUICtrlCreateGroup("", 4, 33, 273, 121)
    $lbltimingGameLoad = GUICtrlCreateLabel("Game Load:", 12, 52, 62, 17)
    $lbltimingTP = GUICtrlCreateLabel("Town Portal:", 12, 76, 64, 17)
    
    $lbltimingCellarClick = GUICtrlCreateLabel("Cellar Click:", 12, 124, 59, 17)
    $lbltimingAbort = GUICtrlCreateLabel("Abort:", 139, 52, 32, 17)
    $lbltimingMiddleDoor = GUICtrlCreateLabel("Middle Door:", 139, 76, 64, 17)
    $lbltimingLootRun = GUICtrlCreateLabel("Loot Run:", 139, 100, 51, 17)
    $lbltimingLoot = GUICtrlCreateLabel("Loot:", 139, 124, 28, 17)
    $txttimingGameLoad = GUICtrlCreateInput("2000", 80, 49, 41, 21)
    $txttimingTP = GUICtrlCreateInput("5000", 80, 73, 41, 21)
    
    $txttimingCellarClick = GUICtrlCreateInput("750", 80, 121, 41, 21)
    $txttimingAbort = GUICtrlCreateInput("255", 206, 49, 41, 21)
    
    $txttimingLootRun = GUICtrlCreateInput("300", 206, 97, 41, 21)
    $txttimingLoot = GUICtrlCreateInput("800", 206, 121, 41, 21)
    
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $tsCellarDetect = GUICtrlCreateTabItem("Cellar Detect")
    $grpCellarDetect = GUICtrlCreateGroup("", 4, 33, 273, 121)
    $lblCellarDetectX = GUICtrlCreateLabel("X Coordinates:", 12, 52, 73, 17)
    $lblCellarDetectY = GUICtrlCreateLabel("Y Coordinates:", 12, 76, 73, 17)
    $lblCellarDetectTime = GUICtrlCreateLabel("Check Time:", 12, 100, 64, 17)
    $cbCellarDetectScreenShots = GUICtrlCreateCheckbox("Screen Shots", 12, 124, 97, 17)
    $txtCellarDetectXCoords = GUICtrlCreateInput("166,137,240,245,121", 96, 49, 169, 21)
    GUICtrlSetState($txtCellarDetectXCoords, $GUI_DISABLE)
    $txtCellarDetectYCoords = GUICtrlCreateInput("146,145,156,144,135", 96, 73, 169, 21)
    GUICtrlSetState($txtCellarDetectYCoords, $GUI_DISABLE)
    $txtCellarDetectTime = GUICtrlCreateInput("155", 96, 97, 41, 21)
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    
    GUICtrlCreateTabItem("")
    $btnSave = GUICtrlCreateButton("Save", 352, 160, 75, 25, 0)
    $grpAdd = GUICtrlCreateGroup("Additional", 280, 33, 153, 121)
    $cbAddGoldOnly = GUICtrlCreateCheckbox("Gold Only", 288, 97, 97, 17)
    $txtAddDPS = GUICtrlCreateInput($AddDPS, 376, 49, 49, 21)
    $lblAddDPS = GUICtrlCreateLabel("DPS:", 288, 52, 29, 17)
    
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    GUISetState()
    
    
    getCustomKeys()
    UpdateGUI()
    EndFunc ;===SettingsGUI
    
    Func ReadINI()
        getCustomkeys()
    	$gameAutoStart = IniRead($settingsINI, "Auto Start", "Auto Start", $gameAutoStart)
    	$gameDiabloIIILoc = IniRead($settingsINI, "Auto Start", "Game Location", $gameDiabloIIILoc)
    	$gamePassword = IniRead($settingsINI, "Auto Start", "Password", $gamePassword)
    	$Skill1 = IniRead($settingsINI, "Skills", "Skill1", $Skill1)
    	$Skill2 = IniRead($settingsINI, "Skills", "Skill2", $Skill2)
    	$Skill3 = IniRead($settingsINI, "Skills", "Skill3", $Skill3)
    	$Skill4 = IniRead($settingsINI, "Skills", "Skill4", $Skill4)
    
    	$AddDPS = IniRead($settingsINI, "Additional", "DPS", $AddDPS )
    	$LootSet = IniRead($settingsINI, "Looting", "Set", $LootSet)
    	$LootLegendary = IniRead($settingsINI, "Looting", "Legendary", $LootLegendary)
    	$LootRare = IniRead($settingsINI, "Looting", "Rare", $LootRare)
    	$LootMagic = IniRead($settingsINI, "Looting", "Magic", $LootMagic)
    	$LootCustom = IniRead($settingsINI, "Looting", "Custom", $LootCustom)
    	$LootGoldOnly = IniRead($settingsINI, "Looting", "Gold Only", $LootGoldOnly)
    	$StashSet = IniRead($settingsINI, "Stashing", "Set", $StashSet)
    	$StashLegendary = IniRead($settingsINI, "Stashing", "Legendary", $StashLegendary)
    	$StashRare = IniRead($settingsINI, "Stashing", "Rare", $StashRare)
    	$StashMagic = IniRead($settingsINI, "Stashing", "Magic", $StashMagic)
    	$StashGems = IniRead($settingsINI, "Stashing", "Gems", $StashGems)
    	$StashTomes = IniRead($settingsINI, "Stashing", "Tomes", $StashTomes)
    	$VendorSet = IniRead($settingsINI, "Vendoring", "Set", $VendorSet)
    	$VendorLegendary = IniRead($settingsINI, "Vendoring", "Legendary", $VendorLegendary)
    	$VendorRare = IniRead($settingsINI, "Vendoring", "Rare", $VendorRare)
    	$VendorMagic = IniRead($settingsINI, "Vendoring", "Magic", $VendorMagic)
    	$VendorAll  = IniRead($settingsINI, "Vendoring", "All Items", $VendorAll)
    	$vendorRows = IniRead($settingsINI, "Vendoring", "All-Rows", $vendorRows)
    	$vendorColumns = IniRead($settingsINI, "Vendoring", "All-Columns", $vendorColumns)
    	
    	$timingGameLoad = IniRead($SettingsINI, "Timing", "Game Load", $timingGameLoad)
    
        $timingTP = Iniread($SettingsINI, "Timing", "Town Portal", $timingTP)
        
    	$timingCellarClick = Iniread($SettingsINI, "Timing", "Cellar Click", $timingCellarClick)
    
        $timingLootRun = Iniread($SettingsINI, "Timing", "Loot Run", $timingLootRun)
        $timingLoot = Iniread($SettingsINI, "Timing", "Loot", $timingLoot)
        $timingAbort = Iniread($SettingsINI, "Timing", "Abort", $timingAbort)
    	$ScreenShot = InIread($SettingsINI, "Cellar Detect", "Screen Shot", $ScreenShot)
    	$RareStashilvl=IniRead($settingsINI, "Anal Loot", "Stash Rare", $RareStashiLvl)
        $RareSalvageilvl=IniRead($settingsINI, "Anal Loot", "Salvage Rare", $RareSalvageilvl)
        $RareVendoriLvl=IniRead($settingsINI, "Anal Loot", "Vendor Rare", $RareVendoriLvl)
        $MagicStashilvl=IniRead($settingsINI, "Anal Loot", "Stash Magic", $MagicStashilvl)
        $MagicSalvageilvl=IniRead($settingsINI, "Anal Loot", "Salvage Magic", $MagicSalvageilvl)
        $MagicVendorilvl=IniRead($settingsINI, "Anal Loot", "Vendor Magic", $MagicVendorilvl)
    EndFunc   ;==>ReadINI
    
    Func UpdateGUI()
    ;GUI Update
    
    ;Loot
    GUISetCheck($gameAutoStart,$cbgameAutoStart)
    GUISetCheck($LootSet,$cbLootSet)
    GUISetCheck($LootLegendary,$cbLootLegendary)
    GUISetCheck($LootRare,$cbLootRare)
    GUISetCheck($LootMagic,$cbLootMagic)
    GUISetCheck($LootCustom,$cbLootCustom)
    GUISetCheck($LootGoldOnly,$cbAddGoldOnly)
    ;=============================================
    
    ;Stash
    GUISetCheck($StashSet,$cbStashSet)
    GUISetCheck($StashLegendary,$cbStashLegendary)
    GUISetCheck($StashRare,$cbStashRare)
    GUISetCheck($StashMagic,$cbStashMagic)
    GUISetCheck($StashGems,$cbStashGems)
    GUISetCheck($StashTomes,$cbStashTomes)
    ;=============================================
    
    ;Vendor
    If Not IsChecked($cbStashSet) Then GUISetCheck($VendorSet,$cbvendorSet)
    If Not IsChecked($cbStashLegendary) Then GUISetCheck($VendorLegendary,$cbvendorLegendary)
    If Not IsChecked($cbStashRare) Then GUISetCheck($VendorRare,$cbVendorRare)
    If Not IsChecked($cbStashMagic) Then GUISetCheck($VendorMagic,$cbVendorMagic)
    GUISetCheck($VendorAll,$cbVendorAll)
    ;=============================================
    
    ;Cellar Detect
    GUISetCheck($ScreenShot,$cbCellarDetectScreenShots)
    ;=============================================
    
    
    ;Misc
    ;Skills
    SkillAlphaNum($txtSkill1,$Skill1,1)
    SkillAlphaNum($txtSkill2,$Skill2,1)
    SkillAlphaNum($txtSkill3,$Skill3,1)
    SkillAlphaNum($txtSkill4,$Skill4,1)
    
    ;AutoStart
    GUIUpdate($txtgamePassword,$gamePassword)
    GUIUpdate($txtgameDiabloIIILoc,$gameDiabloIIILoc)
    
    ;Vendoring
    GUIUpdate($cmbVendorColumns,$vendorColumns)
    GUIUpdate($cmbvendorRows,$vendorRows)
    
    ;Timing
    GUIUpdate($txttimingGameLoad, $timingGameLoad)
    
    
    
    GUIUpdate($txttimingTP, $timingTP)
    GUIUpdate($txttimingCellarClick, $timingCellarClick)
    
    
    
    
    GUIUpdate($txttimingLootRun, $timingLootRun)
    GUIUpdate($txttimingLoot, $timingLoot)
    GUIUpdate($txttimingAbort, $timingAbort)
    
    ;anal loot
    GUIUpdate($txtRareStashiLvl,$RareStashiLvl)
    GUIUpdate($txtRareSalvageiLvl,$RareSalvageiLvl)
    GUIUpdate($txtRareVendoriLvl,$RareVendoriLvl)
    GUIUpdate($txtMagicStashiLvl,$MagicStashiLvl)
    GUIUpdate($txtMagicSalvageiLvl,$MagicSalvageiLvl)
    GUIUpdate($txtMagicVendoriLvl,$MagicVendoriLvl)
    ;=============================================
    
    ;Additional
    GUIUpdate($txtAddDPS, $AddDPS) 
    ;=============================================
    EndFunc
    
    Func SaveINI()
    	FileDelete($settingsINI)
    	IniWrite($settingsINI, "Auto Start", "Auto Start", ConvertFlag($cbgameAutoStart))
    	IniWrite($settingsINI, "Auto Start", "Game Location", GUICtrlRead($txtgameDiabloIIILoc))
    	IniWrite($settingsINI, "Auto Start", "Password", GUICtrlRead($txtgamePassword))
    	IniWrite($settingsINI, "Auto Start", "Task Manager Executable Name", $gameExecutable)
    	IniWrite($settingsINI, "Skills", "Skill1", GUICtrlRead($txtSkill1))
    	IniWrite($settingsINI, "Skills", "Skill2", GUICtrlRead($txtSkill2))
    	IniWrite($settingsINI, "Skills", "Skill3", GUICtrlRead($txtSkill3))
    	IniWrite($settingsINI, "Skills", "Skill4", GUICtrlRead($txtSkill4))
    	IniWrite($settingsINI, "Additional", "DPS", GUICtrlRead($txtAddDPS))
    
    
    
    	IniWrite($settingsINI, "Looting", "Set", ConvertFlag($cbLootSet))
    	IniWrite($settingsINI, "Looting", "Legendary", ConvertFlag($cbLootLegendary))
    	IniWrite($settingsINI, "Looting", "Rare", ConvertFlag($cbLootRare))
    	IniWrite($settingsINI, "Looting", "Magic", ConvertFlag($cbLootMagic))
    	IniWrite($settingsINI, "Looting", "Custom", ConvertFlag($cbLootCustom))
    	IniWrite($settingsINI, "Looting", "Gold Only", ConvertFlag($cbAddGoldOnly))
    	IniWrite($settingsINI, "Stashing", "Set", ConvertFlag($cbStashSet))
    	IniWrite($settingsINI, "Stashing", "Legendary", ConvertFlag($cbStashLegendary))
    	IniWrite($settingsINI, "Stashing", "Rare", ConvertFlag($cbStashRare))
    	IniWrite($settingsINI, "Stashing", "Magic", ConvertFlag($cbStashMagic))
        IniWrite($settingsINI, "Stashing", "Gems",  ConvertFlag($cbStashGems))
    	IniWrite($settingsINI, "Stashing", "Tomes",  ConvertFlag($cbStashTomes))
       	IniWrite($settingsINI, "Vendoring", "Set", ConvertFlag($cbVendorSet))
    	IniWrite($settingsINI, "Vendoring", "Legendary", ConvertFlag($cbVendorLegendary))
    	IniWrite($settingsINI, "Vendoring", "Rare", ConvertFlag($cbVendorRare))
    	IniWrite($settingsINI, "Vendoring", "Magic", ConvertFlag($cbVendorMagic))
    	IniWrite($settingsINI, "Vendoring", "All Items", ConvertFlag($cbVendorAll))
    	IniWrite($settingsINI, "Vendoring", "All-Rows", GUICtrlRead($cmbvendorRows))
    	IniWrite($settingsINI, "Vendoring", "All-Columns", GUICtrlRead($cmbVendorColumns))
    
    	IniWrite($settingsINI, "Timing", "Game Load", GUICtrlRead($txttimingGameLoad))
    
    
    
    	IniWrite($settingsINI, "Timing", "Town Portal", GUICtrlRead($txttimingTP))
    	IniWrite($settingsINI, "Timing", "Cellar Click", GUICtrlRead($txttimingCellarClick))
    
    
    	IniWrite($settingsINI, "Timing", "Loot Run", GUICtrlRead($txttimingLootRun))
    	IniWrite($settingsINI, "Timing", "Loot", GUICtrlRead($txttimingLoot))
    	IniWrite($settingsINI, "Timing", "Abort", GUICtrlRead($txttimingAbort))
    	IniWrite($SettingsINI, "Cellar Detect", "Screen Shot", ConvertFlag($cbCellarDetectScreenShots))
        IniWrite($settingsINI, "Anal Loot", "Stash Rare", GUICtrlRead($txtRareStashilvl))
        IniWrite($settingsINI, "Anal Loot", "Salvage Rare", GUICtrlRead($txtRareSalvageilvl))
        IniWrite($settingsINI, "Anal Loot", "Vendor Rare", GUICtrlRead($txtRareVendoriLvl))
        IniWrite($settingsINI, "Anal Loot", "Stash Magic", GUICtrlRead($txtMagicStashilvl))
        IniWrite($settingsINI, "Anal Loot", "Salvage Magic", GUICtrlRead($txtMagicSalvageilvl))
        IniWrite($settingsINI, "Anal Loot", "Vendor Magic", GUICtrlRead($txtMagicVendorilvl))
         saveCustomKeys()
    	Call("ReadINI")
    	$StashLoot = $StashMagic  + $StashRare + $StashLegendary + $Stashset + $StashGems + $StashTomes
        $VendorLoot = $VendorMagic + $VendorRare + $VendorLegendary + $VendorSet +  $VendorAll
    EndFunc   ;==>SaveINI
    
    
    
    Func GUISetCheck($Flag,$CheckBox)
    	If $Flag = 0 Then
    		GUICtrlSetState($CheckBox, $GUI_UNCHECKED)
    	ElseIf $Flag = 1 Then
    		GUICtrlSetState($CheckBox, $GUI_CHECKED)
    	EndIf
    EndFunc
    
    Func ConvertFlag($CheckBox)
    	If GUICtrlRead($Checkbox) = 4 Or GUICtrlRead($Checkbox) = 68 Then
    		Return 0
    	Else
    		Return 1
    	EndIf
    EndFunc
    
    Func GUIUpdate($CheckBox,$Value)
    	GUICtrlSetData($CheckBox, $Value)
    EndFunc
    
    Func saveCustomKeys()
    	$string = GUICtrlRead($etlootCustom)
    	If Not $string = "" Then
    		$temp = StringReplace($string, @CRLF, " ")
    		$temp = StringStripWS($temp, 7)
    		$arr = StringSplit($temp, " ")
    
    		For $a = 1 To $arr[0]
    			$tempLoc = StringSplit($arr[$a],"|")
    			If FileExists($pngLoc & $tempLoc[1] & ".png") Then
    			IniWrite($settingsINI, "Custom Items", "Key" & $a , $arr[$a])
    			EndIf
    		Next
    		Return 1
    	 Else
       If $totalItems < 1 Then 
    		$LootCustom = "0"
    		GUICtrlSetState($cblootCustom, $GUI_UNCHECKED)
    		EndIf
    		Return @error
    	EndIf
    EndFunc
    
    Func getCustomKeys()
    	$string = ""
    	$var = IniReadSection($settingsINI, "Custom Items")
    	If Not @error Then
    		$totalItems = $var[0][0]
    		If $totalItems > 0 Then
    			ReDim $pick[$totalItems]
    		EndIf
    		For $a = 1 To $totalItems
    			$pick[$a-1] = $var[$a][1]
    			$string &= $pick[$a-1] & @CRLF
    		Next
    	Else
    		$totalItems = 0
    	 EndIf
         If $totalItems < 1 Then 
    		$LootCustom = "0"
    		GUICtrlSetState($cblootCustom, $GUI_UNCHECKED)
    	 EndIf
    	GUICtrlSetData($etlootCustom, $string)
    EndFunc
    
    Func IsChecked($control)
     Return BitAnd(GUICtrlRead($control),$GUI_CHECKED) = $GUI_CHECKED
    EndFunc
    
    Func SkillAlphaNum($txtSkill,$Skill,$UpdateFlag)
    If $UpdateFlag = 0 Then $temp = GUICtrlRead($txtSkill)
    If $UpdateFlag = 1 Then $temp = $Skill
    $temp = StringStripWS($temp, 8)
    If StringLen($temp) = 1 Then
    	If StringRegExp($temp,"[a-zA-Z0-9]") Then
    		GUICtrlSetData($txtSkill, $temp)
    			Else
    		GUICtrlSetData($txtSkill,"1")
    	EndIf
    Else
    	$temp = StringTrimRight($temp, StringLen($temp)-1)
    	GUICtrlSetData($txtSkill, $temp)
    	SkillAlphaNum($txtSkill,$Skill,$UpdateFlag)
    	EndIf
    EndFunc
    
    Func RestartRun()
    	If ($Go) Then
    		$i = 0
    		WinSetTitle($title, "", $title &  " - Running")
    		
    		MouseMove(Round(Random(0, 400) * $x_ratio), Round(Random(300, 600) * $y_ratio), 1) ;Moves mouse out of the way
    		;Checks if the player is Dead/Logout/Window, then if in Main Menu, etc.
    		If CheckDead() Then
    			Return
    		ElseIf CheckFor("ExitGame", "", Round(370 * $x_ratio), Round(232 * $y_ratio), Round(431 * $x_ratio), Round(243 * $y_ratio), 0.5, 140) Then
    			GUICtrlSetData($lblStatus, "Status: Exit window up")
    			MouseClick("left", Round(461 * $x_ratio), Round(351 * $y_ratio))
    			Sleep(Random(100, 105))
    			Send("{SPACE}")
    			Return
    		ElseIf CheckFor("MainMenu", "", Round(86 * $x_ratio),Round(225 * $y_ratio) ,Round(174 * $x_ratio),Round(240  * $y_ratio)) Then
    			GUICtrlSetData($lblRun, "Run Number: " & $run & " - Runs Per Hour: " &  Round($RunsPerHour))
    			GUICtrlSetData($lblLocation, "Location: Main Menu")
    			GUICtrlSetData($lblStatus, "Status: Starting Game")
    			WinActivate("Diablo III")
    			RandClick("left", Round(128* $x_ratio), Round(232 * $y_ratio), 10, 20, 1, 1) ;Random Click on the resume button
    			Sleep($timingGameLoad)
    		 ElseIf CheckFor("Road", "Area")  Then
    			Call("TownPortal")
    			Call("LeaveGame")
    			Return
    		ElseIf CheckFor("OldRuins", "Area") Or CheckFor("NewTristram", "Area") Or CheckFor("DankCellar", "Area") Then
    			Call("TownPortal")
    			Call("LeaveGame")
    			Return
     	    ElseIf CheckFor("Disconnect", "", Round(338 * $x_ratio), Round(230* $y_ratio), Round(461 * $x_ratio), Round(242 * $y_ratio), 1, 140) Then
    			GUICtrlSetData($lblStatus, "Status: Network Disconnect window up")
    			MouseClick("left", Round(401 * $x_ratio), Round(351 * $y_ratio),1)
     			Sleep(Random(100, 105))
    
     			Send("{SPACE}")
    			
     			Return
    		ElseIf CheckFor("LimitError", "", Round(700 * $x_ratio), Round(340 * $y_ratio), Round(1200 * $x_ratio), Round(600 * $y_ratio), 1, 140) Then
    			MouseClick("left", Round(960 * $y_ratio), Round(635 * $x_ratio),1)
     			$rand = Random(40000, 80000)
    			GUICtrlSetData($lblStatus, "Status: Input Limit - Waiting " & Round($rand / 1000) & " seconds.")
     			Sleep($rand)
    			Send("{SPACE}")
     			Return
    		 		 
    	   ElseIf CheckFor("connection", "", Round(338 * $x_ratio), Round(230* $y_ratio), Round(461 * $x_ratio), Round(242 * $y_ratio), 1, 140) Then
    			GUICtrlSetData($lblStatus, "Status: Lost Connection window up")
    			MouseClick("left", Round(401 * $x_ratio), Round(351 * $y_ratio),1)
     			Sleep(Random(100, 105))
     			Send("{SPACE}")
    		
     			Return
    			
    else
        GUICtrlSetData($lblStatus, "ERROR: Cannot find Resume button")
    			
    			Return
    		 EndIf
    		 
    		;Make sure we are in the right area before beginning run
    		If CheckFor("OldRuins", "Area") Then
    		   	$rt = TimerInit()
    			$run += 1
    			;Call("StartScreenShot")
    			GUICtrlSetData($lblLocation, "Location: Old Ruins")
    			If $StartingGold = 0 Then Call("GoldPerHour")
    			GUICtrlSetData($lblStartingG,"Staring Gold: " & $StartingGold)  
    			;Start Run
         		MouseMove(Round(262* $x_ratio ), Round(220* $y_ratio )) ;vault to stairs
    			Send($skill1)
    			sleep(random(500,520))
    			MouseMove(Round(0* $x_ratio ), Round(224* $y_ratio )) ;vault1
    			Send($Skill1)
    			sleep(random(500,520))
    			MouseMove( Round(0 * $x_ratio), Round(224* $y_ratio )) ;vault2
    			Send($Skill1)
    			sleep(random(500,520))
    			MouseMove( Round(0 * $x_ratio), Round(224* $y_ratio )) ;vault3
    			Send($Skill1)
    			sleep(random(50,75))
    			MouseMove( Round(55 * $x_ratio), Round(224* $y_ratio )) ;vault4
    			Send($Skill4) ;scatter to vaulting area
    			sleep(random(500,520))
    			Send($skill2) ;preperation to heal/regen disc
    			sleep(random(250,270))
    			Send($skill1) ;vault5
    			sleep(random(500,520))
    			
    			
    
    
    
    
    
    			If FindCellar() = 1 Then
    				If CheckDead() Then
    				  Return 
         			   EndIf
    
    			GUICtrlSetData($lblStatus, "Status: Cellar - Found")  
    			MouseClick("left",Round($cellarCoordx[$CellCoord] * $x_ratio),Round($cellarCoordy[$CellCoord] * $y_ratio),1)
    			sleep($timingCellarClick)
    			Else ;ABORT RUN
    			    ;FileMove(@ScriptDir & "\shots\Start\OpenStartShot"& $run & ".bmp", @ScriptDir & "\shots\Start\ClosedStartShot"& $run & ".bmp")
    				GUICtrlSetData($lblStatus, "Status: Cellar - Not Found" & @CRLF)
    				Sleep(Random(300, 320))
    				MouseMove(Round(396 * $x_ratio),Round(526 * $y_ratio))
    			   	Send("{SHIFTDOWN}")
    			     MouseDown("right") ;ATTACK
    			    Sleep(Random(100, 120))
    			    MouseUp("right")
    			    Send("{SHIFTUP}")
    			    Sleep(Random(50, 78))
    				send($Skill1)
    				Sleep(Random(300, 312))
    				send($Skill4)
    				Sleep(Random(200, 215))
    				randMove(Round(396 * $x_ratio),Round(526 * $y_ratio))
    				Sleep(Random(50, 61))
    			    send($Skill4)
    				Sleep(Random(100, 115))
    			    randclick("middle", Round(437* $x_ratio),Round(349 * $y_ratio) , 1, 1) 
    			    Sleep(Random(200, 215))
    			    randMove(Round(362 * $x_ratio),Round(196 * $y_ratio))
    			    send($Skill4)
    				Sleep(Random(300, 350))
    
    
    
    
    				Call("TownPortal")
    				If Not CheckDead() Then
    				   Call("ClosedCellar")
    					Call("LeaveGame")
    				EndIf
    				Return
    			EndIf
    		Else
    			Call("TownPortal")
    			If Not CheckDead() Then
    			   Call("ClosedCellar")
    				Call("LeaveGame")
    			EndIf
    			Return
    		EndIf
    
    		;Checks that the player is in the Dank Cellar
    		If CheckFor("DankCellar", "Area") Then
    			GUICtrlSetData($lblLocation, "Location: Dank Cellar")
    			Sleep(Random(500, 550))
    		 	MouseMove(round(0 * $x_ratio),Round(500 * $y_ratio)) ;moves cursor to doorway leading to rare inside cellar
    			Sleep(Random(50, 60))
    			send($skill1);vaults to doorway leading to rare inside cellar
    			sleep(random(500,520))
    
    			randclick("middle", Round(200 * $x_ratio),Round(228 * $y_ratio) , 1, 1) ;moves to doorway inside doorway
    Sleep(Random(375, 383))
    MouseMove(Round(213* $x_ratio),Round(147 * $y_ratio)) ;hovers over the rare Sarkoth
    Send($Skill4); bombs
    Sleep(Random(150, 200))
    Send($Skill3) ;cast ferret for looting
    Sleep(Random(100, 110))
    Send("{SHIFTDOWN}")
    MouseDown("right") ;cast cluster arrow 1x
    Sleep(Random(600, 650));cast cluster arrow
    MouseUp("right");end cluster arrow should shoot 2x
    MouseDown("left") ;cast hungering arrow till mobs are dead 
    sleep($attackTime/2)
    mousemove(Round(109* $x_ratio),Round(157 * $y_ratio))
    sleep($attackTime/2)
    			mousemove(Round(109* $x_ratio),Round(157 * $y_ratio))
    
    			sleep($attackTime/2)
    			MouseUp("left") ;stop cast hungering arrow
    
    			Sleep(Random(150, 156))
    			Send("{SHIFTUP}")
    			Sleep(Random(100, 110))
    			send($Skill1) ;vault to loot
    			Sleep(Random(400, 510))
    
    	  		sleep($timingLootRun)
    
    			If $LootGoldOnly = 0 then
    			GUICtrlSetData($lblStatus, "Status: Looting")
    				Call("Loot")
    		 	EndIf			
    			Sleep(Random(100, 110))
    
    
    			Call("TownPortal")
    		 Else
    			$countMissedCellar += 1
    			   Call("CellarScreenShot")
    		    MouseMove(Round(396 * $x_ratio),Round(526 * $y_ratio))
    
    
    		  	Send("{SHIFTDOWN}")
    			MouseDown("right") ;ATTACK
    			Sleep(Random(100, 120))
    			MouseUp("right")
    			Send("{SHIFTUP}")
    			Sleep(Random(50, 78))
    			send($Skill1)
    			Sleep(Random(300, 312))
    			send($Skill4)
    			Sleep(Random(200, 215))
    			randMove(Round(396 * $x_ratio),Round(526 * $y_ratio))
    			Sleep(Random(50, 61))
    			send($Skill4)
    			Sleep(Random(100, 115))
    
    
    
    
    
    			Call("TownPortal")
    			If Not CheckDead() Then
    			    Call("ClosedCellar")
    				Call("LeaveGame")
    			EndIf
    			Return
    		EndIf
    		;After successful run
    		If Not CheckDead() Then
    			Sleep(Random(300, 305))
    			If $mLootIn = 1 And CheckFor("NewTristram", "Area") Then ;If its time to manage loot and we are in town
    				If $LootGoldOnly = 0 Then
    				  If $StashLoot >= 1 Then
    					Call("StashLoot")
    				  EndIF
    				EndIF		
    
    
    			ElseIf Not CheckFor("NewTristram", "Area") Then
    			GUICtrlSetData($lblStatus, "Status: Skipping vendor, not in New Tristram")
    				Sleep(Random(3000, 3005))
    			ElseIf $mLootIn = 1 Then
    				$mLootIn = 0
    			EndIf
    	
    
    			If Not CheckDead() Then
    			    Call("OpenCellar")
    				Call("LeaveGame")
    			EndIf
    			Return
    		Else
    			Return
    		 EndIf
    	  Else
    		 Return 0
    	 EndIf
    EndFunc   ;==>RestartRun
    
    Func CheckDead()
    	$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
    	If Not @error Then
    	GUICtrlSetData($lblStatus, "Status: Logging out")
    		Sleep(11000)
     		Sleep($timingGameLoad)
     		Return 1
     	EndIf
    
     	$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
     	If Not @error Then
    GUICtrlSetData($lblStatus, "Status: Open Window")
     	Sleep(200)
     		Send("{SPACE}") ;close any open windows
    		Return 1
    	EndIf	
     
    
    
     	$YouHaveDied = PixelSearch(Round(285* $x_ratio), Round(491* $y_ratio), Round(308* $x_ratio), Round(508* $y_ratio), 0x2C0100,2) ; checks for white text "YOU HAVE DIED"
    	If Not @error Then
    		GUICtrlSetData($lblStatus, "Status: Dead")
    		$deathCount += 1
    		Call("LeaveGame")
    		Sleep(Random(11000, 11005)
    		
    		Sleep($timingGameLoad)
    		Return 1
    	Else
    		Return 0
    	EndIf
    EndFunc   ;==>CheckDead
    
    
    Func CheckRepair()
    	$RepairArea = PixelSearch(Round(552 * $x_ratio),Round(6* $y_ratio),Round(589 * $x_ratio),Round(51 * $y_ratio), $yellow)
    	If Not @error Then
    		Call("DoRepair")
    	EndIf
    	$RepairAreaRed = PixelSearch(Round(552 * $x_ratio),Round(6 * $y_ratio),Round(589 * $x_ratio),Round(51 * $y_ratio), $red)
    	If Not @error Then
    		Call("DoRepair")
    	EndIf
    EndFunc   ;==>CheckRepair
    
    Func DoRepair()
    Sleep(Random(2500, 2550))
    
    $repairCount += 1
    	If CheckDead() Then
    		Return
    	EndIf
    	If CheckFor("NewTristram", "Area") Then
            RandClick1("middle", Round(755 * $x_ratio),Round(29 * $y_ratio), 1, 1) ;step1
    		Sleep(Random(3500, 3550))
    
    
    
    		RandClick1("left", Round(405 * $x_ratio),Round(123 * $y_ratio), 1, 1) ;vendor
    		Sleep(Random(2100,2110))
    
    	    RandClick("left", Round(282 * $x_ratio),Round(267 * $y_ratio), 1, 1) ;button to open up repair menu
    		Sleep(Random(400, 412))
    		RandClick("left", Round(142 * $x_ratio),Round(295 * $y_ratio), 1, 1) ;button to pay for repairs
    		Sleep(Random(200, 212))
    		Send("{Escape}")
    	EndIf
    EndFunc   ;==>DoRepair
    
    
    Func ClosedCellar()
    	   $closedcellarCount += 1
    	   $srt = TimerDiff($rt)
       	   $ClosedCellarSec = $ClosedCellarSec + Round($srt / 1000, 2)
    	   $ClosedCellarAvg = $ClosedCellarSec / $closedcellarCount
    	EndFunc
    	
    Func OpenCellar()
    	   $cellarCount += 1
       	   $srt = TimerDiff($rt)
    	   $OpenCellarSec = $OpenCellarSec + Round($srt / 1000, 2)
    	   $OpenCellarAvg = $OpenCellarSec / $cellarCount
       EndFunc
    
    Func CalcTime()
    	$trt = TimerDiff($t)
    	$total = Round((($trt / 1000) / 60) / 60, 4)
    	;Total runtime calculation.
    	$hours = Floor((($trt / 1000) / 60) / 60)
    	$minutes = (($trt / 1000) / 60)
    	;trim minutes if runtime is more then 1 hour.
    	If $minutes > 60 Then
    		While $minutes > 60
    			$minutes -= 60
    		WEnd
    	 EndIf
    	 $RunsPerHour = $Run / ($trt / 1000) * 3600
    	 $repairCountPercent = $repairCount / $run
         $deathsCountPercent = $deathCount / $run
         $cellarCountPercent = $cellarCount /  $run
         $closedCellarCountPercent = ($run - $cellarCount) / $run
    	 $MissedCellarCountPercent = $countMissedCellar / $run
    	 GUICtrlSetData($lblRuntime, "Total Runtime: " & $hours & " hours, " & Ceiling($minutes) & " minutes")
    	 GUICtrlSetData($lblLast, "Open Cellar Avg: " & Round($OpenCellarAvg,1) & "s - Closed Cellar Avg: " & Round($ClosedCellarAvg,1) & "s")
    	 GUICtrlSetData($lblCellars, "Cellars Open: " & $cellarCount & " (" & Round($cellarCountPercent * 100) & "%)" &  " - Cellars Closed: " & $run - $cellarCount & " (" & Round($closedCellarCountPercent * 100,.00) & "%)")
    	 GUICtrlSetData($lblStats, "Deaths: " & $deathCount &  " (" & Round($deathsCountPercent * 100) & "%" & ")" &  " - Missed Cellars: " & $countMissedCellar & " (" & Round($MissedCellarCountPercent * 100) & "%)")
    EndFunc   ;==>CalcTime
    
    Func CheckFor($img, $type = "", $startX = 0, $startY = 0, $endX = @DesktopWidth, $endY = @DesktopHeight, $seconds = 6, $tolerance = 140)
    	If $type = "Area" Then
    		$startX = 650 * $x_ratio
    		$startY = 0 * $y_ratio
    		$endX = 800 * $x_ratio
    		$endY = 50 * $y_ratio
    		$seconds = 2.5
    	EndIf
    	$c = 0
    	$string = $pngLoc & $img & ".png"
    	Do
    		$c += 1
    		Sleep(Random(100, 105))
    		
    		If $c > ($seconds * 10) Then ;Make sure we never get stuck here for infinity.
    			If $type = "Area" Then
    				GUICtrlSetData($lblStatus, "Status: Area not found - " & $img)
    			EndIf
    			Return 0
    		EndIf
    	 Until _ImageSearchArea($string, 1, $startX, $startY, $endX, $endY, $gX, $gY, $tolerance)
    	Return 1
    EndFunc   ;==>CheckFor
    
    
    Func Loot()
    	Sleep($timingLoot)
    	MouseMove(Round(Random(0, 400) * $x_ratio), Round(Random(300, 600) * $y_ratio), 3) ;Moves mouse out of the way
    	If $LootSet == 1 Then
    		$SetCount += LootGear(0x02CE01)		
    	EndIf
    	
    	If $LootLegendary == 1 Then
    		$LegendaryCount += LootGear(0xBF642F, 0)
    	EndIf
    	
    	If $LootRare == 1 Then
    		$RareCount += LootGear(0xBBBB00)
    	EndIf
    	
    	If $LootCustom == 1 Then
    		Call("LootCustom")
    	EndIf
    	
    	If $LootMagic == 1 Then
    		$MagicCount += LootGear(0x6969FF)
    	EndIf
    	call("Showloot")
    EndFunc   ;==>Loot
     
     Func LootCustom()
    	$count = 0
    	$gX = 0
    	$gY = 0
    	For $i = 0 To ($totalItems - 1)
    		$array = StringSplit($pick[$i], "|")
    		$file = $array[1]
    		$accuracy = $array[2]
    		$urlString = $pngLoc & $file & ".png"
    		While _ImageSearchArea($urlString, 1, 0, 0, @DesktopWidth, @DesktopHeight, $gX, $gY, $accuracy)
    			$count += 1
    			MouseClick("left", $gX, $gY, 1, 3)
    			Sleep(Random(50, 55))
    
    			MouseMove(Round(Random(0, 400) * $x_ratio), Round(Random(300, 600) * $y_ratio), 3) ;Moves mouse out of the way
    			Sleep($timingLoot)
    			If $count >= 15 Then
                            ExitLoop
                    EndIf
    		WEnd
    	Next
    EndFunc   ;==>LootCustom
     
    Func LootGear($color, $tolerance = 3)
    	$count = 0
    	$Loot = PixelSearch(Round(0 * $x_ratio), Round(75*$y_ratio), Round(800 * $x_ratio), Round(400 * $y_ratio), $color, $tolerance)
    	If Not @error Then
    		While Not @error
    			$count += 1
    			MouseClick('left', $Loot[0], $Loot[1], 1, 3)
    			Sleep(Random(50, 55))
    
    			MouseMove(Round(Random(0, 400) * $x_ratio), Round(Random(300, 600) * $y_ratio), 1) ;Moves mouse out of the way
    			sleep($timingLoot)
    			If $count >= 15 Then
                            ExitLoop
                    EndIf
    			$Loot = PixelSearch(Round(0 * $x_ratio), Round(75*$y_ratio), Round(800 * $x_ratio), Round(400 * $y_ratio), $color, $tolerance)
    		WEnd
    	EndIf
    	Return $count
    
     EndFunc   ;==>LootGear
     
     Func CheckFullInventory()
    
     If Not _ImageSearchArea($pngLoc &  "FullInventory.png", 1, Round(518* $x_ratio),Round(329 * $y_ratio), Round(788 * $y_ratio),Round(484 * $x_ratio), $gX, $gY, 140) Then
    	  $mLootIn = 1
    	  If $StashLoot = 0 And $VendorLoot = 0 Then 
    		 $LootGoldOnly = 1
    	 EndIf
    	 Return 0
    
       Else
       $mLootIn = 0
    		 Return 1
    EndIf
    Return
      EndFunc
      
    
    Func StashLoot()
       MouseClick("left", 442* $x_ratio,121* $y_ratio)
       Sleep(Random(1600, 1620))
    
    GUICtrlSetData($lblStatus, "Status: Putting Items in Stash")
       If $StashSelectedTab > 0 Then MouseClick("left", Round($StashTabs[$StashSelectedTab][0] * $x_ratio) ,Round($StashTabs[$StashSelectedTab][1] * $x_ratio), 1, 4)
    
    If $AnalLoot = 1 And $StashLoot > 0 Then
    	 MouseMove(Round($StashTabs[$StashSelectedTab][0] * $x_ratio) ,Round($StashTabs[$StashSelectedTab][1] * $x_ratio), 2)
    	 AnalLoot()
    	 Send("{SPACE}")
       If $AnalSalvage = 1 Then
    	  If $AnalRareIdentify = 1 Then
    	   DoIdentify()
    	  EndIf
    	   DoSalvage()
    	EndIf
    	If $AnalVendor = 1 Then
    	    If $AnalRareIdentify = 1 Then
    	   DoIdentify()
    	  EndIf
       VendorLoot()
       EndIf
    EndIF
    $AnalSalvage = 0 
    $AnalRareIdentify = 0  
    $AnalVendor = 0
     EndFunc   ;==>StashLoot
    
    
     Func CheckFullStash()
    If _ImageSearchArea($pngLoc &  "FullStash.png", 1, Round(320 * $x_ratio),Round(72 * $y_ratio), Round(376 * $y_ratio),Round(88 * $x_ratio), $gX, $gY, 140) Then
       If $StashSelectedTab < 2 Then
    	  $StashSelectedTab += 1
       ElseIf $StashSelectedTab = 2 Then
    	  $StashLoot = 0
    	  Return 0
       EndIf
    Do 
    Sleep(Random(100, 105))
       Until Not _ImageSearchArea($pngLoc &  "FullStash.png", 1, Round(320 * $x_ratio),Round(72 * $y_ratio), Round(376 * $y_ratio),Round(88 * $x_ratio), $gX, $gY, 140)
    
    MouseClick("left", Round($StashTabs[$StashSelectedTab][0] * $x_ratio) ,Round($StashTabs[$StashSelectedTab][1] * $x_ratio), 1, 4)
    EndIf
     Return 1
       EndFunc
     
     Func AnalScan()
        GUICtrlSetData($lblStatus, "Status: Unhighlighting new items")
        For $i = 0 To 9
          For $j = 0 To 5
          MouseMove(Round(($slot1x + ($i * $offset)*$x_ratio)),Round(($slot1y + ($j * $offset)) * $y_ratio), 1)
          Next
       Next
    EndFunc
    
     Func AnalLoot()
    DebugLog(@CRLF & "iLvl Analyzing " & @CRLF & _
    	"****************************************************")
    	GUICtrlSetData($lblStatus, "Status: Stashing And Analyzing Loot")
    	AnalScan()
    	ArrayClear($AnalyzedLoot)
    	$rt = TimerInit()
    
    	For $i = 0 To 9
    			   For $j = 0 To 5
    	  $SlotPixelLine = PixelSearch(Round($slotLineTopX + $i * $slotLineOffSet * $x_ratio), Round($slotLineTopY  + $j * $slotLineOffSet * $y_ratio), Round($slotLineBotX + $i * $slotLineOffSet * $x_ratio), Round($slotLineBotY + $j * $slotLineOffSet * $y_ratio), 0x35251C,1)
    	  $MiddleOfCell = PixelSearch(Round($CellMiddleTopX + $i * $CellMiddleO * $x_ratio), Round($CellMiddleTopY  + $j * $CellMiddleO * $y_ratio), Round($CellMiddleBotX+ $i * $CellMiddleO * $x_ratio), Round($CellMiddleBotY + $j * $CellMiddleO * $y_ratio), 0x130C08,1)
       If Not IsArray($MiddleOfCell) Then
    	  If IsArray($SlotPixelLine) Or $slotError >= 1 Or $j = 0 Then
    		 $slotError  = 0
    	  MouseMove(Round($slot1x + $i * $offset * $x_ratio), Round($slot1y + $j * $offset * $y_ratio),1)
          Sleep($AnalSpeed)
    	  $ItemInfo = StringSplit(GetItemInfo(), ",")
    
    	  If StringRegExp($ItemInfo[1],"Magic")  Then
    	  DebugLog("Magic Item Found iLvl=" &$ItemInfo[2]&" @ Cell " & $i & "," & $j)
    	   
    		 If $ItemInfo[2] < 0 Then
    			$AnalyzedLoot[$i][$j] = Round($slot1x + $i * $offset * $x_ratio) & "," & Round($slot1y + $j * $offset * $y_ratio) & ",Vendor,Magic," & $ItemInfo[2]
    			$AnalVendor = 1
    		  Else
    			If $ItemInfo[2] >= $MagicStashiLvl Then
    			   GUICtrlSetData($lblStatus, "Status: " & $ItemInfo[2] & " Stashing Magic @ " & $i & "," & $j)
    			   $AnalyzedLoot[$i][$j] = Round($slot1x + $i * $offset * $x_ratio) & "," & Round($slot1y + $j * $offset * $y_ratio) & ",Stashed,Magic," & $ItemInfo[2]
    			   MouseClick("Right", Round($slot1x + $i * $offset * $x_ratio), Round($slot1y + $j * $offset * $y_ratio), 1)
    
    
    			Elseif $ItemInfo[2] <= $MagicSalvageiLvl And $ItemInfo[2] > $MagicVendoriLvl Then
    			   GUICtrlSetData($lblStatus, "Status: " & $ItemInfo[2] & " Salvaging Magic @ " & $i & "," & $j)
    			   $AnalyzedLoot[$i][$j] = Round($slot1x + $i * $offset * $x_ratio) & "," & Round($slot1y + $j * $offset * $y_ratio) & ",Salvage,Magic," & $ItemInfo[2]
    			   $AnalSalvage = 1
    			   
    			Elseif $ItemInfo[2] <= $MagicVendoriLvl Then
    			   GUICtrlSetData($lblStatus, "Status: " & $ItemInfo[2] & " Vendoring Magic @ " & $i & "," & $j)
    			   $AnalyzedLoot[$i][$j] = Round($slot1x + $i * $offset * $x_ratio) & "," & Round($slot1y + $j * $offset * $y_ratio) & ",Vendor,Magic," & $ItemInfo[2]
    			   $AnalVendor = 1
    
    			EndIf
    		 EndIf
    	  ElseIf StringRegExp($ItemInfo[1],"Rare") Then
    
    		DebugLog("Rare Item Found iLvl=" &$ItemInfo[2]&" @ Cell " & $i & "," & $j)
    	   
    		 If $ItemInfo[2] < 0 Then
    			$AnalyzedLoot[$i][$j] = Round($slot1x + $i * $offset * $x_ratio) & "," & Round($slot1y + $j * $offset * $y_ratio) & ",Vendor,Rare," & $ItemInfo[2]
    			$AnalRareIdentify = 1
    			$AnalVendor = 1
    			
    		  Else
    			If $ItemInfo[2] >= $RareStashiLvl Then
    			   GUICtrlSetData($lblStatus, "Status: " & $ItemInfo[2] & " Stashing Rare @ " & $i & "," & $j)
    			   $AnalyzedLoot[$i][$j] = Round($slot1x + $i * $offset * $x_ratio) & "," & Round($slot1y + $j * $offset * $y_ratio) & ",Stashed,Rare," & $ItemInfo[2]
    			   MouseClick("Right", Round($slot1x + $i * $offset * $x_ratio), Round($slot1y + $j * $offset * $y_ratio), 1)
    
    
    
    			Elseif $ItemInfo[2] <= $RareSalvageiLvl And $ItemInfo[2] > $RareVendoriLvl Then
    			   GUICtrlSetData($lblStatus, "Status: " & $ItemInfo[2] & " Salvaging Rare @ " & $i & "," & $j)
    			   $AnalyzedLoot[$i][$j] = Round($slot1x + $i * $offset * $x_ratio) & "," & Round($slot1y + $j * $offset * $y_ratio) & ",Salvage,Rare," & $ItemInfo[2]
    			   $AnalRareIdentify = 1
    			   $AnalSalvage = 1
    			   
    			ElseIf $ItemInfo[2] <= $RareVendoriLvl Then
    			   GUICtrlSetData($lblStatus, "Status: " & $ItemInfo[2] & " Vendoring Rare @ " & $i & "," & $j)
    			   $AnalyzedLoot[$i][$j] = Round($slot1x + $i * $offset * $x_ratio) & "," & Round($slot1y + $j * $offset * $y_ratio) & ",Vendor,Rare," & $ItemInfo[2]
    			   $AnalRareIdentify = 1
    			   $AnalVendor = 1
    
    			EndIf
    		 EndIf
    	  ElseIf StringRegExp($ItemInfo[1],"Set") Or StringRegExp($ItemInfo[1],"Legendary") Then
    
    		 DebugLog($ItemInfo[1] & " Item Found iLvl=" &$ItemInfo[2]&" @ Cell " & $i & "," & $j)
    		 GUICtrlSetData($lblStatus, "Status: " & $ItemInfo[2] & " Stashing " & $ItemInfo[1] & " @ " & $i & "," & $j)
    		 $AnalyzedLoot[$i][$j] = Round($slot1x + $i * $offset * $x_ratio) & "," & Round($slot1y + $j * $offset * $y_ratio) & ",Stashed,Set/Legendary," & $ItemInfo[2]
    		 MouseClick("Right", Round($slot1x + $i * $offset * $x_ratio), Round($slot1y + $j * $offset * $y_ratio), 1)
    
    
     ElseIf StringRegExp($ItemInfo[1],"Crafting") Or StringRegExp($ItemInfo[1],"Tomes") Or StringRegExp($ItemInfo[1],"Gem") Or StringRegExp($ItemInfo[1],"Tome") _
    	  Or StringRegExp($ItemInfo[1],"RareRing") Or StringRegExp($ItemInfo[1], "RareAmmy") Or StringRegExp($ItemInfo[1], "BlackSmithPlan") Then 
    	  
    	 DebugLog($ItemInfo[1] & " @ Cell " & $i & "," & $j)
         GUICtrlSetData($lblStatus, "Status: Stashing " & $ItemInfo[1] & " @ " & $i & "," & $j)
         $AnalyzedLoot[$i][$j] = Round($slot1x + $i * $offset * $x_ratio) & "," & Round($slot1y + $j * $offset * $y_ratio) & ",Stashed," &$ItemInfo[1]& ",0"
    	 MouseClick("Right", Round($slot1x + $i * $offset * $x_ratio), Round($slot1y + $j * $offset * $y_ratio), 1)
    	 
    	  ElseIf $ItemInfo[1] = 0 Then
    		 
    		 DebugLog("Unknown Item Found iLvl=0 @ Cell " & $i & "," & $j)
    		 GUICtrlSetData($lblStatus, "Status:  Vendoring Unknown @ " & $i & "," & $j)
      	     $AnalyzedLoot[$i][$j] = Round($slot1x + $i * $offset * $x_ratio) & "," & Round($slot1y + $j * $offset * $y_ratio) & ",Vendor,Unknown,0"
    		 $AnalVendor = 1
    		 
      Else
    	  $slotError += 1
        EndIF	 
       EndIf	
     EndIf
    	  If CheckFullStash() = 0 Then ExitLoop
    	  Next
       Next
       $srt = TimerDiff($rt)
       $AnalTime = Round($srt / 1000, 2)
          DebugLog(@CRLF & "iLvl Analyzing took " & $AnalTime & " Seconds" & @CRLF & _
    	"****************************************************")
       ToolTip("")
     EndFunc   ;==>AnalLoot
     
    Func DoIdentify()
       DebugLog("Identifying Rare Items" & @CRLF & _
    	"****************************************************")
       Send("c")
       $arr = 0
    		For $i = 0 To 9
    			   For $j = 0 To 5
    				  If StringRegExp($AnalyzedLoot[$i][$j],"Rare") Then
    				  $arr = StringSplit($AnalyzedLoot[$i][$j], ",")
    				  DebugLog("Rare to Identify "  & $i & "," & $j)
    				  GUICtrlSetData($lblStatus, "Status: " & $arr[5] & " Identify " & $arr[4] & " @ Cell " & $i & "," & $j)
    				  MouseClick("Right",$arr[1],$arr[2],2)
                      Sleep(Random(2900, 3000))
    				  ToolTip("")
    				  EndIF
    	  Next	
       Next
       Send("c")
       $AnalRareIdentify = 0
       EndFunc
       
    Func DoSalvage()
    	DebugLog("Salvaging Items")
    	MouseClick("Left",Round(799 * $x_ratio),Round(290 * $y_ratio),1)
    
    	Sleep(Random(1600, 1620))
    	MouseClick("Left",Round(562 * $x_ratio),Round(211 * $y_ratio),1)
    	Sleep(Random(1000, 1010))
    
    	MouseClick("Left",Round(286 * $x_ratio),Round(268 * $y_ratio),1)
    	Sleep(Random(300, 305))
    
    	MouseClick("Left",Round(151 * $x_ratio),Round(159 * $y_ratio),1)
    	 If Not _ImageSearchArea("CurrentInventory.png", 1, Round(625 * $x_ratio), Round(93 * $y_ratio), Round(772 * $x_ratio), Round(300 * $y_ratio), $gX, $gY, 9) Then
    			GUICtrlSetData($lblStatus, "Status: Frozen to prevent vendor of worn item, sorry....")
    			TogglePause()
    					 EndIf
    	$arr = 0
    		For $i = 0 To 9
    			   For $j = 0 To 5
    				  If StringRegExp($AnalyzedLoot[$i][$j],"Salvage") Then
    				  $arr = StringSplit($AnalyzedLoot[$i][$j], ",")
    				  DebugLog("Item to Salvage " & $arr[4] & " " & $i & "," & $j)
    				  GUICtrlSetData($lblStatus, "Status: " & $arr[5] & " Salvaging " & $arr[4] & " @ Cell " & $i & "," & $j)
    				  MouseClick("Left",$arr[1],$arr[2],1)
    				  If $arr[4] == "Rare" Then
    					Send("{Enter}") 
    				  EndIf
    				  sleep(150)
    				  EndIF
    	  Next	
       Next
       ToolTip("")
       Send("{Space}")
       EndFunc
    
    
    Func VendorLoot()
    	   If $AnalSalvage = 1 Then
    		MouseClick("left",Round(517 * $x_ratio), Round(15 * $y_ratio), 6) ;NPC Merchant to the right of cain's home
    		Sleep(Random(2200, 2210))
    		
    
    		MouseClick("left",Round(279 * $x_ratio), Round(218 * $y_ratio), 6) ;NPC Merchant to the right of cain's home
    		Sleep(Random(500, 550))
    		
    
    		Else
    Sleep(Random(500, 550))
    		RandClick1("middle", Round(755 * $x_ratio),Round(29 * $y_ratio), 1, 1) ;step1
    
    		Sleep(Random(3500, 3550))
    
    
    
    
    		RandClick1("left", Round(405 * $x_ratio),Round(123 * $y_ratio), 1, 1) ;vendor
    		Sleep(Random(2800, 2850))
    		EndIf
    
    		Sleep(Random(300, 310))
    
    		$arr = 0
    		If Not _ImageSearchArea("CurrentInventory.png", 1, Round(625 * $x_ratio), Round(93 * $y_ratio), Round(772 * $x_ratio), Round(300 * $y_ratio), $gX, $gY, 9) Then
    		  TogglePause()	  
    		  GUICtrlSetData($lblStatus, "Status: Frozen to prevent salvage of worn item, sorry....")
    		 EndIf
    	    
    
    		For $i = 0 To 9
    			   For $j = 0 To 5
    				  If StringRegExp($AnalyzedLoot[$i][$j],"Vendor") Then
    				  $arr = StringSplit($AnalyzedLoot[$i][$j], ",")
    				  DebugLog("Item To Vendor  " & $arr[4] & " " & $i & "," & $j)
    				  GUICtrlSetData($lblStatus, "Status: " & $arr[5] & " Vendoring " & $arr[4] & " @ Cell " & $i & "," & $j)
    
    				  MouseClick("Right",$arr[1],$arr[2],1)
    				  EndIF
    	  Next	
       Next
        ToolTip("")
    	Sleep(Random(200, 205))
    	RandClick("left", Round(282 * $x_ratio),Round(267 * $y_ratio), 1) ;button to open up repair menu
        Sleep(Random(400, 405))
    
        RandClick("left", Round(142 * $x_ratio),Round(295 * $y_ratio), 1) ;button to pay for repairs
        Sleep(Random(200, 205))
    
    	Send("{ESCAPE}")
     EndFunc   ;==>VendorLoot
    
    
    
    Func GetItemInfo()
       $gX = 0
       $gY = 0
       $Type = 0
       $CheckRing = 0
       $mousePos = MouseGetPos()
       Local $Rings[2] = ["RareRing","RareAmmy"]
       Local $MiscItems[4] = ["Crafting","Tomes","Gem","BlackSmithPlan"]
       Local $ItemQuality[8] = ["Magic","MagicRed","Rare","RareRed","Legendary","LegendaryRed","Set","SetRed"]
    
    
       For $i = 0 to Ubound($ItemQuality) -1
    	  If _ImageSearchArea($pngLoc & $ItemQuality[$i] & ".png",1, Round($mousePos[0] - 300 * $x_ratio), 0, Round($mousePos[0] + 70 * $x_ratio),900,$gX,$gY, 100) Then
    	  $Type = $ItemQuality[$i]
    		 If StringRegExp($Type,"Rare") Or StringRegExp($Type,"Legendary") Or StringRegExp($Type,"Set") Then
    		 $CheckRing = 1
    	  EndIf
    	  ExitLoop
       Else
    	  $Type = 0
    	  EndIf
       Next
    
       If $CheckRing = 1 Then
       For $i = 0 to Ubound($Rings) -1
    	  If _ImageSearchArea($pngLoc & $Rings[$i] & ".png",1, Round($mousePos[0] - 300 * $x_ratio), 0, Round($mousePos[0] + 70 * $x_ratio), $size[1],$gX,$gY, 100) Then
    		 Return $Rings[$i] & "," & $RareStashiLvl
    		 ExitLoop
    	  EndIf
       Next
       
       ElseIf $Type = 0 Then
       For $i = 0 to Ubound($MiscItems) -1
    	 If _ImageSearchArea($pngLoc & $MiscItems[$i] & ".png",1, Round($mousePos[0] - 300 * $x_ratio), 0, Round($mousePos[0] + 70 * $x_ratio), $size[1],$gX,$gY, 100) And $CheckRing = 1 Then
    		  Return $MiscItems[$i] & "," & $RareStashiLvl
    		  Exitloop	  
    		EndIf
       Next
       EndIf
    
    	If _ImageSearchArea($pngLoc & "ItemLevel800x600.png",1, Round($mousePos[0] - 300 * $x_ratio), 0, Round($mousePos[0] + 70 * $x_ratio), $size[1],$gX,$gY, 90) Then
    	$capture = _TesseractScreenCapture(0, "", 1, 11, Round($gX - 5 * $x_ratio), Round($gY - 10 * $y_ratio), Round($gX + 40 * $x_ratio), Round($gY + 10 * $y_ratio), 0)
    	$Fixed = StringRegExpReplace($capture,"Q","9")
    	$iLvl = StringRegExpReplace($Fixed,"[a-zA-Z|:;~.,»<?_=+|-]","")
    	$StringLength = StringLen($iLvl)
    	If $StringLength > 2 Then
    	   $StringLength -= 3
    	   $iLvl = StringMid($iLvl, $StringLength, 2)
        EndIF
    	Return $Type & "," & $iLvl
        Else
    	Return 0
    	EndIf
     EndFunc
    
    
    Func _ImageSearchArea($findImage, $resultPosition, $x1, $y1, $right, $bottom, ByRef $x, ByRef $y, $tolerance)
    	If $tolerance > 0 Then $findImage = "*" & $tolerance & " " & $findImage
    	$findImage = "*TRANSBLACK " & $findImage
    	If @AutoItX64 Then
    		$result = DllCall("ImageSearchDLL_x64.dll", "str", "ImageSearch", "int", $x1, "int", $y1, "int", $right, "int", $bottom, "str", $findImage)
    	Else
    		$result = DllCall("ImageSearchDLL.dll", "str", "ImageSearch", "int", $x1, "int", $y1, "int", $right, "int", $bottom, "str", $findImage)
    	EndIf
    	If $result = "0" Then
    		Return 0
    	EndIf
    
    	; Otherwise get the x,y location of the match and the size of the image to
    	; compute the centre of search
    	$array = StringSplit($result[0], "|")
    	If (UBound($array) >= 4) Then
    		$x = Int(Number($array[2]))
    		$y = Int(Number($array[3]))
    		If $resultPosition = 1 Then
    			$x = $x + Int(Number($array[4]) / 2)
    			$y = $y + Int(Number($array[5]) / 2)
    		EndIf
    		Return 1
    	EndIf
     EndFunc   ;==>_ImageSearchArea
     
    Func FindCellar()
       $CellCoord = 0
       $gY = 0
       $gX = 0 
      
       ;A precheck to the cellar search
       _ImageSearchArea($pngLoc & "Cellar.png", 1,Round(670 * $x_ratio),Round(90 * $y_ratio) ,Round(691 * $x_ratio),Round(110 * $y_ratio), $gX, $gY, 160)
       sleep($cellarCheckSleep)
       If $gX > 0 Or $gY > 0 then
    	  Do
    		 MouseMove(Round($cellarCoordx[$CellCoord] * $x_ratio), Round($cellarCoordy[$CellCoord] * $y_ratio),1) ;moves cursor over to the cellar
    		 sleep($cellarCheckSleep)
    
    		 $Pixel2 = PixelSearch(Round($cellarCoordx[$CellCoord] * $x_ratio - 65),Round($cellarCoordy[$CellCoord] * $y_ratio - 50),Round($cellarCoordx[$CellCoord] * $x_ratio + 50),Round($cellarCoordy[$CellCoord] * $x_ratio + 65), 0x375BC6, 3) ;checks for open cellar (in a 600x400 box from the top left - where it should always be)
    
    
    
    		 If Not @Error Then
    			;Msgbox("4096","found it","Found it")
    			Return 1
    		 EndIf
    		 $CellCoord += 1
    	  Until $CellCoord >= Ubound($cellarCoordx)
       Else
    	  Return 0
       EndIf
       $countMissedCellar += 1
       Call("CellarScreenShot")
       Return 0
    EndFunc
    
    Func CellarScreenShot()
       If $ScreenShot = 1 Then
    			   _ScreenCapture_SetBMPFormat(0)
    			   _ScreenCapture_Capture(@ScriptDir & "\shots\Cellar\CellarShot"& $run & "c" & $CellCoord & ".bmp")
    			EndIf
    		 EndFunc
    		 
     Func GoldPerHour()
    Send("i")
    Sleep(Random(750, 800))
    If $CurrentItems = 0 Then
       Call("ScreenShotInventory")
    EndIf
    CheckFullInventory()
    $CurrentGoldCaptured = _TesseractGoldCapture(0, "", 1,  6,544*$x_ratio, 281*$y_ratio, 607*$x_ratio, 292*$y_ratio, 0)
    Sleep(Random(190, 200))
    Send("i")
    
    $CurrentGoldInteger = ""
    
    
    For $i = 1 to stringlen($CurrentGoldCaptured)
    $chr = asc(StringMid($CurrentGoldCaptured, $i, 1))
    if $chr >= 48 And $chr <= 57 Then $CurrentGoldInteger = $CurrentGoldInteger & chr($chr)
    Next
    
    
    $trt = TimerDiff($t)
    $SecondsRan = $trt / 1000
    
    If $StartingGold <= 0 Then $StartingGold = $CurrentGoldInteger
    If $StartingGold > 0 Then $AccumulatedGold = $CurrentGoldInteger - $StartingGold
    $GPH = $AccumulatedGold / $SecondsRan * 60 * 60
    
    $GPH=(Round($GPH,0))
    
    If $GPH >= 0 and $AccumulatedGold >=0 then
      GUICtrlSetData($lblStartingG,"Staring Gold: " & $StartingGold)
      GUICtrlSetData($lblGold,$GPH & " Per Hour - Accumulated Gold: " & $AccumulatedGold)
      
    EndIf
    
    EndFunc ;==>GoldPerHour
    
    Func LeaveGame()
       GUICtrlSetData($lblStatus, "Status: Leaving Game")
    	Send("{SPACE}")
    	sleep(200)
    	Send("{Escape}")
    	RandClick("left", Round(398 * $x_ratio),Round(322 * $y_ratio), 10, 2) ;Random Click on the leave button
    	Call("CalcTime")
    	Sleep($timingGameLoad)
    EndFunc   ;==>LeaveGame
    
     
    Func TownPortal()
    GUICtrlSetData($lblStatus, "Status: Returning to Town")
       	Sleep(Random(200, 205))
    Send($Skill3)
    Sleep(Random(50, 65))
    	Send("t")
    	Call("GoldPerHour")
    	Sleep($timingTP)
    	Call("CheckRepair")
    EndFunc   ;==>TownPortal
    
    Func RandClick($clickType, $xPos, $yPos, $xOff = 5, $yOff = 5, $clicks = 1, $speed = 1)
    	If $xOff < 1 Then $xOff = 1
    	If $yOff < 1 Then $yOff = 1
    	$randX = Round(Random($xPos - ($xOff * $x_ratio), $xPos + ($xOff * $x_ratio)))
    	$randY = Round(Random($yPos - ($yOff * $y_ratio), $yPos + ($yOff * $y_ratio)))
    	MouseClick($clickType, $randX, $randY, $clicks, $speed)
    EndFunc   ;==>RandClick
     
     Func RandClick1($clickType, $xPos, $yPos, $xOff = 3, $yOff = 2, $clicks = 1, $speed = 1)
    	If $xOff < 1 Then $xOff = 1
    	If $yOff < 1 Then $yOff = 1
    	$randX = Round(Random($xPos - ($xOff * $x_ratio), $xPos + ($xOff * $x_ratio)))
    	$randY = Round(Random($yPos - ($yOff * $y_ratio), $yPos + ($yOff * $y_ratio)))
    	MouseClick($clickType, $randX, $randY, $clicks, $speed)
    EndFunc   ;==>RandClick
    
    Func RandMove($xPos, $yPos, $xOff = 10, $yOff = 10, $speed = 1)
    	$randX = Round(Random($xPos - ($xOff * $x_ratio), $xPos + ($xOff * $x_ratio)))
    	$randY = Round(Random($yPos - ($yOff * $y_ratio), $yPos + ($yOff * $y_ratio)))
    	MouseMove($randX, $randY, $speed)
    EndFunc   ;==>RandMove
    
    Func StopLog()
    If $run > 0 Then
    $repairCountPercent = $repairCount / $run
    $deathsCountPercent = $deathCount / $run
    $cellarCountPercent = $cellarCount /  $run
    $closedCellarCountPercent = ($run - $cellarCount) / $run
    $trt = TimerDiff($t)
    ;Total runtime calculation.
    $hours = Floor((($trt / 1000) / 60) / 60)
    $minutes = (($trt / 1000) / 60)
    If $minutes > 60 Then
    	While $minutes > 60
    		$minutes -= 60
    	WEnd
     EndIf
     
    _FileWriteLog("Dank Cellar Log.txt",  @CRLF & "************************************************" & @CRLF & _
    "Dank Celler" & @CRLF & @CRLF & "Stats:" & @CRLF &  _
    "Total Runtime: " & $hours & " hours, " & Ceiling($minutes) & " minutes" & @CRLF & _
    GUICtrlRead($lblLast) & @CRLF & _
    "Total Cellars Found: " & $cellarCount & " (" & Round($cellarCountPercent * 100,.00) & "%" & ")" & @CRLF & _
    "Total Cellars Not Found: " & $run - $cellarCount & " (" & Round($closedCellarCountPercent * 100,.00) & "%" & ")" & @CRLF & _
    "Total Deaths: " & $deathCount &  " (" & Round($deathsCountPercent * 100,.00) & "%" & ")" & @CRLF & _
    "Total Repairs: " & $repairCount &  " (" & Round($repairCountPercent * 100,.00) & "%" & ")" & @CRLF & @CRLF & "Loot:" & @CRLF & _
    "Magics: " & $MagicCount & " Rares: " & $RareCount & " Legendary's: " & $LegendaryCount & " Set Items: " & $setCount & @CRLF & _
    "Gems: " & $GemCount & @CRLF & _
    GUICtrlRead($lblGold) & $StartingGold &  @CRLF & _
    "************************************************")
    EndIf
    EndFunc
    
    Func Begin()
    	   If $AddDPS = 0 then 
            MsgBox(16, "First Run", "Edit your settings.")
    	 Else
    	  $AddDPS = $AddDPS * 3.25
    	  $attackTime = (170000 / $AddDPS) * 1000
    	  WinActivate("Diablo III")
    	$Go = Not $Go
    	GUICtrlSetState($mFile, $GUI_DISABLE)
    	GUICtrlSetState($mOptions, $GUI_DISABLE)
    	   EndIf
    	If Not $Go Then WinSetTitle($title, "", $title  & " - Halted")
    EndFunc   ;==>Begin
    
    Func TogglePause()
    	$Paused = Not $Paused
    	While $Paused
    		Sleep(100)
    		WinSetTitle($title, "", $title & " - Paused")
    		ToolTip('[PAUSED] - Deaths: ' & $deathCount & ' | Cellars: ' & $cellarCount, 0, 0)
    	WEnd
    	WinSetTitle($title, "", $title  & " - Running")
    	ToolTip("")
     EndFunc   ;==>TogglePause
     
     Func GameAutostart()
    If ProcessExists($gameExecutable) = 0 Then
    		GUICtrlSetData($lblStatus, "Status: Starting Game Client")
    		Run($gameDiabloIIILoc & $gameExecutable & " -launch")
    	    sleep($gameStartTime)
    		WinActivate("Diablo III")
    	    Sleep(Random(500, 505))
    
    	    Send($gamePassword)
    	    Sleep(Random(500, 505))
    
    	    Send("{ENTER}")
    	    Sleep($gameStartTime)
    		$size = WinGetClientSize("[CLASS:D3 Main Window Class]")
    		$x_ratio = $size[0] / 800
    	    $y_ratio = $size[1] / 600
    		Call("Begin")
    	 Else
    		$size = WinGetClientSize("[CLASS:D3 Main Window Class]")
    		$x_ratio = $size[0] / 800
    	    $y_ratio = $size[1] / 600
    		
    		Call("Begin")
    	 EndIf
      EndFunc
      
      Func ArrayClear(ByRef $aArray)
        Local $iCols = UBound($aArray, 2)
        Local $iDim = UBound($aArray, 0)
        Local $iRows = UBound($aArray, 1)
    
        If $iDim > 1 Then
            Local $ClearArray2D[$iRows][$iCols]
            $AnalyzedLoot = $ClearArray2D
        EndIf
     EndFunc   ;==>_ArrayClear
    
    
     Func DebugLog($DebugLine)
    	_FileWriteLog( "Debug.txt", $DebugLine )
    EndFunc
    
    
     Func ScreenShotInventory()
    
    
        _ScreenCapture_Capture("CurrentInventory.png",625 * $x_ratio,93 * $y_ratio,772 * $x_ratio,300 * $y_ratio)
       $CurrentItems = 1
    EndFunc
    
    Func Stop() ;to allow the script to stop
    	Call("StopLog")
    	Exit
     EndFunc   ;==>Stop
    
    func ShowLoot()
    	GUICtrlSetData($lblGear, "Legendary: " & $LegendaryCount & " - Set: " & $SetCount & " - Rare: " & $RareCount& " - Magic: " & $MagicCount )
    EndFunc   ;==>ShowLoot
    Personally i dont think the smokescreen run is safer then the vault. I like the new way it kills sarkoth and vendor looks good too but for me the running to the cellar is so slow that i die 80% of the time. Also if you are to use the smokescreen build then run speed will be a major factor again.

    Edit: Just wanted to give you a big thumps up / good job / thanks. The script is awesome and you post it all for free + you help allmost instantly. I havnt been saying thanks before now so im no better but i think people (including me) should become even better at showing our appreciation for this.
    Last edited by Nesslow; 07-19-2012 at 07:13 AM.

  12. #192
    stealthingyew's Avatar Knight-Lieutenant
    Reputation
    12
    Join Date
    Jun 2012
    Posts
    257
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It was created with 0 and I am working on factoring in other run speeds. If cellar is closed teleporting is a lot safer then with the vaulting method.

    I will update the script you linked with new vendor and post it once I get home gt sick and had to go to doctor so I should be home a little sooner.
    Last edited by stealthingyew; 07-19-2012 at 07:14 AM.

  13. #193
    sp3tan's Avatar Member
    Reputation
    1
    Join Date
    Mar 2010
    Posts
    4
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    https://i.imgur.com/AcZZ2.jpg (don't mind the background, i was way too lazy to fix it :P)
    So here we go guys, 12 hours running and 1262 runs completed so far. As you can see it says that i got 56 rares wich is true and 5 sets and THAT is a lie. If im lucky ive found one that the script has put in the stash but other than that im not sure. It seems that the script, sometimes, counts the magic ones as a set for some reason i believe... And im not sure if you can find books in the cellar that the character sometimes find and the script counts it as a set item. My MF & GF is 154/151% and the GPH is 205k as you can see which is pretty much ok for me. Other than that its working good for me and ill keep using this
    Last edited by sp3tan; 07-19-2012 at 07:41 AM.

  14. #194
    Peage's Avatar Member
    Reputation
    1
    Join Date
    Jul 2012
    Posts
    27
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by stealthingyew View Post
    He only opens bag on first game to get your starting gold which is less than 10ms. Then it opens bag during ports so no time is added from that. Didn't really understand what you were asking though. He should only visit stash if bag is full.
    Nope , mine bot , open my inventory all new runs , even if the previous run dank cellar are closed , i would like to know if it can be set to open inventory only when Dank cellar in previous run are open.

    I got an another question too , i would like to know what's the setting to check all inventory without any safe place. because the bot check only the top of the inventory for vendoring/stashing/salvage.

    And the last question , my bot dont take already gems , he take it when he want , somethink like 40% times he take gems droped. maybe an issue with pictures?

    Thanks.

  15. #195
    stealthingyew's Avatar Knight-Lieutenant
    Reputation
    12
    Join Date
    Jun 2012
    Posts
    257
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For the counter it's color based so it's seeing something matching the green pixel shade for a set item. By default the bot loots only flawless gems and not just square ones.

    Does your bit display a number for starting gold if it shows 0 that's why it opens inventory at the beginning of every run. After it first opens the inventory that is.

    I am also looking iinto it only checking the first row of some people's are you runnin it on a VMware?
    Last edited by stealthingyew; 07-19-2012 at 08:09 AM.

Page 13 of 19 FirstFirst ... 91011121314151617 ... LastLast

Similar Threads

  1. Replies: 4466
    Last Post: 05-07-2013, 07:39 AM
  2. Replies: 397
    Last Post: 08-11-2012, 04:48 AM
  3. Replies: 148
    Last Post: 08-03-2012, 04:19 PM
  4. Replies: 3
    Last Post: 07-31-2012, 06:54 PM
  5. Replies: 52
    Last Post: 07-01-2012, 11:01 AM
All times are GMT -5. The time now is 05:45 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search