Originally Posted by
P2502
Thank you for this! It mostly fixed the problem. Mangle does, however, drop a single blue every once in a while (has been around 1/25 runs for me) which causes the initial bug to occur. I took a look at the code briefly earlier and I think this could be fixed by simply adding a separate code segment for blues as well. Gotta take a closer look when I get off work.
Thanks again for pointing this out!

i've re-written the whole function for you, try this :
Code:
Func BossKO()
Print("Checking if Boss is Dead")
local $ko = 0
While $ko < 45
$coords = PixelSearch($lootX, $lootY, $endLootX, $endLootY, $legend, 1)
If Not @error Then
$ko = 101
Sleep(100)
MouseUp("right")
Sleep(300)
MouseClick("left", $coords[0], $coords[1], 1, 10)
$Successlegs += 1
LogToFile("Picked: 1/" & $Successlegs & " ### Legendaries ### at Run n" & $run)
Sleep(100)
Else
$coords = PixelSearch($lootX, $lootY, $endLootX, $endLootY, $green, 1)
If Not @error Then
$ko = 101
Sleep(200)
MouseUp("right")
Sleep(300)
Else
$coords = PixelSearch($lootX, $lootY, $endLootX, $endLootY, $yellow, 1)
If Not @error Then
$ko = 101
Sleep(200)
MouseUp("right")
Sleep(300)
Else
$coords = PixelSearch($lootX, $lootY, $endLootX, $endLootY, $blue, 1)
If Not @error Then
$ko = 101
Sleep(200)
MouseUp("right")
Sleep(300)
Else
$ko = $ko + 1
If $ko = 20 Then
$error2talkrich += 1
Print("Error: [" & $Run & "]")
menuLeave()
EndIf
Sleep(300);
Print("Boss Not Dead [" & $Run & "] Try number: " & $Ko)
EndIf
EndIf
EndIf
EndIf
WEnd
checkloot()
EndFunc