Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Global $Paused
- Global $Paused
- $default_resolutionX = 1920
- $default_resolutionY = 1080
- $x_ratio = @Desktopwidth / $default_resolutionX
- $y_ratio = @Desktopheight / $default_resolutionY
- Dim $Color, $Left, $Top, $Right, $Bottom
- $Left = 300
- $Top = 0
- $Right = 1920
- $Bottom = 1080
- $x = 1
- $LeftClear = 1000
- $RightClear = 1299
- $TopClear = 412
- $BottomClear = 620
- $LeaveVar = 1
- $ResumeVar = 1
- $IsDead = 0
- $full = false
- $ready = false
- ;color codes
- $BlueClear = 0x111E34 ; the color of the "aura" of blue items in your inventory panel
- $WhiteClear = 0x100908 ; this one is kinda touchy, but theres a certain shade of gray-ish brown in most white item backgrounds that will detect if you find it
- $Amethyst = 0xA56DF1
- $Ruby = 0xFA8078
- $Emerald = 0x51965B
- $Topaz = 0xFFFF59
- $DeadText = 0xFFFFFF ; this probably won't need changed, but its the color of the YOU HAVE DIED text.
- $MythicPotion = 0xDC1D1D ; update to make the join game timer work right
- $CellarDoor = 0x3B62E3 ; the blue of a HIGHLIGHTED cellar door
- $Color = 0xFFFF00 ;rare color code
- $Color2 = 0x6969FF ;blue color code You can put a ; before the FF part if you don't want to pickup blues.
- $Color3 = 0xBF642F ;legendary color code
- $Color4 = 0x00FF00 ;SET color
- $InventoryFull = 0xF30504 ; the color of the red text when you click an item but your inventory is completely full
- $ResumeButton = 0xE1B559 ; the color of the red on the resume button from the main menu
- $AchievementWindow = 0xFFD594 ; the color of the yellow "x" to close the achievement window
- $EscapeWindow = 0xFFD594 ; the color of the yellow "x" to close the escape menu
- $DisconnectWindow = 0xB47539 ; the color of the "OK" text on the disconnected window.
- $LeaveGameButton = 0xC5803E ; the color of the "E" text on the end of "LEAVE" on the leave game button
- $go = True
- $going = false
- While $go = true
- HotKeySet("=","Start")
- HotKeySet("x", "Stop")
- While $going = true
- Call("StartRun")
- Wend
- Wend
- Func StartRun()
- Call("JoinGame")
- if $ready = true Then
- MouseClick("middle", Round(500*$x_ratio), Round(250*$y_ratio)) ;starts the run [waypoint 1]
- Sleep(200)
- Send("2")
- Sleep(600)
- MouseClick("middle", 1, Round(370*$y_ratio)) ;waits 1 second then [waypoint 2]
- Call("CheckDead")
- Sleep(100)
- Send("1")
- Sleep(1100)
- MouseClick("middle", Round(400*$x_ratio), Round(600*$y_ratio)) ;middle of courtyard
- Call("CheckDead")
- Sleep(900)
- Send("1")
- Send("3")
- sleep(200)
- Call("CellarCheck")
- Else
- Call("JoinGame")
- EndIf
- Return
- EndFunc
- Func CellarCheck() ;looks for the cellar door
- if $ready = true THen
- MouseMove(Round(300*$x_ratio),Round(100*$y_ratio),1) ;moves cursor over to the cellar ;moves cursor over to the cellar so the proper blue pixel becomes highlighted
- Sleep(525)
- $Pixel2 = PixelSearch(0,0,(960 * $x_ratio),(540 * $y_ratio),$CellarDoor,3) ;searches for the specific blue pixel that only occurs when mouse hovers over open cellar
- If Not @error Then
- MouseClick("left",Round(300 *$x_ratio),Round(100 * $y_ratio)) ;Entrance to cellar
- Call("RunCellar")
- Return
- EndIf
- Call("CheckDead")
- MouseMove(Round(300*$x_ratio),Round(75*$y_ratio),1) ;moves cursor over to the cellar ;moves cursor over to the cellar so the proper blue pixel becomes highlighted
- Sleep(300)
- $Pixel2 = PixelSearch(0,0,(960 * $x_ratio),(540 * $y_ratio),$CellarDoor,3) ;searches for the specific blue pixel that only occurs when mouse hovers over open cellar
- If Not @error Then
- MouseClick("left",Round(300 *$x_ratio),Round(75 * $y_ratio)) ;Entrance to cellar
- Call("RunCellar")
- Return
- EndIf
- Call("CheckDead")
- MouseMove(Round(300*$x_ratio),Round(50*$y_ratio),1) ;moves cursor over to the cellar ;moves cursor over to the cellar so the proper blue pixel becomes highlighted
- Sleep(250)
- $Pixel2 = PixelSearch(0,0,(960 * $x_ratio),(540 * $y_ratio),$CellarDoor,3) ;searches for the specific blue pixel that only occurs when mouse hovers over open cellar
- If Not @error Then
- MouseClick("left",Round(300 *$x_ratio),Round(50 * $y_ratio)) ;Entrance to cellar
- Call("RunCellar")
- Return
- EndIf
- Call("CheckDead")
- MouseMove(Round(250*$x_ratio),Round(50*$y_ratio),1) ;moves cursor over to the cellar ;moves cursor over to the cellar so the proper blue pixel becomes highlighted
- Sleep(250)
- $Pixel2 = PixelSearch(0,0,(960 * $x_ratio),(540 * $y_ratio),$CellarDoor,3) ;searches for the specific blue pixel that only occurs when mouse hovers over open cellar
- If Not @error Then
- MouseClick("left",Round(250 *$x_ratio),Round(50 * $y_ratio)) ;Entrance to cellar
- Call("RunCellar")
- Return
- Else
- Call("NoCellar") ;send you to the townportal sequence
- Return
- EndIf
- Else
- call("StartRun")
- Return
- EndIF
- Return
- EndFunc
- Func RunCellar() ;this is the sequence for when you are inside the cellar
- if $ready = true then
- Sleep(150)
- Send(2)
- Sleep(2800)
- Call("CheckDead") ;am I dead?
- MouseClick("middle",Round(531 *$x_ratio),Round(769 * $y_ratio))
- Sleep(1100)
- MouseClick("middle",Round(547 *$x_ratio),Round(490 * $y_ratio)) ;moves to doorway leading to rare inside cellar
- Sleep(500)
- MouseMove(Round(579 * $x_ratio),Round(209 * $y_ratio),1) ;hovers over the rare Sarkoth
- Send(4)
- Sleep(500)
- Call("CheckDead") ;am I dead?
- if $IsDead = 0 Then ; if I'm not dead, then kill Sarkoth
- Send("{SHIFTDOWN}")
- Sleep(500)
- MouseClick("left",Round(600 * $x_ratio),Round(239 * $y_ratio),1) ; cast mark of death
- sleep(500)
- MouseDown("right") ;attack middle with right click
- Sleep(3800)
- MouseMove(Round(467 * $x_ratio),Round(269 * $y_ratio),1) ;attack left, add more sleep time if you can't kill minion on left
- Sleep(3000)
- MouseMove(Round(682 * $x_ratio),Round(147 * $y_ratio),1) ;attack right
- Sleep(2700)
- MouseUP("right") ; stop attacking
- Sleep(300)
- Send("{SHIFTUP}")
- Sleep(500)
- MouseClick("middle",Round(579 *$x_ratio),Round(209 * $y_ratio)) ; walk to location of sarkoth's body
- Sleep(1400)
- call("FindItem") ;look for loot
- call("FindItem")
- call("FindItem")
- call("FindItem")
- call("SearchGems") ; look for gems
- MouseClick("left",Round(912*$x_ratio),Round(300 * $y_ratio)) ;moves to right top corner for gold
- Sleep(500)
- Send("t") ; teleport away
- Sleep(7500)
- Call("CheckRepair") ; is it time to repair yet?
- Return
- Else ; if I am dead, leave the game prematurely
- $IsDead = 0
- Call("LeaveGame")
- Return
- EndIf
- Else
- Call("StartRun")
- EndIf
- EndFunc
- Func NoCellar() ; town portal sequence if the cellar is not there
- if not @error then
- Send("2")
- MouseClick("middle",Round(1300 *$x_ratio),Round(900 * $y_ratio)) ;moves down screen away from cellar in attempt for safety before teleporting back to town
- Sleep(1100)
- Send("1")
- Sleep(100)
- Call("CheckDead")
- Send("t")
- Sleep(7300)
- Call("CheckDead")
- Call("CheckRepair")
- Return
- EndIf
- EndFunc
- Func CheckRepair()
- If $x > 9 Then ; If I have done 10 or more runs now, go ahead and repair.
- MouseClick("middle", Round(1480 * $x_ratio),Round(281 * $y_ratio));begin movement towards merchant
- Sleep(1400)
- MouseClick("middle", Round(1316 * $x_ratio),Round(206 * $y_ratio)) ;moves to get merchant in screen
- Sleep(1750)
- MouseClick("left", Round(845 * $x_ratio),Round(225 * $y_ratio)) ;NPC Merchant to the right of cain's home
- Sleep(1000)
- MouseClick("left", Round(521 * $x_ratio),Round(506 * $y_ratio)) ;button to open up repair menu
- Sleep(1000)
- MouseClick("left", Round(260 * $x_ratio),Round(595 * $y_ratio)) ;button to pay for repairs
- Sleep(500)
- Send("{ESCAPE}") ;close menu
- Sleep(500)
- $x = 0
- Call("LeaveGame") ; begins the leave game sequence
- Return
- Else
- $x = $x + 1 ; if I haven't done 10 runs, increase the repair counter
- Call("LeaveGame") ; and then leave the game
- Return
- EndIf
- Return
- EndFunc
- Func FindItem()
- $SearchResult = PixelSearch($Left, $Top, $Right, $Bottom, $Color) ;searches for rares
- If Not @error Then
- MouseClick("left", $SearchResult[0], $SearchResult[1], 1, 10) ;IF ITS THERE IT CLICKS IT.
- Sleep(1500)
- Call("CheckInv") ; Check to see if I got the "Inventory full" error message
- if $full = true Then
- call("ClearInv") ; Then drop a white or blue item to make room
- EndIf
- EndIf
- If $full = false Then ; If my inventory isn't full, look for blue items
- $SearchResult = PixelSearch($Left, $Top, $Right, $Bottom, $Color2 ) ;searches for magics
- If Not @error Then
- MouseClick("left", $SearchResult[0], $SearchResult[1], 1, 10) ;clicks magic
- Sleep(450)
- Call("CheckInv"); Check to see if I got the "Inventory full" error message
- EndIf
- EndIf
- $SearchResult = PixelSearch($Left, $Top, $Right, $Bottom, $Color3 ) ;searches for legendarys
- If Not @error Then
- MouseClick("left", $SearchResult[0], $SearchResult[1], 1, 10) ;clicks legendary
- Sleep(2000)
- call("CheckInv"); Check to see if I got the "Inventory full" error message
- if $full = true Then
- call("ClearInv"); Then drop a white or blue item to make room
- EndIf
- EndIf
- $SearchResult = PixelSearch($Left, $Top, $Right, $Bottom, $Color4) ;searches for SETS
- If Not @error Then
- MouseClick("left", $SearchResult[0], $SearchResult[1], 1, 10) ;IF ITS THERE IT CLICKS IT.
- Sleep(2000)
- Call("CheckInv"); Check to see if I got the "Inventory full" error message
- if $full = true Then
- call("ClearInv"); Then drop a white or blue item to make room
- EndIf
- EndIf
- Call("SearchGems") ; look for gems
- Return
- EndFunc
- ; search for gems
- Func SearchGems()
- $SearchResult = PixelSearch(300, 45, 1190, $Bottom, $Amethyst,8) ;searches for gems
- If Not @error Then
- MouseClick("left", $SearchResult[0], $SearchResult[1], 1, 10) ;IF ITS THERE IT CLICKS IT.
- Sleep(1500)
- EndIf
- $SearchResult = PixelSearch(300, 45, 1190, 624, $Ruby,5) ;searches for gems
- If Not @error Then
- MouseClick("left", $SearchResult[0], $SearchResult[1], 1, 10) ;IF ITS THERE IT CLICKS IT.
- Sleep(1500)
- EndIf
- $SearchResult = PixelSearch(300, 45, 1190, 624, $Emerald,9) ;searches for gems
- If Not @error Then
- MouseClick("left", $SearchResult[0], $SearchResult[1], 1, 10) ;IF ITS THERE IT CLICKS IT.
- Sleep(1500)
- EndIf
- ; $SearchResult = PixelSearch(300, 45, 1190, 624, $Topaz,2) ;searches for gems
- ; If Not @error Then
- ; MouseClick("left", $SearchResult[0], $SearchResult[1], 1, 10) ;IF ITS THERE IT CLICKS IT.
- ; Sleep(800)
- ; EndIf
- Return
- EndFunc
- Func ClearInv()
- Send("{i}") ; open inventory
- Sleep(800)
- $SearchResult = PixelSearch($LeftClear, $TopClear, $RightClear, $BottomClear, $BlueClear)
- If Not @error Then
- MouseClick("left", $SearchResult[0], $SearchResult[1], 1, 10) ; click a blue item
- Sleep(500)
- MouseClick("left", Round(697* $x_ratio),Round(459 * $y_ratio)) ; drop a blue item
- Sleep(500)
- EndIf
- Send("{ESCAPE}") ; close inventory
- Sleep(500)
- Call("FindItem") ; call find item again so it will try to pick up that rare again
- Return
- EndFunc
- Func CheckInv()
- $Pixel3 = PixelSearch(640,90,690,120,$InventoryFull,4) ; did I get the inventory full error?
- If Not @error Then ; yes, I'm full!
- $full = true
- Else
- $full = false ; nope! Keep on truckin.
- EndIf
- Return
- EndFunc
- Func LeaveGame()
- Call("CheckWindow") ; see if I have achievements / escape menu open and if I do, close them
- Send("{ESCAPE}") ;opens menu
- Sleep(1000)
- $Pixel3 = PixelSearch(665,400,690,425,$LeaveGameButton,8) ; Did I open escape menu properly?
- If Not @error Then ; yes, click to leave
- MouseClick("left", Round(956 * $x_ratio),Round(579 * $y_ratio)) ;button to leave game
- Sleep(3000)
- Call("CheckResume")
- Else ; can't find leave button, lets try again
- Call("LeaveGame")
- EndIF
- Return
- EndFunc
- Func CheckResume()
- Call("CheckWindow") ; Anything open?
- While $LeaveVar < 28 ; As long as I haven't already waited 14 seconds, check to see if you can find the chat box on the main screen
- Sleep(500)
- $Pixel3 = PixelSearch(1160,700,1180,730,$ResumeButton,1)
- If Not @error Then ; if you find the chat box, click to resume the game before the full wait timer
- MouseClick("left", Round(230 * $x_ratio),Round(416 * $y_ratio)) ;button to resume game from main menu
- Sleep(2000)
- $LeaveVar = 1 ; reset the backup timer
- Return
- Else ; If I haven't found the button yet, add a half second to the backup timer and go on
- $LeaveVar = $LeaveVar + 1
- EndIf
- WEnd
- MouseClick("left", Round(230 * $x_ratio),Round(416 * $y_ratio)) ;button to resume game from main menu
- Sleep(2000)
- $LeaveVar = 1 ; reset the timer
- Return ; return the whole stack to the $going while
- EndFunc
- Func JoinGame()
- While $ResumeVar < 18 ; as long as I haven't waited 9 seconds for the load to finish
- Sleep(500)
- $Pixel3 = PixelSearch(725,720,770,750,$MythicPotion,8) ; look for mythic potion
- If Not @error Then ; if I find the potion,
- $ResumeVar = 1 ; reset the backup timer, then end the function. This will cause the entire stack to return back to the $going while, and restart the loop.
- $Ready = true
- Return
- Else
- $Pixel3 = PixelSearch(1160,700,1180,730,$ResumeButton,1) ; maybe I didn't click resume correctly? Lets look
- If Not @error Then ; looks like I'm at the main menu somehow. Lets resume
- MouseClick("left", Round(230 * $x_ratio),Round(416 * $y_ratio)) ;button to resume game from main menu
- Sleep(2000)
- EndIf
- $ResumeVar = $ResumeVar + 1
- $Ready = False
- EndIf
- WEnd
- If $ResumeVar > 17 Then
- $Ready = True
- Return
- EndIf
- EndFunc
- Func CheckWindow()
- $Pixel3 = PixelSearch(1115,75,1125,85,$AchievementWindow,4) ; is the achievement window open?
- If Not @error Then
- Send("{ESCAPE}")
- Sleep(500)
- Call("CheckResume")
- EndIf
- $Pixel3 = PixelSearch(815,150,830,165,$EscapeWindow,4) ; is the escape window open?
- If Not @error Then
- Send("{ESCAPE}")
- Sleep(500)
- Call("CheckResume")
- EndIf
- $Pixel3 = PixelSearch(670,440,690,460,$DisconnectWindow,5) ; is the disconnect window open?
- If Not @error Then
- Send("{ESCAPE}")
- Sleep(2000)
- Call("CheckResume")
- EndIf
- Return
- EndFunc
- Func CheckDead()
- $Pixel3 = PixelSearch(990,247,1000,259,$DeadText,4) ; is the "YOU HAVE DIED." message there?
- If Not @error Then
- Sleep(500)
- $IsDead = 1
- Call("LeaveGame") ; You dead. End the game and start over.
- Return
- Else
- $IsDead = 0 ; HE'S ALIVE. Lets keep going.
- Return
- EndIf
- EndFunc
- Func Stop() ;to allow the script to stop
- Exit
- EndFunc
- Func Start() ; lets get this bitch rollin
- $going = true
- EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement