View difference between Paste ID: Xu3bTnDj and xGnzHZSA
SHOW: | | - or go back to the newest paste.
1-
  Global $Paused
1+
      Global $Paused
2-
        HotKeySet("=","Leave")  ;script started by pressing =
2+
            HotKeySet("=","Leave")  ;script started by pressing =
3-
        HotKeySet("-", "Pause") ;script paused by pressing -
3+
            HotKeySet("-", "Pause") ;script paused by pressing -
4-
        HotKeySet("x", "Stop") ;script stopped by pressing x
4+
            HotKeySet("x", "Stop") ;script stopped by pressing x
5-
         
5+
             
6-
        $walktime = 3000 ; time in ms the script waits for you to enter and load the cellar. Slow this down for slower move speeds and loading times
6+
            $walktime = 3000 ; time in ms the script waits for you to enter and load the cellar. Slow this down for slower move speeds and loading times
7-
        $loadtime = 3200 ; time in ms the script waits for the game to load before it starts pathfinding. Slow this down for slower hard drives
7+
            $loadtime = 3200 ; time in ms the script waits for the game to load before it starts pathfinding. Slow this down for slower hard drives
8-
        $tptime =       6900 ; time in ms the script waits for teleport before exiting the game
8+
            $tptime =       6900 ; time in ms the script waits for teleport before exiting the game
9-
        $yellow =       0xFFF000 ; yellow color code (repair icon)
9+
            $yellow =       0xFFF000 ; yellow color code (repair icon)
10-
        $red =          0xD90000 ; red color code (repair icon)
10+
            $red =          0xD90000 ; red color code (repair icon)
11-
         
11+
             
12-
        $LootRares = True ; Change this to false if you don't want the bot to pick up rares (good for legendary/set only, recommend setting LootGems to False)
12+
            $LootRares = True ; Change this to false if you don't want the bot to pick up rares (good for legendary/set only, recommend setting LootGems to False)
13-
        $LootGems = False ; Change this to true if you want to pick up gems (messy, can fill up bag with whites/blues)
13+
            $LootGems = False ; Change this to true if you want to pick up gems (messy, can fill up bag with whites/blues)
14-
        $Amethyst = 0xAC7FFF
14+
            $Amethyst = 0xAC7FFF
15-
        $Ruby = 0xB01D2D
15+
            $Ruby = 0xB01D2D
16-
        $Emerald = 0x58EE33
16+
            $Emerald = 0x58EE33
17-
        $Topaz = 0xFFFF59
17+
            $Topaz = 0xFFFF59
18-
         
18+
             
19-
        $go = True
19+
            $go = True
20-
        $Leave = False
20+
            $Leave = False
21-
        $Dead = False
21+
            $Dead = False
22-
        $Logout = False
22+
            $Logout = False
23-
        $Window = False
23+
            $Window = False
24-
        $default_resolutionX = 1920
24+
            $default_resolutionX = 1920
25-
        $default_resolutionY = 1080
25+
            $default_resolutionY = 1080
26-
        $x_ratio = @Desktopwidth / $default_resolutionX
26+
            $x_ratio = @Desktopwidth / $default_resolutionX
27-
        $y_ratio = @Desktopheight / $default_resolutionY
27+
            $y_ratio = @Desktopheight / $default_resolutionY
28-
        $i = 0
28+
            $i = 0
29-
         
29+
             
30-
        Call("RestartRun")
30+
            Call("RestartRun")
31-
         
31+
             
32-
        Func RestartRun()
32+
            Func RestartRun()
33-
           While $go
33+
               While $go
34-
                  if($Leave) Then
34+
                      if($Leave) Then
35-
                         $i = 0
35+
                             $i = 0
36-
                         Sleep(1000) ;had to add this since the icon doesn't show up RIGHT away in game
36+
                             Sleep(1000) ;had to add this since the icon doesn't show up RIGHT away in game
37-
                         Call("CheckDead")
37+
                             Call("CheckDead")
38-
                         Call("CheckRepair")
38+
                             Call("CheckRepair")
39-
                         If $Window Then
39+
                             If $Window Then
40-
                                MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
40+
									Call MainMenu()
41-
                                Sleep($loadtime)
41+
                                    MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
42-
                                $Window = False
42+
                                    Sleep($loadtime)
