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
$go = True
$Leave = False
$runMade = 0
While $go
if($Leave) 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("left", 54, 129)
Sleep(1000)
Send("2")
Sleep(800)
Send("1")
Sleep(1000)
MouseClick("left", 87, 429)
Sleep(800)
Send("1")
Sleep(1500)
Send("3")
MouseMove(203, 186,1) ;moves cursor over to the cellar so the proper blue pixel becomes highlighted
Sleep(2000)
$Pixel2 = PixelSearch(69,96,288,246,0xffffff) ;searches for the specific blue pixel that only occurs when mouse hovers over open cellar
If Not @error Then
MouseClick("left",203, 186) ;Entrance to cellar
Sleep(3000)
Send(2)
Sleep(1800)
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(3200)
MouseMove(474, 273, 1) ;attack left, add more sleep time if you can't kill minion on left
Sleep(1000)
MouseMove(732, 232, 1) ;attack right
Sleep(500)
MouseMove(624,258, 1) ;attack mid again
Sleep(1000)
MouseUP("right")
Sleep(300)
Send("{SHIFTUP}")
Send(4)
Sleep(500)
SearchBlue()
SearchYellow()
SearchOrange()
SearchWhite()
SearchBlue()
SearchYellow()
SearchOrange()
SearchWhite()
Sleep(1500)
Send("t")
Sleep(10200)
Town()
ResumeGame()
Else
Send("t")
Sleep(8200)
ResumeGame()
EndIf
EndIf
EndIf
WEnd
Func Pause()
$Leave = False
EndFunc
Func Stop() ;to allow the script to stop
Exit
EndFunc
Func Leave()
$Leave = True
EndFunc
Func SearchBlue()
$cnt = 0
$Searching = True
while $Searching
$Pixel3 = PixelSearch(0,0,1950,1120,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(0,0,1950,1120,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(0,0,1950,1120,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(0,0,1950,1120,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(0,0,1950,1120,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(0,0,1950,1120,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 SearchWhite()
$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
EndFunc
Func Town()
$runMade = $runMade + 1
If $runMade > 5 Then
MouseClick("left", 1064, 256) ;go to chest
Sleep(2000)
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)
MouseClick("left", 1105, 225) ;go half way to vendor
Sleep(2000)
VendorAll()
;SellBlue()
;Sleep(500)
;SellWhite()
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 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
; 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
; 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
; 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
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()
; 1st color
; 2 slots items
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0x161829 )
if Not @error Then
MouseClick("right", $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
MouseClick("right", $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
MouseClick("right", $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
MouseClick("right", $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
MouseClick("right", $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
MouseClick("right", $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
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0x604f0b )
if Not @error Then
MouseClick("right", $Pixel3[0], $Pixel3[1])
Sleep(500)
Else
$Searching = False
EndIf
WEnd
; 1 slots items
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0x5a4d10 )
if Not @error Then
MouseClick("right", $Pixel3[0], $Pixel3[1])
Sleep(500)
Else
$Searching = False
EndIf
WEnd
; more color
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0x5d4e10 )
if Not @error Then
MouseClick("right", $Pixel3[0], $Pixel3[1])
Sleep(500)
Else
$Searching = False
EndIf
WEnd
; more color
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0x66580f )
if Not @error Then
MouseClick("right", $Pixel3[0], $Pixel3[1])
Sleep(500)
Else
$Searching = False
EndIf
WEnd
; more color
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0xf5f500 )
if Not @error Then
MouseClick("right", $Pixel3[0], $Pixel3[1])
Sleep(500)
Else
$Searching = False
EndIf
WEnd
; more color
$Searching = True
while $Searching
$Pixel3 = PixelSearch(1400,584,1900,874,0x554914 )
if Not @error Then
MouseClick("right", $Pixel3[0], $Pixel3[1])
Sleep(500)
Else
$Searching = False
EndIf
WEnd
;orange
; 2 slots items
$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
$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
EndFunc
Func CheckDeath()
$Pixel3 = PixelSearch(670,812,1263,881,0x0e0604 )
if Not @error Then
; dead
EndIf
EndFunc
Func ResumeGame()
Send("{ESCAPE}") ;opens menu
Sleep(1000)
MouseClick("left", 956, 579) ;button to leave game
;Sleep(13000)
$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
EndFunc
But somehow the looting isn't that perfect but it doesnt bring me to cellar without running south and teleport back to town. hopefully yours will finally work for me this time. but does your script for basic gold findings require any image loading?