Code:
Func CheckLoot()
Sleep(Random(1200,3200))
$Pixel4 = PixelSearch(Round(270*$x_ratio), 0, Round(1490*$x_ratio), Round(900*$y_ratio), 0xBF642F, 1) ;searches main window for color of legendary lootz
If Not @error Then
MouseClick ('left', $Pixel4[0], $Pixel4[1])
Sleep(Random(800,1200))
$i+= 1
If $i < 8 Then
Call("CheckLoot")
EndIf
EndIf
$Pixel5 = PixelSearch(Round(270*$x_ratio), 0, Round(1490*$x_ratio), Round(900*$y_ratio), 0xFFFF00, 1) ; rare lootz (also f3f45b)
If Not @error Then
MouseClick ('left', $Pixel5[0], $Pixel5[1])
Sleep(Random(800,1800))
$i+= 1
If $i < 8 Then
Call("CheckLoot")
EndIf
EndIf
$Pixel6 = PixelSearch(Round(270*$x_ratio), 0, Round(1490*$x_ratio), Round(900*$y_ratio), 0x00FF00, 1) ; set lootz
If Not @error Then
MouseClick ('left', $Pixel6[0], $Pixel6[1])
Sleep(Random(800,1200))
$i+= 1
If $i < 8 Then
Call("CheckLoot")
EndIf
EndIf
$Pixel7= PixelSearch(Round(270*$x_ratio), 0, Round(1490*$x_ratio), Round(900*$y_ratio), 0x7D6BC9, 1) ;searches for Amethyst.
If Not @error Then
MouseClick ('left', $Pixel7[0], $Pixel7[1])
Sleep(Random(800,1200))
$i+= 1
If $i < 8 Then
Call("CheckLoot")
EndIf
EndIf
$Pixel8= PixelSearch(Round(270*$x_ratio), 0, Round(1490*$x_ratio), Round(900*$y_ratio), 0xC11D2C, 1) ;searches for Ruby.
If Not @error Then
MouseClick ('left', $Pixel8[0], $Pixel8[1])
Sleep(Random(800,1200))
$i+= 1
If $i < 8 Then
Call("CheckLoot")
EndIf
EndIf
$Pixel9= PixelSearch(Round(270*$x_ratio), 0, Round(1490*$x_ratio), Round(900*$y_ratio), 0xF4FC96, 1) ;searches for Emerald.
If Not @error Then
MouseClick ('left', $Pixel9[0], $Pixel9[1])
Sleep(Random(800,1200))
$i+= 1
If $i < 8 Then
Call("CheckLoot")
EndIf
EndIf
$Pixel10= PixelSearch(Round(270*$x_ratio), 0, Round(1490*$x_ratio), Round(900*$y_ratio), 0xFFFF59, 1) ;searches for Topaz.
If Not @error Then
MouseClick ('left', $Pixel10[0], $Pixel10[1])
Sleep(Random(800,1200))
$i+= 1
If $i < 8 Then
Call("CheckLoot")
EndIf
EndIf
EndFunc