43-
                                ExitLoop
43+
                                    $Window = False
44-
                         ElseIf $Dead or $Logout Then
44+
                                    ExitLoop
45-
                                ExitLoop
45+
                             ElseIf $Dead or $Logout Then
46-
                         EndIf
46+
                                    ExitLoop
47-
                         MouseClick("left", Round(0 * $x_ratio),Round(250 * $y_ratio)) ;starts the main run
47+
                             EndIf
48-
                         Send("4")
48+
                             MouseClick("left", Round(0 * $x_ratio),Round(250 * $y_ratio)) ;starts the main run
49-
                         Sleep(140)
49+
                             Send("4")
50-
                         Send("4")
50+
                             Sleep(140)
51-
                         Sleep(140)
51+
                             Send("4")
52-
                         Send("4")
52+
                             Sleep(140)
53-
                         Sleep(140)
53+
                             Send("4")
54-
                         Send("4")
54+
                             Sleep(140)
55-
                         Sleep(80)
55+
                             Send("4")
56-
                         Send("4")
56+
                             Sleep(80)
57-
                         Sleep(80)
57+
                             Send("4")
58-
                         Send("4")
58+
                             Sleep(80)
59-
                         Sleep(80)
59+
                             Send("4")
60-
                                             Send("4")
60+
                             Sleep(80)
61-
                         Sleep(80)
61+
                                                 Send("4")
62-
                         Send("4")
62+
                             Sleep(80)
63-
                         Sleep(80)
63+
                             Send("4")
64-
                                             Send("1")
64+
                             Sleep(80)
65-
                                             Send("3")
65+
                                                 Send("1")
66-
                         Sleep(800)
66+
                                                 Send("3")
67-
                         MouseMove(Round(290*$x_ratio),Round(270*$y_ratio),1) ;moves cursor over to the cellar so the proper blue pixel becomes highlighted
67+
                             Sleep(800)
68-
                         Sleep(700)
68+
                             MouseMove(Round(290*$x_ratio),Round(270*$y_ratio),1) ;moves cursor over to the cellar so the proper blue pixel becomes highlighted
69-
                         Call("CheckDead")
69+
                             Sleep(700)
70-
                         If $Window Then
70+
                             Call("CheckDead")
71-
                                MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
71+
                             If $Window Then
72-
                                Sleep($loadtime)
72+
									Call MainMenu()
73-
                                $Window = False
73+
                                    MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
74-
                                ExitLoop
74+
                                    Sleep($loadtime)
75-
                         ElseIf $Dead or $Logout Then
75+
                                    $Window = False
76-
                                ExitLoop
76+
                                    ExitLoop
77-
                         EndIf
77+
                             ElseIf $Dead or $Logout Then
78-
                         $Pixel2 = PixelSearch(0,0, Round(600*$x_ratio), Round(600*$y_ratio),0x334FB7,3) ;checks for open cellar (in a 600x400 box from the top left - where it should always be)
78+
                                    ExitLoop
79-
                                   If Not @error Then
79+
                             EndIf
80-
                                          MouseClick("left",Round(290*$x_ratio),Round(270*$y_ratio)) ;Entrance to cellar
80+
                             $Pixel2 = PixelSearch(0,0, Round(600*$x_ratio), Round(600*$y_ratio),0x334FB7,3) ;checks for open cellar (in a 600x400 box from the top left - where it should always be)
81-
                                          Sleep(400)
81+
                                       If Not @error Then
82-
                                          
82+
                                              MouseClick("left",Round(290*$x_ratio),Round(270*$y_ratio)) ;Entrance to cellar
83-
                                          Sleep($walktime)
83+
                                              Sleep(400)
84-
                                          MouseClick("middle",Round(110*$x_ratio),Round(1000*$y_ratio)) ;moves to doorway leading to rare inside cellar
84+
                                             
85-
                                          Sleep(2500)
85+
                                              Sleep($walktime)
86-
                                          MouseMove(Round(440*$x_ratio),Round(80*$y_ratio),1) ;hovers over the rare Sarkoth
86+
                                              MouseClick("middle",Round(110*$x_ratio),Round(1000*$y_ratio)) ;moves to doorway leading to rare inside cellar
87-
                                          Sleep(10)
87+
                                              Sleep(2500)
