Code:
Global $Paused
HotKeySet("=","Leave") ;script can START by pressing =
HotKeySet("-", "Pause") ;script can be Pause by pressing -
HotKeySet("x", "Stop") ;script can be Stopped by pressing x
;-----------------------------------------------------
;-----------------------------------------------------
; Settings
$SearchForWhite = True ;True / False Activate/Deactivate white looting (will not pick potions / gems either)
$SearchForBlue = True ;True / False Activate/Deactivate blue looting
$SearchForYellow = True ;True / False Activate/Deactivate yellow looting
$KeepPotion = True ;True / False Activate/Deactivate dropping potion in stash
$KeepGems = True ;True / False Activate/Deactivate dropping in stash
$SarkothKillBeforeVendoring = 5 ;Number of kill before going to town to deposit and vendor
$LootingLoopCount = 2 ;Number of times you try looting items on the ground (increasing will increase the chance of unstucking yourself and keep looting)
$TimeOffset = 0 ;Increase this if you stop running before reaching the cellar door (1000 = 1 second)
$SalvageBlues = False ;True / False Activate/Deactivate Salavage of blues
;-----------------------------------------------------
;-----------------------------------------------------
$go = True
$Run = False
$runMade = 0
While $go
if($Run) Then
$Pixel1 = PixelSearch(1482,20,1535,95,0xFFF000) ;searches top right screen for yellow of broken armor
If Not @error Then
;we need to repair
Send("t")
Sleep(8000)
MouseClick("left", 1480, 281) ;begin movement towards merchant
Sleep(1500)
MouseClick("left", 1316, 206) ;moves to get merchant in screen
Sleep(1500)
MouseClick("left", 845, 225) ;NPC Merchant to the right of cain's home
Sleep(1500)
MouseClick("left", 521, 506) ;button to open up repair menu
Sleep(1500)
MouseClick("left", 260, 595) ;button to pay for repairs
Sleep(2500)
Send("{ESCAPE}") ;close windows
Sleep(200);
ResumeGame()
Else
;starts the run
MouseClick("middle", 54, 129)
Sleep(1300)
Send("2")
Sleep(1500)
Send("1")
Sleep(700)
MouseClick("middle", 87, 429)
Sleep(2200 + $TimeOffset)
Send("1")
Sleep(700)
Send("3")
MouseMove(203, 186,1) ;moves cursor over to the cellar so the proper blue pixel becomes highlighted
Sleep(2000)
if(StatusCheck()) Then
$Pixel2 = PixelSearch(92,123,247,187,0xffffff) ;searches for the white pixel in the cellar name
If Not @error Then
MouseClick("left",203, 186) ;Entrance to cellar
Sleep(1000)
Send(2)
Sleep(2800)
while Loading()
; "pause" the script until loading is over
WEnd
MouseClick("left", 531, 769)
Send(4)
Sleep(2000)
MouseClick("left", 547, 490) ;moves to doorway leading to rare inside cellar
Sleep(1500)
MouseMove(624,258,1) ;hovers over the rare Sarkoth
Send("{SHIFTDOWN}")
MouseDown("right")
Sleep(5200)
MouseMove(732, 232, 1) ;attack right
Sleep(1200)
MouseMove(474, 273, 1) ;attack left, add more sleep time if you can't kill minion on left
Sleep(1200)
MouseMove(624,258, 1) ;attack mid again
Sleep(1000)
MouseUP("right")
Send("{SHIFTUP}")
Sleep(1500)
Looting()
if (StatusCheck()) Then
Sleep(1500)
Send("t")
Sleep(10200)
Town()
ResumeGame()
EndIf
Else
if(StatusCheck()) Then
Send("t")
Sleep(8200)
ResumeGame()
EndIf
EndIf
EndIf
EndIf
EndIf
WEnd
Func Pause()
$Run = False
EndFunc
Func Stop() ;to allow the script to stop
Exit
EndFunc
Func Leave()
$Run = True
EndFunc
Func SearchBlue()
$cnt = 0
$Searching = True
while $Searching
$Pixel3 = PixelSearch(350,200,1350,800,0x6969ff)
if Not @error Then
Send("{ALTDOWN}")
Send("{ALTUP}")
MouseClick("left", $Pixel3[0], $Pixel3[1])
Sleep(1000)
$cnt = $cnt + 1
if $cnt > 8 Then
$Searching = False
EndIf
Else
$Searching = False
EndIf
WEnd
EndFunc
Func SearchYellow()
$cnt = 0
$Searching = True
while $Searching
$Pixel3 = PixelSearch(350,200,1350,800,0xe0e205)
if Not @error Then
Send("{ALTDOWN}")
Send("{ALTUP}")
MouseClick("left", $Pixel3[0], $Pixel3[1])
Sleep(1000)
$cnt = $cnt + 1
if $cnt > 8 Then
$Searching = False
EndIf
Else
$Searching = False
EndIf
WEnd
$cnt = 0
$Searching = True
while $Searching
$Pixel3 = PixelSearch(350,200,1350,800,0xc5c509)
if Not @error Then
Send("{ALTDOWN}")
Send("{ALTUP}")
MouseClick("left", $Pixel3[0], $Pixel3[1])
Sleep(1000)
$cnt = $cnt + 1
if $cnt > 8 Then
$Searching = False
EndIf
Else
$Searching = False
EndIf
WEnd
$cnt = 0
$Searching = True
while $Searching
$Pixel3 = PixelSearch(350,200,1350,800,0xd4d711)
if Not @error Then
Send("{ALTDOWN}")
Send("{ALTUP}")
MouseClick("left", $Pixel3[0], $Pixel3[1])
Sleep(1000)
$cnt = $cnt + 1
if $cnt > 8 Then
$Searching = False
EndIf
Else
$Searching = False
EndIf
WEnd
$cnt = 0
$Searching = True
while $Searching
$Pixel3 = PixelSearch(350,200,1350,800,0xdddd00)
if Not @error Then
Send("{ALTDOWN}")
Send("{ALTUP}")
MouseClick("left", $Pixel3[0], $Pixel3[1])
Sleep(1000)
$cnt = $cnt + 1
if $cnt > 8 Then
$Searching = False
EndIf
Else
$Searching = False
EndIf
WEnd
EndFunc
Func SearchOrange()
$cnt = 0
$Searching = True
while $Searching
$Pixel3 = PixelSearch(350,200,1350,800,0x9b5227)
if Not @error Then
Send("{ALTDOWN}")
Send("{ALTUP}")
MouseClick("left", $Pixel3[0], $Pixel3[1])
Sleep(1000)
$cnt = $cnt + 1
if $cnt > 8 Then
$Searching = False
EndIf
Else
$Searching = False
EndIf
WEnd
EndFunc
Func SearchGreen()
$cnt = 0
$Searching = True
while $Searching
$Pixel3 = PixelSearch(350,200,1350,800,0x00ff00)
if Not @error Then
Send("{ALTDOWN}")
Send("{ALTUP}")
MouseClick("left", $Pixel3[0], $Pixel3[1])
Sleep(1000)
$cnt = $cnt + 1
if $cnt > 8 Then
$Searching = False
EndIf
Else
$Searching = False
EndIf
WEnd
EndFunc
Func SearchWhite()
;if $SearchForWhite = 1 Then
$cnt = 0
$Searching = True
while $Searching
$Pixel3 = PixelSearch(350,200,1350,800,0xeeeeee)
if Not @error Then
Send("{ALTDOWN}")
Send("{ALTUP}")
MouseClick("left", $Pixel3[0], $Pixel3[1])
Sleep(1000)
$cnt = $cnt + 1
if $cnt > 8 Then
$Searching = False
EndIf
Else
$Searching = False
EndIf
WEnd
; EndIf
EndFunc
Func Town()
$runMade = $runMade + 1
If $runMade > $SarkothKillBeforeVendoring Then
$runMade = 0
if($SalvageBlues)Then
ReachBlacksmith()
Sleep(3500)
Else
MouseClick("left", 1064, 256) ;go to chest
Sleep(2000)
EndIf
MouseClick("left", 517, 251) ; 1st tab
Sleep(500);
DropInChest();
MouseClick("left", 517, 378) ; 2nd tab
Sleep(500);
DepositRare()
MouseClick("left", 517, 500) ; 3rd tab
Sleep(500);
DepositRare()
Sleep(500);
Send("{ESCAPE}") ;close windows
Sleep(500)
MouseClick("left", 1515, 69) ;go half way to vendor
Sleep(2000)
if($SalvageBlues)Then
MouseClick("left", 1055, 225) ;go to vendor
Else
MouseClick("left", 1105, 225) ;go to vendor
EndIf
Sleep(2000)
VendorAll()
MouseClick("left", 506, 483) ;click repair tab
Sleep(200)
MouseClick("left", 242, 528) ;click repair
Sleep(200)
Send("{ESCAPE}") ;close windows
Sleep(500)
EndIf
EndFunc
Func StatusCheck()
if Not CheckDeath() Then
TrayTip("Status", "NOT OK:: Death", 1)
Return False
EndIf
if Not CheckConnection() Then
TrayTip("Status", "NOT OK:: Connection", 1)
Return False
EndIf
Return True
EndFunc
Func Looting()
For $i = 1 To $LootingLoopCount
if ($SearchForBlue) Then
SearchBlue()
EndIf
if ($SearchForYellow) Then
SearchYellow()
EndIf
SearchOrange()
SearchGreen()
if ($SearchForWhite) Then
SearchWhite()
EndIf
Sleep(500)
Next
EndFunc
Func DropInChest()
; Tome of secret
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0x507554 )
if Not @error Then
MouseClick("right", $Pixel3[0], $Pixel3[1])
Sleep(500)
Else
$Searching = False
EndIf
WEnd
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0x9a938b )
if Not @error Then
MouseClick("right", $Pixel3[0], $Pixel3[1])
Sleep(500)
Else
$Searching = False
EndIf
WEnd
; mystic potion
if($KeepPotion) Then
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0x4a1008 )
if Not @error Then
MouseClick("right", $Pixel3[0], $Pixel3[1])
Sleep(500)
Else
$Searching = False
EndIf
WEnd
EndIf
if ($KeepGems = False) Then
Return
EndIf
; Yellow gems
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0xce8200 )
if Not @error Then
MouseClick("right", $Pixel3[0], $Pixel3[1])
Sleep(500)
Else
$Searching = False
EndIf
WEnd
; Yellow gems
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0xc17900 )
if Not @error Then
MouseClick("right", $Pixel3[0], $Pixel3[1])
Sleep(500)
Else
$Searching = False
EndIf
WEnd
; Green gems
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0x319e31 )
if Not @error Then
MouseClick("right", $Pixel3[0], $Pixel3[1])
Sleep(500)
Else
$Searching = False
EndIf
WEnd
; Green gems
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0x3db835 )
if Not @error Then
MouseClick("right", $Pixel3[0], $Pixel3[1])
Sleep(500)
Else
$Searching = False
EndIf
WEnd
; Green gems
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0x57ef50 )
if Not @error Then
MouseClick("right", $Pixel3[0], $Pixel3[1])
Sleep(500)
Else
$Searching = False
EndIf
WEnd
; Red gems
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0xf01d1f)
if Not @error Then
MouseClick("right", $Pixel3[0], $Pixel3[1])
Sleep(500)
Else
$Searching = False
EndIf
WEnd
; Red gems
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0xe90b0b)
if Not @error Then
MouseClick("right", $Pixel3[0], $Pixel3[1])
Sleep(500)
Else
$Searching = False
EndIf
WEnd
; Red gems
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0xe80a0a)
if Not @error Then
MouseClick("right", $Pixel3[0], $Pixel3[1])
Sleep(500)
Else
$Searching = False
EndIf
WEnd
; Red gems
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0xef0d11)
if Not @error Then
MouseClick("right", $Pixel3[0], $Pixel3[1])
Sleep(500)
Else
$Searching = False
EndIf
WEnd
; Purple gems
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0x9905db )
if Not @error Then
MouseClick("right", $Pixel3[0], $Pixel3[1])
Sleep(500)
Else
$Searching = False
EndIf
WEnd
; Purple gems
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0xb110f7 )
if Not @error Then
MouseClick("right", $Pixel3[0], $Pixel3[1])
Sleep(500)
Else
$Searching = False
EndIf
WEnd
DepositCraftingMats()
EndFunc
Func DepositCraftingMats()
;inferno dust
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0xc6a6e3 )
if Not @error Then
MouseClick("right", $Pixel3[0], $Pixel3[1])
Sleep(500)
Else
$Searching = False
EndIf
WEnd
;hell dust
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0xddd2a5 )
if Not @error Then
MouseClick("right", $Pixel3[0], $Pixel3[1])
Sleep(500)
Else
$Searching = False
EndIf
WEnd
; brimstone
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0xac2a02 )
if Not @error Then
MouseClick("right", $Pixel3[0], $Pixel3[1])
Sleep(500)
Else
$Searching = False
EndIf
WEnd
; hell yellow mats
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0xe0c49f )
if Not @error Then
MouseClick("right", $Pixel3[0], $Pixel3[1])
Sleep(500)
Else
$Searching = False
EndIf
WEnd
; inferno yellow mats
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0xffbea5 )
if Not @error Then
MouseClick("right", $Pixel3[0], $Pixel3[1])
Sleep(500)
Else
$Searching = False
EndIf
WEnd
EndFunc
Func VendorAll()
For $i = 0 To 9 Step 1
MouseClick("right", 1432 + (50 * $i), 609)
Sleep(25)
MouseClick("right", 1432 + (50 * $i), 609 + 50)
Sleep(25)
MouseClick("right", 1432 + (50 * $i), 609 + 100)
Sleep(25)
MouseClick("right", 1432 + (50 * $i), 609 + 150)
Sleep(25)
MouseClick("right", 1432 + (50 * $i), 609 + 200)
Sleep(25)
MouseClick("right", 1432 + (50 * $i), 609 + 250)
Sleep(25)
Next
EndFunc
Func SellBlue($mouseBtn)
; 1st color
; 2 slots items
;$Searching = True
;while $Searching
; $Pixel3 = PixelSearch(1400,584,1900,874,0x161829 )
; if Not @error Then
; TrayTip("found blue:", "color: 1", 1)
; MouseClick($mouseBtn, $Pixel3[0], $Pixel3[1])
; Sleep(500)
; Else
; $Searching = False
; EndIf
;WEnd
; 1 slots items
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0x161c36 )
if Not @error Then
TrayTip("found blue:", "color: 2", 1)
MouseClick($mouseBtn, $Pixel3[0], $Pixel3[1])
Sleep(500)
Else
$Searching = False
EndIf
WEnd
; more color
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0x13233c )
if Not @error Then
TrayTip("found blue:", "color: 3", 1)
MouseClick($mouseBtn, $Pixel3[0], $Pixel3[1])
Sleep(500)
Else
$Searching = False
EndIf
WEnd
; more color
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0x182343 )
if Not @error Then
TrayTip("found blue:", "color: 4", 1)
MouseClick($mouseBtn, $Pixel3[0], $Pixel3[1])
Sleep(500)
Else
$Searching = False
EndIf
WEnd
; more color
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0x233055 )
if Not @error Then
TrayTip("found blue:", "color: 5", 1)
MouseClick($mouseBtn, $Pixel3[0], $Pixel3[1])
Sleep(500)
Else
$Searching = False
EndIf
WEnd
; more color
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0x102039 )
if Not @error Then
TrayTip("found blue:", "color: 6", 1)
MouseClick($mouseBtn, $Pixel3[0], $Pixel3[1])
Sleep(500)
Else
$Searching = False
EndIf
WEnd
EndFunc
Func SellWhite()
; more color
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0xffffff )
if Not @error Then
MouseClick("right", $Pixel3[0], $Pixel3[1])
Sleep(500)
Else
$Searching = False
EndIf
WEnd
endFunc
Func DepositRare()
;Yellow
;1st color
; 2 slots items
$cnt = 0
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0x604f0b )
if Not @error Then
MouseClick("right", $Pixel3[0], $Pixel3[1])
Sleep(500)
$cnt = $cnt + 1
if $cnt > 8 Then
$Searching = False
EndIf
Else
$Searching = False
EndIf
WEnd
; 1 slots items
$cnt = 0
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0x5a4d10 )
if Not @error Then
MouseClick("right", $Pixel3[0], $Pixel3[1])
Sleep(500)
$cnt = $cnt + 1
if $cnt > 8 Then
$Searching = False
EndIf
Else
$Searching = False
EndIf
WEnd
; more color
$cnt = 0
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0x5d4e10 )
if Not @error Then
MouseClick("right", $Pixel3[0], $Pixel3[1])
Sleep(500)
$cnt = $cnt + 1
if $cnt > 8 Then
$Searching = False
EndIf
Else
$Searching = False
EndIf
WEnd
; more color
$cnt = 0
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0x66580f )
if Not @error Then
MouseClick("right", $Pixel3[0], $Pixel3[1])
Sleep(500)
$cnt = $cnt + 1
if $cnt > 8 Then
$Searching = False
EndIf
Else
$Searching = False
EndIf
WEnd
; more color
$cnt = 0
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0xf5f500 )
if Not @error Then
MouseClick("right", $Pixel3[0], $Pixel3[1])
Sleep(500)
$cnt = $cnt + 1
if $cnt > 8 Then
$Searching = False
EndIf
Else
$Searching = False
EndIf
WEnd
; more color
$cnt = 0
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0x554914 )
if Not @error Then
MouseClick("right", $Pixel3[0], $Pixel3[1])
Sleep(500)
$cnt = $cnt + 1
if $cnt > 8 Then
$Searching = False
EndIf
Else
$Searching = False
EndIf
WEnd
; more color
$cnt = 0
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0x4c3f0b)
if Not @error Then
MouseClick("right", $Pixel3[0], $Pixel3[1])
Sleep(500)
$cnt = $cnt + 1
if $cnt > 8 Then
$Searching = False
EndIf
Else
$Searching = False
EndIf
WEnd
;orange
; 2 slots items
$cnt = 0
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0x593212 )
if Not @error Then
MouseClick("right", $Pixel3[0], $Pixel3[1])
Sleep(500)
Else
$Searching = False
EndIf
WEnd
; 1 slots items
$cnt = 0
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0x693e12 )
if Not @error Then
MouseClick("right", $Pixel3[0], $Pixel3[1])
Sleep(500)
Else
$Searching = False
EndIf
WEnd
; 1 slots items
$cnt = 0
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0x4c2d10 )
if Not @error Then
MouseClick("right", $Pixel3[0], $Pixel3[1])
Sleep(500)
Else
$Searching = False
EndIf
WEnd
EndFunc
Func CheckDeath()
$Pixel3 = PixelSearch(830,840,860,850,0xe69f4f )
if Not @error Then
$Pixel3 = PixelSearch(700,830,730,860,0x180000 )
if Not @error Then
ResumeGame()
Return False
EndIf
EndIf
$Pixel3 = PixelSearch(830,840,860,850,0x4b4742 )
if Not @error Then
$Pixel3 = PixelSearch(700,830,730,860,0x060201 )
if Not @error Then
ResumeGame()
Return False
EndIf
EndIf
Return True
EndFunc
Func CheckConnection()
$Pixel3 = PixelSearch(860,417,1068,438,0xf09901 )
if Not @error Then
$Pixel3 = PixelSearch(900,620,920,640,0x230400 )
if Not @error Then
MouseClick("left", 910, 630)
ResumeGame()
Return False
EndIf
EndIf
Return True
EndFunc
Func ReachBlacksmith()
MouseClick("left", 1800, 500)
Sleep(2000)
MouseClick("left", 1475, 400)
Sleep(1000)
MouseClick("left", 260, 300)
Sleep(500)
SellBlue("left")
Sleep(1000)
Send("{ESCAPE}")
Sleep(500)
MouseClick("left", 30, 280)
EndFunc
Func Loading()
$Pixel3 = PixelSearch(1700,168,1775,240,0x00a6ff )
if Not @error Then
; pixel found = loading is over
Return False
EndIf
;Still on loading screen
return True
EndFunc
Func ResumeGame()
; move the mouse to be sure it's not over the pixel we're looking for
MouseMove(100, 100, 1)
$Searching = True
while $Searching
$Pixel3 = PixelSearch(800,550,1125,610,0xf3aa55 )
if Not @error Then
MouseClick("left", 956, 579) ;button to leave game
$Searching = False
Else
Send("{ESCAPE}") ;opens menu
Sleep(1000)
EndIf
WEnd
; check if profile screen is open
$Pixel3 = PixelSearch(1565,98,1593,126,0xffd794 )
if Not @error Then
Send("{ESCAPE}") ;close profile
EndIf
$Searching = True
while $Searching
$Pixel3 = PixelSearch(60,384,411,450,0x3c0700 )
if Not @error Then
MouseClick("left", 230, 416) ;button to resume game from main menu
;Sleep(8000)
$Searching = False
EndIf
WEnd
while Loading()
;will get out of the loop when loading is over and resume resume the script
WEnd
EndFunc