88-
                                          Send("{SHIFTDOWN}")
88+
                                              MouseMove(Round(440*$x_ratio),Round(80*$y_ratio),1) ;hovers over the rare Sarkoth
89-
                                                                              MouseClick("left",Round(440*$x_ratio),Round(80*$y_ratio),2)
89+
                                              Sleep(10)
90-
                                          MouseDown("right") ;attack middle
90+
                                              Send("{SHIFTDOWN}")
91-
                                          Sleep(7800)
91+
                                                                                  MouseClick("left",Round(440*$x_ratio),Round(80*$y_ratio),2)
92-
                                          MouseClick("right",Round(620*$x_ratio),Round(20*$y_ratio),2) ;break the table & chair
92+
                                              MouseDown("right") ;attack middle
93-
                                          Sleep(10)
93+
                                              Sleep(7800)
94-
                                          Send("{SHIFTUP}")
94+
                                              MouseClick("right",Round(620*$x_ratio),Round(20*$y_ratio),2) ;break the table & chair
95-
                                          Sleep(400)
95+
                                              Sleep(10)
96-
                                          MouseClick("middle",Round(530*$x_ratio),Round(170*$y_ratio)) ;location of sarkoth after death
96+
                                              Send("{SHIFTUP}")
97-
                                          Sleep(2100)
97+
                                              Sleep(400)
98-
                                          
98+
                                              MouseClick("middle",Round(530*$x_ratio),Round(170*$y_ratio)) ;location of sarkoth after death
99-
                                          Call("CheckLoot")
99+
                                              Sleep(2100)
100-
                                          Send("t")
100+
                                             
101-
                                          Sleep($tptime)
101+
                                              Call("CheckLoot")
102-
                                          Call("CheckDead")
102+
                                              Send("t")
103-
                                          If Not $Logout And Not $Dead And Not $Window Then
103+
                                              Sleep($tptime)
104-
                                                 Sleep(300)
104+
                                              Call("CheckDead")
105-
                                                 Send("{ESCAPE}") ;menu
105+
                                              If Not $Logout And Not $Dead And Not $Window Then
106-
                                                 Sleep(200)
106+
                                                     Sleep(300)
107-
                                                 MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
107+
                                                     Send("{ESCAPE}") ;menu
108-
                                                 Sleep($loadtime)
108+
                                                     Sleep(200)
109-
                                                 Call("CheckDead")
109+
                                                     MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
110-
                                                 If Not $Logout Then
110+
                                                     Sleep($loadtime)
111-
                                                        MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
111+
                                                     Call("CheckDead")
112-
                                                        Sleep($loadtime)
112+
                                                     If Not $Logout Then
113-
                                                 EndIf
113+
															Call MainMenu()
114-
                                          Else
114+
                                                            MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
115-
                                                 MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
115+
                                                            Sleep($loadtime)
116-
                                                 Sleep($loadtime)
116+
                                                     EndIf
117-
                                                 $Window = False ; reset the flag so it doesn't think a window is always up
117+
												  Else
118-
                                          EndIf
118+
												     Call MainMenu()
119-
                                   Else
119+
                                                     MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
120-
                                                                              Send("2")
120+
                                                     Sleep($loadtime)
121-
                                          Sleep(700)
121+
                                                     $Window = False ; reset the flag so it doesn't think a window is always up
122-
                                          Send("t")
122+
                                              EndIf
123-
                                          Sleep($tptime)
123+
                                       Else
124-
                                          Call("CheckDead")
124+
                                                                                  Send("2")
125-
                                          If Not $Logout And Not $Dead And Not $Window Then
125+
                                              Sleep(700)
126-
                                                 Sleep(300)
126+
                                              Send("t")
127-
                                                 Send("{ESCAPE}") ;menu
127+
                                              Sleep($tptime)
128-
                                                 Sleep(200)
128+
                                              Call("CheckDead")
129-
                                                 MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
129+
                                              If Not $Logout And Not $Dead And Not $Window Then
130-
                                                 Sleep($loadtime)
130+
                                                     Sleep(300)
131-
                                                 Call("CheckDead")
131+
                                                     Send("{ESCAPE}") ;menu
132-
                                                 If Not $Logout Then
132+
                                                     Sleep(200)
133-
                                                        MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
133+
                                                     MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
134-
                                                        Sleep($loadtime)
134+
                                                     Sleep($loadtime)
135-
                                                 EndIf
135+
                                                     Call("CheckDead")
136-
                                          Else
136+
                                                     If Not $Logout Then
137-
                                                 MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
137+
															Call MainMenu()
138-
                                                 Sleep($loadtime)
138+
                                                            MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
139-
                                                 $Window = False ; reset the flag so it doesn't think a window is always up
139+
                                                            Sleep($loadtime)
140-
                                          EndIf
140+
                                                     EndIf
141-
                                EndIf
141+
												  Else
142-
                  EndIf
142+
												     Call MainMenu()
143-
           WEnd
143+
                                                     MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
144-
           Call("RestartRun")
144+
                                                     Sleep($loadtime)
145-
        EndFunc
145+
                                                     $Window = False ; reset the flag so it doesn't think a window is always up
146-
         
146+
                                              EndIf
147-
        Func CheckDead()
147+
                                    EndIf
148-
        Call("CheckWindow")
148+
                      EndIf
149-
        $YouHaveDied = PixelSearch(Round(620*$x_ratio), Round(325*$y_ratio), Round(625*$x_ratio), Round(330*$y_ratio), 0xFFFFFF) ; checks for white text "YOU HAVE DIED"
149+
               WEnd
150-
        If Not @error Then
150+
               Call("RestartRun")
151-
           If Not $Window Then
151+
            EndFunc
152-
                  $Dead = True
152+
             
153-
                  Sleep(100)
153+
            Func CheckDead()
154-
                  Send("{Escape}")
154+
            Call("CheckWindow")
155-
                  Sleep(10)
155+
            $YouHaveDied = PixelSearch(Round(620*$x_ratio), Round(325*$y_ratio), Round(625*$x_ratio), Round(330*$y_ratio), 0xFFFFFF) ; checks for white text "YOU HAVE DIED"
156-
                  MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
156+
            If Not @error Then
157-
                  Sleep(11000)
157+
               If Not $Window Then
158-
                  Sleep($loadtime)
158+
                      $Dead = True
159-
                  MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
159+
                      Sleep(100)
160-
                  Sleep($loadtime)
160+
                      Send("{Escape}")
161-
           Else
161+
                      Sleep(10)
162-
                  MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
162+
                      MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
163-
                  Sleep($loadtime)
163+
                      Sleep(11000)
164-
                  $Dead = False
164+
                      Sleep($loadtime)
165-
           EndIf
165+
					  Call MainMenu()
166-
        Else
166+
                      MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
167-
           $Dead = False
167+
                      Sleep($loadtime)
168-
        EndIf
168+
				   Else
169-
        $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
169+
					  Call MainMenu()
170-
        If Not @error Then
170+
                      MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
171-
           Sleep(11000)
171+
                      Sleep($loadtime)
172-
           Sleep($loadtime)
172+
                      $Dead = False
173-
           If Not $Window Then
173+
               EndIf
174-
                  $Dead = True
174+
            Else
175-
                  $Logout = True
175+
               $Dead = False
176-
                  Sleep($loadtime)
176+
            EndIf
177-
                  MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
177+
            $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
178-
                  Sleep($loadtime)
178+
            If Not @error Then
179-
           Else
179+
               Sleep(11000)
180-
                  MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
180+
               Sleep($loadtime)
181-
                  Sleep($loadtime)
181+
               If Not $Window Then
182-
                  $Logout = False
182+
                      $Dead = True
183-
           EndIf
183+
                      $Logout = True
184-
        Else
184+
                      Sleep($loadtime)
185-
           $Logout = False
185+
					  Call MainMenu()
186-
        EndIf
186+
                      MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
187-
        EndFunc
187+
                      Sleep($loadtime)
188-
         
188+
				   Else
189-
        Func CheckWindow()
189+
					  Call MainMenu()
190-
        $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
190+
                      MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
191-
        If Not @error Then
191+
                      Sleep($loadtime)
192-
           Sleep(200)
192+
                      $Logout = False
193-
           Send("{SPACE}") ;close any open windows
193+
               EndIf
194-
           $Window = True
194+
            Else
195-
        Else
195+
               $Logout = False
196-
           $Window = False
196+
            EndIf
197-
        EndIf
197+
            EndFunc
198-
        EndFunc
198+
             
199-
         
199+
            Func CheckWindow()
200-
        Func CheckRepair()
200+
            $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
201-
        $RepairArea = PixelSearch(Round(1480*$x_ratio), 0, Round(1570*$x_ratio), Round(100*$y_ratio), $yellow)
201+
            If Not @error Then
202-
           If Not @error Then
202+
               Sleep(200)
203-
                  Call("DoRepair")
203+
               Send("{SPACE}") ;close any open windows
204-
           EndIf
204+
               $Window = True
205-
        $RepairAreaRed = PixelSearch(Round(1480*$x_ratio), 0, Round(1570*$x_ratio), Round(100*$y_ratio), $red)
205+
            Else
206-
           If Not @error Then
206+
               $Window = False
207-
                  Call("DoRepair")
207+
            EndIf
208-
           EndIf
208+
            EndFunc
209-
        EndFunc
209+
             
210-
         
210+
            Func CheckRepair()
211-
        Func DoRepair()
211+
            $RepairArea = PixelSearch(Round(1480*$x_ratio), 0, Round(1570*$x_ratio), Round(100*$y_ratio), $yellow)
212-
        Sleep(100)
212+
               If Not @error Then
213-
        Send("t")
213+
                      Call("DoRepair")
214-
        Sleep($tptime)
214+
               EndIf
215-
        MouseClick("left", Round(1480*$x_ratio),Round(281*$y_ratio)) ;begin movement towards merchant
215+
            $RepairAreaRed = PixelSearch(Round(1480*$x_ratio), 0, Round(1570*$x_ratio), Round(100*$y_ratio), $red)
216-
        Sleep(1500)
216+
               If Not @error Then
217-
        MouseClick("left", Round(1316*$x_ratio),Round(206*$y_ratio)) ;moves to get merchant in screen
217+
                      Call("DoRepair")
218-
        Sleep(1500)
218+
               EndIf
219-
        MouseClick("left", Round(845*$x_ratio),Round(225*$y_ratio)) ;NPC Merchant to the right of cain's home
219+
            EndFunc
220-
        Sleep(1200)
220+
             
221-
        MouseClick("left", Round(521*$x_ratio),Round(506*$y_ratio)) ;button to open up repair menu
221+
            Func DoRepair()
222-
        Sleep(400)
222+
            Sleep(100)
223-
        MouseClick("left", Round(260*$x_ratio),Round(595*$y_ratio)) ;button to pay for repairs
223+
            Send("t")
224-
        Sleep(200)
224+
            Sleep($tptime)
225-
        Call("CheckDead")
225+
            MouseClick("left", Round(1480*$x_ratio),Round(281*$y_ratio)) ;begin movement towards merchant
226-
        If Not $Dead and Not $Logout Then
226+
            Sleep(1500)
227-
           Send("{ESCAPE}") ;closes repair tab
227+
            MouseClick("left", Round(1316*$x_ratio),Round(206*$y_ratio)) ;moves to get merchant in screen
228-
           Sleep(100)
228+
            Sleep(1500)
229-
           Send("{ESCAPE}") ;menu
229+
            MouseClick("left", Round(845*$x_ratio),Round(225*$y_ratio)) ;NPC Merchant to the right of cain's home
230-
           Sleep(10)
230+
            Sleep(1200)
231-
           MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
231+
            MouseClick("left", Round(521*$x_ratio),Round(506*$y_ratio)) ;button to open up repair menu
232-
           Sleep($loadtime)
232+
            Sleep(400)
233-
           MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
233+
            MouseClick("left", Round(260*$x_ratio),Round(595*$y_ratio)) ;button to pay for repairs
234-
           Sleep($loadtime)
234+
            Sleep(200)
235-
        EndIf
235+
            Call("CheckDead")
236-
        EndFunc
236+
            If Not $Dead and Not $Logout Then
237-
         
237+
               Send("{ESCAPE}") ;closes repair tab
238-
        Func CheckLoot()
238+
               Sleep(100)
239-
        Sleep(Random(500,2000))
239+
               Send("{ESCAPE}") ;menu
240-
        $SetLoot = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0x02CE01, 2) ; set loot
240+
               Sleep(10)
241-
        If Not @error Then
241+
               MouseClick("left", Round(956*$x_ratio),Round(579*$y_ratio)) ;button to leave game
242-
           MouseClick ('left', $SetLoot[0], $SetLoot[1])
242+
               Sleep($loadtime)
243-
           Sleep(Random(800,1200))
243+
			   Call MainMenu()
244-
           $i+= 1
244+
               MouseClick("left", Round(230*$x_ratio),Round(416*$y_ratio)) ;button to resume game from main menu
245-
           If $i <= 6 Then
245+
               Sleep($loadtime)
246-
                  Call("CheckLoot")
246+
            EndIf
247-
           EndIf
247+
		 EndFunc
248-
        EndIf
248+
		 
249-
        $LegendaryLoot= PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0xBF642F, 2) ; legendary loot
249+
		 	Func MainMenu() ;verifies the screen is at the main menu before attempting to start the next game to avoid getting trapped in menus.
250-
        If Not @error Then
250+
	  Local $Menu = False
251-
           MouseClick ('left', $LegendaryLoot[0], $LegendaryLoot[1])
251+
	  While $Menu = False
252-
           Sleep(Random(800,1200))
252+
	  $Pixeltestmm = PixelGetColor(Round(251*$x_ratio), Round(284*$y_ratio)) ;tests for main menu
253-
           $i+= 1
253+
		 If Hex($Pixeltestmm, 6) == "683C02" Then
254-
           If $i <= 6 Then
254+
			$Menu = True
255-
                  Call("CheckLoot")
255+
		 Else
256-
           EndIf
256+
		 $Pixeltestgm = PixelGetColor(Round(937*$x_ratio), Round(246*$y_ratio)) ;checks if game menu is open
257-
        EndIf
257+
		 If Hex($Pixeltestgm, 6) == "621610" Then
258-
        If $LootRares Then
258+
			Send("{Escape}") ;return to main menu
259-
           $RareLoot = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0xBBBB00, 2) ; rare loot (darker for compatibility)
259+
			$Menu = True
260-
           If Not @error Then
260+
		 Else
261-
                  MouseClick ('left', $RareLoot[0], $RareLoot[1])
261+
		 $Pixeltestgmexit = PixelGetColor(Round(975*$x_ratio), Round(428*$y_ratio)) ;checks if exit game menu is open
262-
                  Sleep(Random(700,900))
262+
		 If Hex($Pixeltestgmexit, 6) == "FFA300" Then
263-
                  $i+= 1
263+
			Send("{Escape}")
264-
                  If $i <= 6 Then
264+
			Send("{Escape}")
265-
                         Call("CheckLoot")
265+
			$Menu = True
266-
                  EndIf
266+
		 Else
267-
           EndIf
267+
		 $Pixeltestbm = PixelGetColor(Round(958*$x_ratio), Round(150*$y_ratio)) ;checks if banner customization window is open
268-
        EndIf
268+
		 If Hex($Pixeltestbm, 6) == "933618" Then
269-
        If $LootGems Then
269+
			Send("{Escape}")
270-
           $AmethystDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Amethyst,8)
270+
			$Menu = True
271-
           If Not @error Then
271+
		 Else
272-
                  MouseClick("left", $AmethystDrop[0], $AmethystDrop[1])
272+
		 $Pixeltestpm = PixelGetColor(Round(1506*$x_ratio), Round(138*$y_ratio)) ;checks if player window is open
273-
                  Sleep(Random(900,1400))
273+
		 If Hex($Pixeltestpm, 6) == "320c08" Then
274-
                  $i+= 1
274+
			Send("{Escape}")
275-
                  If $i <= 10 Then
275+
			$Menu = True
276-
                         Call("CheckLoot")
276+
		 EndIf
277-
                  EndIf
277+
	  EndIf
278-
           EndIf
278+
   EndIf
279-
           $RubyDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Ruby,6)
279+
EndIf
280-
           If Not @error Then
280+
EndIf
281-
                  MouseClick("left", $RubyDrop[0], $RubyDrop[1])
281+
WEnd
282-
                  Sleep(Random(900,1400))
282+
   EndFunc
283-
                  $i+= 1
283+
             
284-
                  If $i <= 10 Then
284+
            Func CheckLoot()
285-
                         Call("CheckLoot")
285+
            Sleep(Random(500,2000))
286-
                  EndIf
286+
            $SetLoot = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0x02CE01, 2) ; set loot
287-
           EndIf
287+
            If Not @error Then
288-
           $EmeraldDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Emerald,11)
288+
               MouseClick ('left', $SetLoot[0], $SetLoot[1])
289-
           If Not @error Then
289+
               Sleep(Random(800,1200))
290-
                  MouseClick("left", $EmeraldDrop[0], $EmeraldDrop[1])
290+
               $i+= 1
291-
                  Sleep(Random(900,1400))
291+
               If $i <= 6 Then
292-
                  $i+= 1
292+
                      Call("CheckLoot")
293-
                  If $i <= 10 Then
293+
               EndIf
294-
                         Call("CheckLoot")
294+
            EndIf
295-
                  EndIf
295+
            $LegendaryLoot= PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0xBF642F, 2) ; legendary loot
296-
           EndIf
296+
            If Not @error Then
297-
           $TopazDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Topaz,2)
297+
               MouseClick ('left', $LegendaryLoot[0], $LegendaryLoot[1])
298-
           If Not 1 = 1 Then ; change to 'If Not @error Then' if you want to search for topazes
298+
               Sleep(Random(800,1200))
299-
                  MouseClick("left", $TopazDrop[0], $TopazDrop[1])
299+
               $i+= 1
300-
                  Sleep(Random(900,1400))
300+
               If $i <= 6 Then
301-
                  $i+= 1
301+
                      Call("CheckLoot")
302-
                  If $i <= 10 Then
302+
               EndIf
303-
                         Call("CheckLoot")
303+
            EndIf
304-
                  EndIf
304+
            If $LootRares Then
305-
           EndIf
305+
               $RareLoot = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0xBBBB00, 2) ; rare loot (darker for compatibility)
306-
        EndIf
306+
               If Not @error Then
307-
        EndFunc
307+
                      MouseClick ('left', $RareLoot[0], $RareLoot[1])
308-
         
308+
                      Sleep(Random(700,900))
309-
        Func Pause()
309+
                      $i+= 1
310-
           $Leave = False
310+
                      If $i <= 6 Then
311-
        EndFunc
311+
                             Call("CheckLoot")
312-
         
312+
                      EndIf
313-
        Func Stop() ;to allow the script to stop
313+
               EndIf
314-
            Exit
314+
            EndIf
315-
        EndFunc
315+
            If $LootGems Then
316-
         
316+
               $AmethystDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Amethyst,8)
317-
        Func Leave()
317+
               If Not @error Then
318-
           $Leave = True
318+
                      MouseClick("left", $AmethystDrop[0], $AmethystDrop[1])
319-
        EndFunc
319+
                      Sleep(Random(900,1400))
320
                      $i+= 1
321
                      If $i <= 10 Then
322
                             Call("CheckLoot")
323
                      EndIf
324
               EndIf
325
               $RubyDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Ruby,6)
326
               If Not @error Then
327
                      MouseClick("left", $RubyDrop[0], $RubyDrop[1])
328
                      Sleep(Random(900,1400))
329
                      $i+= 1
330
                      If $i <= 10 Then
331
                             Call("CheckLoot")
332
                      EndIf
333
               EndIf
334
               $EmeraldDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Emerald,11)
335
               If Not @error Then
336
                      MouseClick("left", $EmeraldDrop[0], $EmeraldDrop[1])
337
                      Sleep(Random(900,1400))
338
                      $i+= 1
339
                      If $i <= 10 Then
340
                             Call("CheckLoot")
341
                      EndIf
342
               EndIf
343
               $TopazDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Topaz,2)
344
               If Not 1 = 1 Then ; change to 'If Not @error Then' if you want to search for topazes
345
                      MouseClick("left", $TopazDrop[0], $TopazDrop[1])
346
                      Sleep(Random(900,1400))
347
                      $i+= 1
348
                      If $i <= 10 Then
349
                             Call("CheckLoot")
350
                      EndIf
351
               EndIf
352
            EndIf
353
            EndFunc
354
             
355
            Func Pause()
356
               $Leave = False
357
            EndFunc
358
             
359
            Func Stop() ;to allow the script to stop
360
                Exit
361
            EndFunc
362
             
363
            Func Leave()
364
               $Leave = True
365
            EndFunc